A luxe hook runs luxe-notify, which sends one JSON line over a Unix socket to a SwiftUI menu bar app. The app shows a banner, keeps a badge count and history, and brings the terminal forward when you click a banner. Notifies on approvals (PermissionRequested), question prompts (BeforeToolUse, matched to the question tool), errors, and turns that run at least --min-seconds (default 30, timed from BeforeAgentStart to AgentEnd). The menu warns when macOS has notifications blocked for the app. The app writes status.txt beside its socket for debugging. Known limits are in README.md and PLAN.md: a crowded menu bar can hide the icon, and the first test build after a change can fail with a TestingMacros error under Command Line Tools, which make test retries once.
22 lines
952 B
Swift
22 lines
952 B
Swift
import Foundation
|
|
|
|
/// Which app to bring forward when the user clicks an event.
|
|
public enum TerminalLocator {
|
|
/// Prefer the macOS bundle id the terminal exports. `TERM_PROGRAM` is a fallback because it names
|
|
/// the program, not its bundle, so only well-known values are mapped; an unknown one returns nil
|
|
/// rather than guessing at an app to activate.
|
|
public static func bundleID(from environment: [String: String]) -> String? {
|
|
if let id = environment["__CFBundleIdentifier"], !id.isEmpty { return id }
|
|
guard let program = environment["TERM_PROGRAM"] else { return nil }
|
|
return knownTerminals[program.lowercased()]
|
|
}
|
|
|
|
static let knownTerminals: [String: String] = [
|
|
"ghostty": "com.mitchellh.ghostty",
|
|
"apple_terminal": "com.apple.Terminal",
|
|
"iterm.app": "com.googlecode.iterm2",
|
|
"wezterm": "com.github.wez.wezterm",
|
|
"vscode": "com.microsoft.VSCode",
|
|
]
|
|
}
|