pi notify enhancements
This commit is contained in:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user