diff --git a/hooks/hooks.json b/hooks/hooks.json index d49b401a..d8bdef3c 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -297,7 +297,7 @@ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"stop:desktop-notify\" \"scripts/hooks/desktop-notify.js\" \"standard,strict\"", "async": true, - "timeout": 5 + "timeout": 10 } ], "description": "Send macOS desktop notification with task summary when Claude responds" diff --git a/scripts/hooks/desktop-notify.js b/scripts/hooks/desktop-notify.js index a9bd2540..8d844e03 100644 --- a/scripts/hooks/desktop-notify.js +++ b/scripts/hooks/desktop-notify.js @@ -47,7 +47,10 @@ function notifyMacOS(title, body) { const safeBody = body.replace(/\\/g, '').replace(/"/g, '\u201C'); const safeTitle = title.replace(/\\/g, '').replace(/"/g, '\u201C'); const script = `display notification "${safeBody}" with title "${safeTitle}"`; - spawnSync('osascript', ['-e', script], { stdio: 'ignore', timeout: 3000 }); + const result = spawnSync('osascript', ['-e', script], { stdio: 'ignore', timeout: 5000 }); + if (result.error || result.status !== 0) { + log(`[DesktopNotify] osascript failed: ${result.error ? result.error.message : `exit ${result.status}`}`); + } } // TODO: future platform support