Skip to content

Commit 8806d34

Browse files
committed
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.
1 parent cda2bc5 commit 8806d34

4 files changed

Lines changed: 8 additions & 22 deletions

File tree

‎packages/tui/src/attention.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function createTuiAttention(input: {
128128
return {
129129
async notify(request) {
130130
try {
131-
if (!input.config.attention.enabled) return skipped("attention_disabled")
131+
if (!input.config.attention.notifications && !input.config.attention.sound) return skipped("attention_disabled")
132132
if (disposed || input.renderer.isDestroyed) return skipped("renderer_destroyed")
133133

134134
const message = normalizeText(request.message, "", MESSAGE_LIMIT)

‎packages/tui/src/component/dialog-config.tsx‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,11 @@ export const settings: Setting[] = [
253253
format: (value) => `${value} ms`,
254254
keywords: ["leader key", "shortcut timeout"],
255255
},
256-
{
257-
title: "Attention",
258-
category: "Alerts",
259-
path: ["attention", "enabled"],
260-
default: false,
261-
values: [false, true],
262-
labels: ["off", "on"],
263-
keywords: ["alerts"],
264-
},
265256
{
266257
title: "Notifications",
267258
category: "Alerts",
268259
path: ["attention", "notifications"],
269-
default: true,
260+
default: false,
270261
values: [false, true],
271262
labels: ["off", "on"],
272263
keywords: ["system notifications", "desktop notifications", "alerts"],
@@ -275,10 +266,10 @@ export const settings: Setting[] = [
275266
title: "Sounds",
276267
category: "Alerts",
277268
path: ["attention", "sound"],
278-
default: true,
269+
default: false,
279270
values: [false, true],
280271
labels: ["off", "on"],
281-
keywords: ["audio", "sound effects"],
272+
keywords: ["audio", "sound effects", "alerts"],
282273
},
283274
{
284275
title: "Volume",

‎packages/tui/src/config/index.tsx‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export const Info = Schema.Struct({
9595
).annotate({ description: "Scrolling behavior" }),
9696
attention: Schema.optional(
9797
Schema.Struct({
98-
enabled: Schema.optional(Schema.Boolean).annotate({ description: "Enable attention alerts" }),
9998
notifications: Schema.optional(Schema.Boolean).annotate({ description: "Show system notifications" }),
10099
sound: Schema.optional(Schema.Boolean).annotate({ description: "Play attention sounds" }),
101100
volume: Schema.optional(
@@ -242,7 +241,6 @@ export type Info = Schema.Schema.Type<typeof Info>
242241

243242
export type Resolved = Omit<Info, "attention" | "cursor" | "keybinds" | "leader" | "mouse" | "session" | "tabs"> & {
244243
attention: {
245-
enabled: boolean
246244
notifications: boolean
247245
sound: boolean
248246
volume: number
@@ -285,9 +283,8 @@ export function resolve(input: Info, options: { terminalSuspend: boolean }): Res
285283
return {
286284
...input,
287285
attention: {
288-
enabled: input.attention?.enabled ?? false,
289-
notifications: input.attention?.notifications ?? true,
290-
sound: input.attention?.sound ?? true,
286+
notifications: input.attention?.notifications ?? false,
287+
sound: input.attention?.sound ?? false,
291288
volume: input.attention?.volume ?? 0.4,
292289
sound_pack: input.attention?.sound_pack ?? "opencode.default",
293290
sounds: input.attention?.sounds ?? {},

‎services/www/src/docs/content/cli/config.mdx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,11 @@ Set scroll speed and acceleration:
108108

109109
## Attention
110110

111-
Configure notifications and sounds:
111+
Configure notifications and sounds. Both are off by default and can be enabled independently:
112112

113113
```json title="cli.json"
114114
{
115115
"attention": {
116-
"enabled": true,
117116
"notifications": true,
118117
"sound": true,
119118
"volume": 0.4,
@@ -127,8 +126,7 @@ Configure notifications and sounds:
127126

128127
| Field | Values | Description |
129128
| --------------- | ---------------------- | ---------------------------------------------------------------------------------------------------- |
130-
| `enabled` | boolean | Enables attention alerts. |
131-
| `notifications` | boolean | Shows system notifications. |
129+
| `notifications` | boolean | Shows system notifications when the terminal is not focused. |
132130
| `sound` | boolean | Plays attention sounds. |
133131
| `volume` | number from `0` to `1` | Sets sound volume. |
134132
| `sound_pack` | string | Selects the active sound pack. |

0 commit comments

Comments
 (0)