Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notification hint to bypass dnd/inhibition #334

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

notpeelz
Copy link
Contributor

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 😃

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

@ErikReider
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Owner

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
Copy link
Contributor Author

notpeelz commented Nov 22, 2023

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.

Copy link
Owner

@ErikReider ErikReider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate the dialog and I agree with you, thanks :)

@ErikReider
Copy link
Owner

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

@notpeelz
Copy link
Contributor Author

Should be good now :D

@ErikReider ErikReider merged commit 5a23d5e into ErikReider:main Nov 28, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants