aboutsummaryrefslogtreecommitdiffstats
path: root/shared/NotifyConfig.js
diff options
context:
space:
mode:
Diffstat (limited to 'shared/NotifyConfig.js')
-rw-r--r--shared/NotifyConfig.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/shared/NotifyConfig.js b/shared/NotifyConfig.js
index 143168f..6fc98e6 100644
--- a/shared/NotifyConfig.js
+++ b/shared/NotifyConfig.js
@@ -71,6 +71,16 @@ function withheld(cfg, n, dnd) {
return dnd && !(n.urgency === "critical" && cfg.dndPassCritical);
}
+// Whether a queued notification's balloon is on screen at `now`: the drawer
+// and snooze withhold everything, then mute and DND, then its own expiry.
+// The balloon shell and the desktop companion both ask this, so they cannot
+// disagree about what is showing.
+function shown(cfg, n, dnd, drawerOpen, snoozeUntil, now) {
+ if (drawerOpen || snoozeUntil > now) return false;
+ if (withheld(cfg, n, dnd)) return false;
+ return n.expires === 0 || now < n.expires;
+}
+
// The file a balloon plays, "" for none: the app's suppress-sound wins, then
// the app's own sound (notifyd resolved its hints), then the urgency's.
function soundFor(cfg, n) {