2

Is there any way to set a keyboard shortcut to toggle do not disturb mode on/off?

2 Answers 2

4

Yes, you can. Disturb mode can be set via the dconf boolean value org.pantheon.desktop.gala.notifications.do-not-disturb.

You can toggle it with a script like this (saved as ~/bin/toggle_do-not-disturb)

#!/bin/sh

KEY='/org/pantheon/desktop/gala/notifications/do-not-disturb'
dconf write $KEY $(if [ $(dconf read $KEY) = 'true' ]; then echo false; else echo true; fi)

Then you can assign this script to a custom hot key in Settings/Keyboard Layout tab:

enter image description here

2
  • This is very useful!
    – png2378
    Dec 15, 2016 at 14:46
  • Thanks. :) This is also useful if you want to override the "Do not disturb" mode temporarily for a notification You can set the KEY false, send a notification and set it to true again.
    – Gaurav
    Apr 19, 2018 at 22:14
0

Starting in Elementary Odin, notifications are now in io.elementary.notifications. So, now the path changes to /io/elementary/notifications/do-not-disturb.

The new version for the script would be:

#!/bin/sh

KEY='/io/elementary/notifications/do-not-disturb'
dconf write $KEY $(if [ $(dconf read $KEY) = 'true' ]; then echo false; else echo true; fi)

Source: r/elementaryos on Reddit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.