diff --git a/kitty/files/kitty.conf b/kitty/files/kitty.conf index 58226eb..3dcf719 100644 --- a/kitty/files/kitty.conf +++ b/kitty/files/kitty.conf @@ -799,7 +799,7 @@ font_size 12.0 #: Terminal bell {{{ -# enable_audio_bell yes +enable_audio_bell yes #: The audio bell. Useful to disable it in environments that require #: silence. diff --git a/pi/files/agent/extensions/pi-done-notify.ts b/pi/files/agent/extensions/pi-done-notify.ts index 8f88a01..c596fae 100644 --- a/pi/files/agent/extensions/pi-done-notify.ts +++ b/pi/files/agent/extensions/pi-done-notify.ts @@ -61,6 +61,13 @@ function notifyDesktop( const ICON_PATH = "/home/thomasgl/.pi/agent/extensions/assets/pi-logo.svg"; function notify(title: string, body: string): void { + // If in SSH session, use OSC escape sequences (they travel to client terminal) + if (isSSH()) { + // Try OSC 99 (Kitty) first if client might be Kitty, otherwise OSC 777 + notifyOSC777(title, body); + return; + } + if (process.platform === "linux") { notifyDesktop(title, body, ICON_PATH); return; @@ -74,8 +81,29 @@ function notify(title: string, body: string): void { } } +// Detect if running in an SSH session +function isSSH(): boolean { + return !!( + process.env.SSH_CONNECTION || + process.env.SSH_CLIENT || + process.env.SSH_TTY + ); +} + +// Send BEL character - travels through SSH to client terminal +// Configure your terminal to play a sound on bell +function playBell(): void { + process.stdout.write("\x07"); +} + // Sound playback function playSound(soundPath?: string): void { + // If in SSH session, send BEL to client terminal instead of playing locally + if (isSSH()) { + playBell(); + return; + } + const { execFile } = require("child_process"); if (process.platform === "darwin") {