( opts: NotificationOptions, terminal: TerminalNotification, )
| 75 | } |
| 76 | |
| 77 | async function sendAuto( |
| 78 | opts: NotificationOptions, |
| 79 | terminal: TerminalNotification, |
| 80 | ): Promise<string> { |
| 81 | const title = opts.title || DEFAULT_TITLE |
| 82 | |
| 83 | switch (env.terminal) { |
| 84 | case 'Apple_Terminal': { |
| 85 | const bellDisabled = await isAppleTerminalBellDisabled() |
| 86 | if (bellDisabled) { |
| 87 | terminal.notifyBell() |
| 88 | return 'terminal_bell' |
| 89 | } |
| 90 | return 'no_method_available' |
| 91 | } |
| 92 | case 'iTerm.app': |
| 93 | terminal.notifyITerm2(opts) |
| 94 | return 'iterm2' |
| 95 | case 'kitty': |
| 96 | terminal.notifyKitty({ ...opts, title, id: generateKittyId() }) |
| 97 | return 'kitty' |
| 98 | case 'ghostty': |
| 99 | terminal.notifyGhostty({ ...opts, title }) |
| 100 | return 'ghostty' |
| 101 | default: |
| 102 | return 'no_method_available' |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | function generateKittyId(): number { |
| 107 | return Math.floor(Math.random() * 10000) |
no test coverage detected