on main help sign in
fix(ui): honor explicit notification style without focus event support

shouldSendNotification required ReportFocusEvents to be true, which blocked all notifications on terminals without focus reporting — even when the user explicitly chose 'osc' or 'bell'. SSH users and others on terminals without focus events never got notifications despite configuring them. Now explicit styles are honored regardless of focus event support; the focus event requirement only applies to auto-detection mode.

commit0bfed6327bee77fe0666d51f95116118023e2c9c authoriko <mail@iko.soy> dateThu 9 Jul 2026, 03:29 (3 months ago) parent83a2ded
1 file changed+22−4
internal/ui/model/ui.go+22−4
internal/ui/model/ui.go+22−4
@@ -608,14 +608,32 @@ func (m *UI) updateNotificationBackend() {
608608}
609609
610610// shouldSendNotification returns true if notifications should be sent based on
611−// current state. Focus reporting must be supported, window must not be
612−// focused, and notifications must not be disabled in config.
611+// current state. The window must not be focused and notifications must not be
612+// disabled in config. Focus reporting is only required in auto-detection mode:
613+// when the user explicitly chooses a notification style, we honor it even on
614+// terminals that don't support focus events (e.g. SSH sessions).
613615func (m *UI) shouldSendNotification() bool {
614616 cfg := m.com.Config()
615− if cfg != nil && cfg.Options != nil && cfg.Options.NotificationStyle == "disabled" {
617+ var style string
618+ if cfg != nil && cfg.Options != nil {
619+ style = cfg.Options.NotificationStyle
620+ }
621+ if style == "disabled" {
622+ return false
623+ }
624+ // Never notify while the window is focused. On terminals without focus
625+ // reporting, notifyWindowFocused stays false, so this doesn't suppress.
626+ if m.notifyWindowFocused {
616627 return false
617628 }
618− return m.caps.ReportFocusEvents && !m.notifyWindowFocused
629+ // An explicit style (anything other than auto/empty) is honored regardless
630+ // of focus event support.
631+ if style != "" && style != "auto" {
632+ return true
633+ }
634+ // Auto-detection mode: without focus events we can't suppress notifications
635+ // while focused, so we disable them entirely to avoid spamming the user.
636+ return m.caps.ReportFocusEvents
619637}
620638
621639// setState changes the UI state and focus.