@mohak34/opencode-notifier 0.2.5 → 0.2.6

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -557,6 +557,8 @@ async function sendNotification(title, message, timeout, iconPath, notificationS
557
557
  });
558
558
  }
559
559
  if ((platform === "Linux" || platform.match(/BSD$/)) && !is_wsl_default) {
560
+ if (!process.env.DBUS_SESSION_BUS_ADDRESS)
561
+ return;
560
562
  if (onClick) {
561
563
  if (linuxGrouping) {
562
564
  if (linuxNotifySendSupportsReplace === null) {
@@ -898,15 +900,18 @@ function getLinuxWaylandActiveWindowId() {
898
900
  }
899
901
  function getWindowsActiveWindowId() {
900
902
  const script = `$type=Add-Type -Name FocusHelper -Namespace OpenCodeNotifier -MemberDefinition '[DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();' -PassThru; $type::GetForegroundWindow()`;
901
- let windowId = execFileWithTimeout("powershell", ["-NoProfile", "-NonInteractive", "-Command", script], 1000);
903
+ let windowId = execFileWithTimeout("powershell", ["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-Command", script], 1000);
902
904
  if (!windowId)
903
- windowId = execFileWithTimeout("pwsh", ["-NoProfile", "-NonInteractive", "-Command", script], 1000);
905
+ windowId = execFileWithTimeout("pwsh", ["-NoProfile", "-NonInteractive", "-WindowStyle", "Hidden", "-Command", script], 1000);
904
906
  return windowId;
905
907
  }
906
908
  function getMacOSActiveWindowId() {
907
909
  return execWithTimeout(`osascript -e 'tell application "System Events" to return id of window 1 of (first application process whose frontmost is true)'`);
908
910
  }
909
911
  function getMacOSFrontmostAppName() {
912
+ const lsappinfo = execWithTimeout(`lsappinfo info -only name \`lsappinfo front\` | sed 's/.*="\\([^"]*\\)".*/\\1/'`);
913
+ if (lsappinfo)
914
+ return lsappinfo;
910
915
  return execWithTimeout(`osascript -e 'tell application "System Events" to return name of first application process whose frontmost is true'`);
911
916
  }
912
917
  function normalizeMacAppName(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohak34/opencode-notifier",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
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",