aboutsummaryrefslogtreecommitdiffstats
path: root/internal/notify/service.go
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-19 09:15:53 +0200
committerDanilo M. <danix@danix.xyz>2026-10-19 09:15:53 +0200
commit1e70e552db6790f2fd07fdd1721bf6cf76e0c6b3 (patch)
tree29175225bf2297b07ef9652790978dcb337604b3 /internal/notify/service.go
parent75acc11af55b4efe0ea095a52a3916b13639c2cd (diff)
downloadnotifyd-1e70e552db6790f2fd07fdd1721bf6cf76e0c6b3.tar.gz
notifyd-1e70e552db6790f2fd07fdd1721bf6cf76e0c6b3.zip
feat(notify): take the per-urgency default timeout from config
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/notify/service.go')
-rw-r--r--internal/notify/service.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/notify/service.go b/internal/notify/service.go
index a2bf103..b29a783 100644
--- a/internal/notify/service.go
+++ b/internal/notify/service.go
@@ -39,10 +39,11 @@ type Service struct {
mu sync.Mutex
timers map[uint32]*time.Timer
+ cfg Config
}
func NewService(conn *dbus.Conn, dir string) *Service {
- s := &Service{conn: conn, dir: dir, timers: map[uint32]*time.Timer{}}
+ s := &Service{conn: conn, dir: dir, timers: map[uint32]*time.Timer{}, cfg: DefaultConfig()}
s.store = NewStore(s.emitClosed, func(live, history []Popup) {
if err := Publish(s.dir, live, history); err != nil {
log.Printf("notifyd: publish: %v", err)
@@ -102,7 +103,10 @@ func (s *Service) Notify(appName string, replacesID uint32, appIcon, summary, bo
u := UrgencyFromHints(hints)
tag := StackTagFromHints(hints)
now := time.Now().UnixMilli()
- ms := EffectiveTimeoutMS(expireTimeout, u)
+ s.mu.Lock()
+ timeouts := s.cfg.Timeouts
+ s.mu.Unlock()
+ ms := EffectiveTimeoutMS(expireTimeout, u, timeouts)
// Spec priority is image-data > image-path > the deprecated icon_data. A
// raw blob cannot be written until Add has assigned the id the filename is
// derived from, so any raw tier is held in pendingImage.