@mohak34/opencode-notifier 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +19 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -172,7 +172,7 @@ When `suppressWhenFocused` is enabled, notifications are skipped if your termina
|
|
|
172
172
|
|
|
173
173
|
- macOS: works out of the box
|
|
174
174
|
- Windows: uses PowerShell to detect the foreground app
|
|
175
|
-
- Linux:
|
|
175
|
+
- Linux: focus suppression is disabled (Wayland/X11 focus detection is unreliable)
|
|
176
176
|
|
|
177
177
|
### Messages
|
|
178
178
|
|
package/dist/index.js
CHANGED
|
@@ -4251,6 +4251,20 @@ function runCommand2(config, event, message) {
|
|
|
4251
4251
|
}
|
|
4252
4252
|
|
|
4253
4253
|
// src/index.ts
|
|
4254
|
+
var TERMINAL_PROCESS_NAMES = {
|
|
4255
|
+
ghostty: "Ghostty",
|
|
4256
|
+
kitty: "kitty",
|
|
4257
|
+
iterm: "iTerm2",
|
|
4258
|
+
iterm2: "iTerm2",
|
|
4259
|
+
wezterm: "WezTerm",
|
|
4260
|
+
alacritty: "Alacritty",
|
|
4261
|
+
terminal: "Terminal",
|
|
4262
|
+
apple_terminal: "Terminal",
|
|
4263
|
+
hyper: "Hyper",
|
|
4264
|
+
warp: "Warp",
|
|
4265
|
+
vscode: "Code",
|
|
4266
|
+
"vscode-insiders": "Code - Insiders"
|
|
4267
|
+
};
|
|
4254
4268
|
function getNotificationTitle(config, projectName) {
|
|
4255
4269
|
if (config.showProjectName && projectName) {
|
|
4256
4270
|
return `OpenCode (${projectName})`;
|
|
@@ -4320,31 +4334,8 @@ async function getFrontmostProcessWindows() {
|
|
|
4320
4334
|
`);
|
|
4321
4335
|
return runExecCommand("powershell", ["-NoProfile", "-Command", script]);
|
|
4322
4336
|
}
|
|
4323
|
-
function
|
|
4324
|
-
|
|
4325
|
-
if (!matches)
|
|
4326
|
-
return [];
|
|
4327
|
-
return matches.map((value) => value.replace(/"/g, ""));
|
|
4328
|
-
}
|
|
4329
|
-
async function getActiveWindowClassLinux() {
|
|
4330
|
-
if (process.platform !== "linux")
|
|
4331
|
-
return null;
|
|
4332
|
-
const xdotoolClass = await runExecCommand("xdotool", ["getactivewindow", "getwindowclassname"]);
|
|
4333
|
-
if (xdotoolClass)
|
|
4334
|
-
return xdotoolClass;
|
|
4335
|
-
const activeWindow = await runExecCommand("xprop", ["-root", "_NET_ACTIVE_WINDOW"]);
|
|
4336
|
-
if (!activeWindow)
|
|
4337
|
-
return null;
|
|
4338
|
-
const idMatch = activeWindow.match(/0x[0-9a-fA-F]+/);
|
|
4339
|
-
if (!idMatch)
|
|
4340
|
-
return null;
|
|
4341
|
-
const wmClass = await runExecCommand("xprop", ["-id", idMatch[0], "WM_CLASS"]);
|
|
4342
|
-
if (!wmClass)
|
|
4343
|
-
return null;
|
|
4344
|
-
const names = extractQuotedStrings(wmClass);
|
|
4345
|
-
if (names.length === 0)
|
|
4346
|
-
return null;
|
|
4347
|
-
return names[names.length - 1];
|
|
4337
|
+
function getTerminalProcessName(terminalName) {
|
|
4338
|
+
return TERMINAL_PROCESS_NAMES[terminalName.toLowerCase()] ?? terminalName;
|
|
4348
4339
|
}
|
|
4349
4340
|
function normalizeAppName(value) {
|
|
4350
4341
|
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -4362,15 +4353,15 @@ async function isTerminalFocused() {
|
|
|
4362
4353
|
return false;
|
|
4363
4354
|
if (process.platform === "darwin") {
|
|
4364
4355
|
const frontmost = await getFrontmostAppMac();
|
|
4365
|
-
|
|
4356
|
+
const processName = getTerminalProcessName(terminalName);
|
|
4357
|
+
return frontmost ? frontmost.toLowerCase() === processName.toLowerCase() : false;
|
|
4366
4358
|
}
|
|
4367
4359
|
if (process.platform === "win32") {
|
|
4368
4360
|
const frontmostProcess = await getFrontmostProcessWindows();
|
|
4369
4361
|
return frontmostProcess ? matchesTerminal(frontmostProcess, terminalName) : false;
|
|
4370
4362
|
}
|
|
4371
4363
|
if (process.platform === "linux") {
|
|
4372
|
-
|
|
4373
|
-
return frontmostClass ? matchesTerminal(frontmostClass, terminalName) : false;
|
|
4364
|
+
return false;
|
|
4374
4365
|
}
|
|
4375
4366
|
return false;
|
|
4376
4367
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohak34/opencode-notifier",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "OpenCode plugin that sends system notifications and plays sounds when permission is needed, generation completes, or errors occur",
|
|
5
5
|
"author": "mohak34",
|
|
6
6
|
"license": "MIT",
|