Skip to content

Commit 41c29f0

Browse files
committed
Add a toggle to mute sounds (audio cues)
1 parent 7ebe750 commit 41c29f0

File tree

3 files changed

+55
-5
lines changed

3 files changed

+55
-5
lines changed

cmd/goose/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ type App struct {
132132
hideStaleIncoming bool
133133
loadingTurnData bool
134134
enableReminders bool // Whether to send daily reminder notifications
135+
enableAudioCues bool // Whether to play audio cues for notifications
135136
}
136137

137138
func main() {
@@ -183,8 +184,12 @@ func main() {
183184
updateInterval: updateInterval,
184185
pendingTurnResults: make([]TurnResult, 0),
185186
enableReminders: true,
187+
enableAudioCues: true,
186188
}
187189

190+
// Load saved settings
191+
app.loadSettings()
192+
188193
log.Println("Initializing GitHub clients...")
189194
err = app.initClients(ctx)
190195
if err != nil {

cmd/goose/sound.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ func (app *App) initSoundCache() {
5252

5353
// playSound plays a cached sound file using platform-specific commands.
5454
func (app *App) playSound(ctx context.Context, soundType string) {
55+
// Check if audio cues are enabled
56+
app.mu.RLock()
57+
audioEnabled := app.enableAudioCues
58+
app.mu.RUnlock()
59+
60+
if !audioEnabled {
61+
log.Printf("[SOUND] Sound playback skipped (audio cues disabled): %s", soundType)
62+
return
63+
}
64+
5565
log.Printf("[SOUND] Playing %s sound", soundType)
5666
// Ensure sounds are cached
5767
app.initSoundCache()

cmd/goose/ui.go

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,18 +287,24 @@ func (app *App) addStaticMenuItems(ctx context.Context) {
287287
hideStaleItem.Check()
288288
}
289289
hideStaleItem.Click(func() {
290+
app.mu.Lock()
290291
app.hideStaleIncoming = !app.hideStaleIncoming
291-
if app.hideStaleIncoming {
292+
hideStale := app.hideStaleIncoming
293+
// Clear menu state to force rebuild
294+
app.lastMenuState = nil
295+
app.mu.Unlock()
296+
297+
if hideStale {
292298
hideStaleItem.Check()
293299
} else {
294300
hideStaleItem.Uncheck()
295301
}
302+
303+
// Save settings to disk
304+
app.saveSettings()
305+
296306
// Toggle hide stale PRs setting
297307
// Force menu rebuild since hideStaleIncoming changed
298-
app.mu.Lock()
299-
// Clear menu state to force rebuild
300-
app.lastMenuState = nil
301-
app.mu.Unlock()
302308
app.rebuildMenu(ctx)
303309
})
304310

@@ -323,11 +329,40 @@ func (app *App) addStaticMenuItems(ctx context.Context) {
323329
reminderItem.Uncheck()
324330
log.Println("[SETTINGS] Daily reminders disabled")
325331
}
332+
333+
// Save settings to disk
334+
app.saveSettings()
326335
})
327336

328337
// Add login item option (macOS only)
329338
addLoginItemUI(ctx, app)
330339

340+
// Audio cues
341+
// Add 'Audio cues' option
342+
audioItem := systray.AddMenuItem("Audio cues", "Play sounds for notifications")
343+
app.mu.RLock()
344+
if app.enableAudioCues {
345+
audioItem.Check()
346+
}
347+
app.mu.RUnlock()
348+
audioItem.Click(func() {
349+
app.mu.Lock()
350+
app.enableAudioCues = !app.enableAudioCues
351+
enabled := app.enableAudioCues
352+
app.mu.Unlock()
353+
354+
if enabled {
355+
audioItem.Check()
356+
log.Println("[SETTINGS] Audio cues enabled")
357+
} else {
358+
audioItem.Uncheck()
359+
log.Println("[SETTINGS] Audio cues disabled")
360+
}
361+
362+
// Save settings to disk
363+
app.saveSettings()
364+
})
365+
331366
// Quit
332367
// Add 'Quit' option
333368
quitItem := systray.AddMenuItem("Quit", "")

0 commit comments

Comments
 (0)