Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 8 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface NotifierConfig {
showProjectName: boolean
showSessionTitle: boolean
showIcon: boolean
notificationSystem: "osascript" | "node-notifier"
notificationSystem: "osascript" | "node-notifier" | "ghostty"
linux: LinuxConfig
command: CommandConfig
events: {
Expand Down Expand Up @@ -82,7 +82,7 @@ const DEFAULT_CONFIG: NotifierConfig = {
showProjectName: true,
showSessionTitle: false,
showIcon: true,
notificationSystem: "osascript",
notificationSystem: "osascript" as const,
linux: {
grouping: false,
},
Expand Down Expand Up @@ -210,7 +210,12 @@ export function loadConfig(): NotifierConfig {
showProjectName: userConfig.showProjectName ?? DEFAULT_CONFIG.showProjectName,
showSessionTitle: userConfig.showSessionTitle ?? DEFAULT_CONFIG.showSessionTitle,
showIcon: userConfig.showIcon ?? DEFAULT_CONFIG.showIcon,
notificationSystem: userConfig.notificationSystem === "node-notifier" ? "node-notifier" : "osascript",
notificationSystem:
userConfig.notificationSystem === "node-notifier"
? "node-notifier"
: userConfig.notificationSystem === "ghostty"
? "ghostty"
: "osascript",
linux: {
grouping: typeof userConfig.linux?.grouping === "boolean" ? userConfig.linux.grouping : DEFAULT_CONFIG.linux.grouping,
},
Expand Down
12 changes: 11 additions & 1 deletion src/notify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function sendNotification(
message: string,
timeout: number,
iconPath?: string,
notificationSystem: "osascript" | "node-notifier" = "osascript",
notificationSystem: "osascript" | "node-notifier" | "ghostty" = "osascript",
linuxGrouping: boolean = true
): Promise<void> {
const now = Date.now()
Expand All @@ -94,6 +94,16 @@ export async function sendNotification(
}
lastNotificationTime[message] = now

if (notificationSystem === "ghostty") {
return new Promise((resolve) => {
const escapedTitle = title.replace(/[;\x07\x1b]/g, "")
const escapedMessage = message.replace(/[;\x07\x1b]/g, "")
process.stdout.write(`\x1b]777;notify;${escapedTitle};${escapedMessage}\x07`, () => {
resolve()
})
})
}

if (platform === "Darwin") {
if (notificationSystem === "node-notifier") {
return new Promise((resolve) => {
Expand Down