@mohak34/opencode-notifier 0.2.6 → 0.2.7
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 +15 -1
- package/dist/index.js +9 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,6 +74,7 @@ Create `~/.config/opencode/opencode-notifier.json` with the defaults:
|
|
|
74
74
|
"suppressWhenFocused": true,
|
|
75
75
|
"enableOnDesktop": false,
|
|
76
76
|
"notificationSystem": "osascript",
|
|
77
|
+
"suppressGhosttySound": false,
|
|
77
78
|
"linux": {
|
|
78
79
|
"grouping": false
|
|
79
80
|
},
|
|
@@ -151,7 +152,8 @@ Create `~/.config/opencode/opencode-notifier.json` with the defaults:
|
|
|
151
152
|
"showIcon": true,
|
|
152
153
|
"suppressWhenFocused": true,
|
|
153
154
|
"enableOnDesktop": false,
|
|
154
|
-
"notificationSystem": "osascript"
|
|
155
|
+
"notificationSystem": "osascript",
|
|
156
|
+
"suppressGhosttySound": false
|
|
155
157
|
}
|
|
156
158
|
```
|
|
157
159
|
|
|
@@ -167,6 +169,7 @@ Create `~/.config/opencode/opencode-notifier.json` with the defaults:
|
|
|
167
169
|
- `suppressWhenFocused` - Skip notifications and sounds when the terminal is the active window (default: true). See [Focus detection](#focus-detection) for platform details
|
|
168
170
|
- `enableOnDesktop` - Run the plugin on Desktop and Web clients (default: false). When false, the plugin only runs on CLI. Set to true if you want notifications/sounds/commands on Desktop/Web — useful if you want custom commands (Telegram, webhooks) but don't care about built-in notifications
|
|
169
171
|
- `notificationSystem` - macOS only: `"osascript"`, `"node-notifier"`, or `"ghostty"` (default: "osascript"). Use `"ghostty"` if you're running Ghostty terminal for native OSC 9 notifications
|
|
172
|
+
- `suppressGhosttySound` - macOS only: when `true` with `notificationSystem: "ghostty"`, skips the plugin's sound to avoid duplicating macOS Notification Center's default sound (default: false)
|
|
170
173
|
- `minDuration` - Suppress `complete` and `subagent_complete` notifications when session finishes faster than this many seconds (default: 0). See [Minimum duration threshold](#minimum-duration-threshold)
|
|
171
174
|
- `linux.grouping` - Linux only: replace notifications in-place instead of stacking (default: false). Requires `notify-send` 0.8+
|
|
172
175
|
|
|
@@ -363,6 +366,17 @@ If you're using [Ghostty](https://ghostty.org/) terminal, you can use its native
|
|
|
363
366
|
|
|
364
367
|
This sends notifications directly through the terminal instead of using system notification tools. Works on any platform where Ghostty is running.
|
|
365
368
|
|
|
369
|
+
**macOS:** Ghostty delivers notifications through macOS Notification Center, which plays its own default sound. This can result in duplicate audio with the plugin's sound effects. Set `suppressGhosttySound` to `true` to skip the plugin's sound:
|
|
370
|
+
|
|
371
|
+
```json
|
|
372
|
+
{
|
|
373
|
+
"notificationSystem": "ghostty",
|
|
374
|
+
"suppressGhosttySound": true
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Note: custom sounds configured via the `sounds` section still play — only default (bundled) sounds are suppressed.
|
|
379
|
+
|
|
366
380
|
If you're using Ghostty inside tmux, enable passthrough in your tmux config so OSC 9 notifications can pass through:
|
|
367
381
|
|
|
368
382
|
```tmux
|
package/dist/index.js
CHANGED
|
@@ -101,6 +101,7 @@ var DEFAULT_CONFIG = {
|
|
|
101
101
|
suppressWhenFocused: true,
|
|
102
102
|
enableOnDesktop: false,
|
|
103
103
|
notificationSystem: "osascript",
|
|
104
|
+
suppressGhosttySound: false,
|
|
104
105
|
linux: {
|
|
105
106
|
grouping: false
|
|
106
107
|
},
|
|
@@ -237,6 +238,7 @@ function loadConfig() {
|
|
|
237
238
|
suppressWhenFocused: userConfig.suppressWhenFocused ?? DEFAULT_CONFIG.suppressWhenFocused,
|
|
238
239
|
enableOnDesktop: typeof userConfig.enableOnDesktop === "boolean" ? userConfig.enableOnDesktop : DEFAULT_CONFIG.enableOnDesktop,
|
|
239
240
|
notificationSystem: userConfig.notificationSystem === "node-notifier" ? "node-notifier" : userConfig.notificationSystem === "ghostty" ? "ghostty" : "osascript",
|
|
241
|
+
suppressGhosttySound: typeof userConfig.suppressGhosttySound === "boolean" ? userConfig.suppressGhosttySound : DEFAULT_CONFIG.suppressGhosttySound,
|
|
240
242
|
linux: {
|
|
241
243
|
grouping: typeof userConfig.linux?.grouping === "boolean" ? userConfig.linux.grouping : DEFAULT_CONFIG.linux.grouping
|
|
242
244
|
},
|
|
@@ -1560,7 +1562,8 @@ async function handleEvent(config, eventType, projectName, elapsedSeconds, sessi
|
|
|
1560
1562
|
timestamp,
|
|
1561
1563
|
turn
|
|
1562
1564
|
});
|
|
1563
|
-
|
|
1565
|
+
const notificationEnabled = isEventNotificationEnabled(config, eventType);
|
|
1566
|
+
if (notificationEnabled) {
|
|
1564
1567
|
const title = getNotificationTitle(config, projectName);
|
|
1565
1568
|
const iconPath = getIconPath(config);
|
|
1566
1569
|
const onNotificationClick = isKDEJumpBackSupported() ? () => void focusTerminal() : undefined;
|
|
@@ -1568,8 +1571,11 @@ async function handleEvent(config, eventType, projectName, elapsedSeconds, sessi
|
|
|
1568
1571
|
}
|
|
1569
1572
|
if (isEventSoundEnabled(config, eventType)) {
|
|
1570
1573
|
const customSoundPath = getSoundPath(config, eventType);
|
|
1571
|
-
const
|
|
1572
|
-
|
|
1574
|
+
const ghosttyOnMac = process.platform === "darwin" && config.notificationSystem === "ghostty" && notificationEnabled && config.suppressGhosttySound;
|
|
1575
|
+
if (!ghosttyOnMac) {
|
|
1576
|
+
const soundVolume = getSoundVolume(config, eventType);
|
|
1577
|
+
promises.push(playSound(eventType, customSoundPath, soundVolume));
|
|
1578
|
+
}
|
|
1573
1579
|
}
|
|
1574
1580
|
if (isEventBellEnabled(config, eventType)) {
|
|
1575
1581
|
promises.push(ringBell());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohak34/opencode-notifier",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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",
|