Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ function notify(title: string, body: string): void {
// Sanitize to avoid breaking the escape sequence delimiters (;)
const sTitle = title.replace(/;/g, ":").replace(/\n/g, " ").trim();
const sBody = body.replace(/;/g, ":").replace(/\n/g, " ").trim();
process.stdout.write(`\x1b]777;notify;${sTitle};${sBody}\x07`);
let seq = `\x1b]777;notify;${sTitle};${sBody}\x07`;
// When running inside tmux, wrap in DCS passthrough so the host terminal
// (e.g. Ghostty) actually receives the OSC. Requires `set -g allow-passthrough on`.
if (process.env.TMUX) {
seq = `\x1bPtmux;${seq.replace(/\x1b/g, "\x1b\x1b")}\x1b\\`;
}
process.stdout.write(seq);
}

function formatDuration(ms: number): string | null {
Expand Down