From 8806d34ed48277df7e9d226da2fba7d6a645d76a Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Wed, 16 Sep 2026 11:39:09 -0400 Subject: [PATCH] feat(tui): make notification and sound alerts independent toggles Remove the attention.enabled master switch. Notifications and sounds are now enabled independently and both default to off. Existing enabled keys are ignored; there is no migration. --- packages/tui/src/attention.ts | 2 +- packages/tui/src/component/dialog-config.tsx | 15 +++------------ packages/tui/src/config/index.tsx | 7 ++----- services/www/src/docs/content/cli/config.mdx | 6 ++---- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/packages/tui/src/attention.ts b/packages/tui/src/attention.ts index 2547eb8daae..544668de646 100644 --- a/packages/tui/src/attention.ts +++ b/packages/tui/src/attention.ts @@ -128,7 +128,7 @@ export function createTuiAttention(input: { return { async notify(request) { try { - if (!input.config.attention.enabled) return skipped("attention_disabled") + if (!input.config.attention.notifications && !input.config.attention.sound) return skipped("attention_disabled") if (disposed || input.renderer.isDestroyed) return skipped("renderer_destroyed") const message = normalizeText(request.message, "", MESSAGE_LIMIT) diff --git a/packages/tui/src/component/dialog-config.tsx b/packages/tui/src/component/dialog-config.tsx index 56473ba0cdc..209c5c2d6c2 100644 --- a/packages/tui/src/component/dialog-config.tsx +++ b/packages/tui/src/component/dialog-config.tsx @@ -253,20 +253,11 @@ export const settings: Setting[] = [ format: (value) => `${value} ms`, keywords: ["leader key", "shortcut timeout"], }, - { - title: "Attention", - category: "Alerts", - path: ["attention", "enabled"], - default: false, - values: [false, true], - labels: ["off", "on"], - keywords: ["alerts"], - }, { title: "Notifications", category: "Alerts", path: ["attention", "notifications"], - default: true, + default: false, values: [false, true], labels: ["off", "on"], keywords: ["system notifications", "desktop notifications", "alerts"], @@ -275,10 +266,10 @@ export const settings: Setting[] = [ title: "Sounds", category: "Alerts", path: ["attention", "sound"], - default: true, + default: false, values: [false, true], labels: ["off", "on"], - keywords: ["audio", "sound effects"], + keywords: ["audio", "sound effects", "alerts"], }, { title: "Volume", diff --git a/packages/tui/src/config/index.tsx b/packages/tui/src/config/index.tsx index c0a90585acf..f941aba42f1 100644 --- a/packages/tui/src/config/index.tsx +++ b/packages/tui/src/config/index.tsx @@ -95,7 +95,6 @@ export const Info = Schema.Struct({ ).annotate({ description: "Scrolling behavior" }), attention: Schema.optional( Schema.Struct({ - enabled: Schema.optional(Schema.Boolean).annotate({ description: "Enable attention alerts" }), notifications: Schema.optional(Schema.Boolean).annotate({ description: "Show system notifications" }), sound: Schema.optional(Schema.Boolean).annotate({ description: "Play attention sounds" }), volume: Schema.optional( @@ -242,7 +241,6 @@ export type Info = Schema.Schema.Type export type Resolved = Omit & { attention: { - enabled: boolean notifications: boolean sound: boolean volume: number @@ -285,9 +283,8 @@ export function resolve(input: Info, options: { terminalSuspend: boolean }): Res return { ...input, attention: { - enabled: input.attention?.enabled ?? false, - notifications: input.attention?.notifications ?? true, - sound: input.attention?.sound ?? true, + notifications: input.attention?.notifications ?? false, + sound: input.attention?.sound ?? false, volume: input.attention?.volume ?? 0.4, sound_pack: input.attention?.sound_pack ?? "opencode.default", sounds: input.attention?.sounds ?? {}, diff --git a/services/www/src/docs/content/cli/config.mdx b/services/www/src/docs/content/cli/config.mdx index b497e0024bb..dd9f0f61ad0 100644 --- a/services/www/src/docs/content/cli/config.mdx +++ b/services/www/src/docs/content/cli/config.mdx @@ -108,12 +108,11 @@ Set scroll speed and acceleration: ## Attention -Configure notifications and sounds: +Configure notifications and sounds. Both are off by default and can be enabled independently: ```json title="cli.json" { "attention": { - "enabled": true, "notifications": true, "sound": true, "volume": 0.4, @@ -127,8 +126,7 @@ Configure notifications and sounds: | Field | Values | Description | | --------------- | ---------------------- | ---------------------------------------------------------------------------------------------------- | -| `enabled` | boolean | Enables attention alerts. | -| `notifications` | boolean | Shows system notifications. | +| `notifications` | boolean | Shows system notifications when the terminal is not focused. | | `sound` | boolean | Plays attention sounds. | | `volume` | number from `0` to `1` | Sets sound volume. | | `sound_pack` | string | Selects the active sound pack. |