@mohak34/opencode-notifier 0.2.8-beta.0 → 0.2.9-beta.0
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/dist/index.js +15 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -636,7 +636,8 @@ async function runCommand(command, args) {
|
|
|
636
636
|
return new Promise((resolve, reject) => {
|
|
637
637
|
const proc = spawn2(command, args, {
|
|
638
638
|
stdio: "ignore",
|
|
639
|
-
detached: false
|
|
639
|
+
detached: false,
|
|
640
|
+
windowsHide: true
|
|
640
641
|
});
|
|
641
642
|
proc.on("error", (err) => {
|
|
642
643
|
reject(err);
|
|
@@ -691,7 +692,7 @@ async function playOnMac(soundPath, volume) {
|
|
|
691
692
|
}
|
|
692
693
|
async function playOnWindows(soundPath) {
|
|
693
694
|
const script = `& { (New-Object Media.SoundPlayer $args[0]).PlaySync() }`;
|
|
694
|
-
await runCommand("powershell", ["-
|
|
695
|
+
await runCommand("powershell", ["-NoProfile", "-NonInteractive", "-Command", script, soundPath]);
|
|
695
696
|
}
|
|
696
697
|
async function playSound(event, customPath, volume) {
|
|
697
698
|
const now = Date.now();
|
|
@@ -759,7 +760,8 @@ function runCommand2(config, event, message, sessionTitle, agentName, projectNam
|
|
|
759
760
|
const command = substituteTokens(config.command.path, event, message, sessionTitle, agentName, projectName, timestamp, turn);
|
|
760
761
|
const proc = spawn3(command, args, {
|
|
761
762
|
stdio: "ignore",
|
|
762
|
-
detached: true
|
|
763
|
+
detached: true,
|
|
764
|
+
windowsHide: true
|
|
763
765
|
});
|
|
764
766
|
proc.on("error", () => {});
|
|
765
767
|
proc.unref();
|
|
@@ -1005,6 +1007,10 @@ function isLinuxTerminalFocused(params) {
|
|
|
1005
1007
|
return tmuxPaneActive;
|
|
1006
1008
|
return true;
|
|
1007
1009
|
}
|
|
1010
|
+
function isWindowsTerminalFocused(params) {
|
|
1011
|
+
const { cachedWindowId: cachedWindowId2, currentWindowId } = params;
|
|
1012
|
+
return !!cachedWindowId2 && currentWindowId === cachedWindowId2;
|
|
1013
|
+
}
|
|
1008
1014
|
function isTmuxPaneActive() {
|
|
1009
1015
|
const tmuxPane = process.env.TMUX_PANE ?? null;
|
|
1010
1016
|
const result = execFileWithTimeout("tmux", ["display-message", "-t", tmuxPane ?? "", "-p", "#{session_attached} #{window_active} #{pane_active}"]);
|
|
@@ -1037,6 +1043,12 @@ function isTerminalFocused() {
|
|
|
1037
1043
|
}
|
|
1038
1044
|
return true;
|
|
1039
1045
|
}
|
|
1046
|
+
if (process.platform === "win32") {
|
|
1047
|
+
return isWindowsTerminalFocused({
|
|
1048
|
+
cachedWindowId,
|
|
1049
|
+
currentWindowId: getWindowsActiveWindowId()
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1040
1052
|
const tmuxPaneActive = process.env.TMUX ? isTmuxPaneActive() : null;
|
|
1041
1053
|
return isLinuxTerminalFocused({
|
|
1042
1054
|
cachedWindowId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohak34/opencode-notifier",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9-beta.0",
|
|
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",
|