ErikReider / SwayNotificationCenter

A simple GTK based notification daemon for SwayWM
GNU General Public License v3.0
1.15k stars 59 forks source link

Add notification hint to bypass dnd/inhibition #334

Closed notpeelz closed 7 months ago

notpeelz commented 7 months ago

I use a couple scripts that trigger custom transient notifications using notify-send (e.g cycling through MPRIS players using playerctld). When I enable dnd, it unfortunately hides those notifications as well :( I tried using notify-send --urgency critical, but critical notifications never expire (it overrides --expire-time). I tried closing the notification via dbus after a sleep, but that gets very messy very quickly.

Instead, I opted to add a hint to bypass swaync's dnd/inhibit mechanisms. It can be used like this:

notify-send \
  --expire-time 1000 \
  --transient \
  --hint boolean:SWAYNC_BYPASS_DND:true \
  "hello"

Let me know what you think :smiley:

Oh also, should I add this to the manpage/readme? If so, where?

ErikReider commented 7 months ago

I tried using notify-send --urgency critical, but critical notifications never expire (it overrides --expire-time)

Have you tried changing the timeout-critical config option? The default is 0 which disables the timeout.

I like the massive simplification that you made so I'll at least merge that if not also the new param if the config change doesn't work out :)

notpeelz commented 7 months ago

Oh I didn't know about timeout-critical. I don't have anything that makes use of critical notifications in my setup at the moment, but I can see how it's useful for certain notifications you don't want to miss (e.g battery low warning).

Should I add documentation for this hint, or would you rather do it yourself?

ErikReider commented 7 months ago

Oh I didn't know about timeout-critical. I don't have anything that makes use of critical notifications in my setup at the moment, but I can see how it's useful for certain notifications you don't want to miss (e.g battery low warning).

Should I add documentation for this hint, or would you rather do it yourself?

What I meant was that SWAYNC_NO_SCRIPT shouldn't be necessary when notifications can provide the Critical hint

notpeelz commented 7 months ago

My previous message wasn't very clear. I meant to say that I see value in making the two mechanisms separate. For example, let's say I want critical notifications that linger on screen indefinitely AND have custom notifications bypass dnd while honoring the expire_timeout parameter. The use case is probably niche, but at least the custom hint (SWAYNC_BYPASS_DND) helps decouple the two mechanisms.

ErikReider commented 7 months ago

Oh wait, the linter is failing, could you fix that real?

notpeelz commented 7 months ago

Should be good now :D