Skip to content

Commit 056b144

Browse files
committed
fix(session-notification): gracefully handle notify-send failures on WSL
Add .catch() to notify-send command to prevent GDBus.Error logs when org.freedesktop.Notifications service is unavailable in WSL environments. Fixes #47 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
1 parent 7fef07d commit 056b144

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/hooks/session-notification.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function sendNotification(
5656
await ctx.$`osascript -e ${"display notification \"" + escapedMessage + "\" with title \"" + escapedTitle + "\""}`
5757
break
5858
case "linux":
59-
await ctx.$`notify-send ${escapedTitle} ${escapedMessage}`
59+
await ctx.$`notify-send ${escapedTitle} ${escapedMessage}`.catch(() => {})
6060
break
6161
case "win32":
6262
await ctx.$`powershell -Command ${"[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('" + escapedMessage + "', '" + escapedTitle + "')"}`

0 commit comments

Comments
 (0)