aboutsummaryrefslogtreecommitdiffstats
path: root/internal/notify/policy.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/notify/policy.go')
-rw-r--r--internal/notify/policy.go26
1 files changed, 14 insertions, 12 deletions
diff --git a/internal/notify/policy.go b/internal/notify/policy.go
index 5c70390..8161ea3 100644
--- a/internal/notify/policy.go
+++ b/internal/notify/policy.go
@@ -23,26 +23,28 @@ const (
)
// DefaultTimeoutMS is the balloon lifetime for an urgency when the client
-// leaves the choice to the server (expire_timeout -1). Critical never expires,
-// which is 0 here.
-func DefaultTimeoutMS(u Urgency) int64 {
+// leaves the choice to the server (expire_timeout -1), from the config's
+// seconds. 0 is never.
+func DefaultTimeoutMS(u Urgency, t Timeouts) int64 {
switch u {
- case Low, Normal:
- return 10_000
+ case Low:
+ return int64(t.Low) * 1000
+ case Critical:
+ return int64(t.Critical) * 1000
default:
- return 0
+ return int64(t.Normal) * 1000
}
}
// EffectiveTimeoutMS resolves the client's expire_timeout per the freedesktop
-// spec: -1 means the server decides (the urgency default), 0 means never, and
-// anything positive is milliseconds and wins. The spec is precise about the
-// direction and libnotify's default is -1, so getting it backwards would make
-// every plain notify-send immortal.
-func EffectiveTimeoutMS(expire int32, u Urgency) int64 {
+// spec: -1 means the server decides (the configured default), 0 means never,
+// and anything positive is milliseconds and wins. The spec is precise about
+// the direction and libnotify's default is -1, so getting it backwards would
+// make every plain notify-send immortal.
+func EffectiveTimeoutMS(expire int32, u Urgency, t Timeouts) int64 {
switch {
case expire == -1:
- return DefaultTimeoutMS(u)
+ return DefaultTimeoutMS(u, t)
case expire == 0:
return 0
default: