Skip to content

Instantly share code, notes, and snippets.

@JCGoran
Last active February 1, 2020 15:55
Show Gist options
  • Save JCGoran/926bdb17e140e65ee4156500f1459671 to your computer and use it in GitHub Desktop.
Save JCGoran/926bdb17e140e65ee4156500f1459671 to your computer and use it in GitHub Desktop.
Enabling/disabling notifications on XFCE 4.14 with an indicator notification
#!/usr/bin/env sh
# the main command to send
comm="xfconf-query -c xfce4-notifyd -p /do-not-disturb"
# query for status
status="$(${comm})"
# if 'Do not disturb' is off, we send a notification, and then turn it on
if [ "${status}" = "false" ]
then
notify-send 'NOTICE' 'Notifications have been disabled!'
eval "${comm} -T"
# otherwise we first turn it off, and then send the notification
elif [ "${status}" = "true" ]
then
eval "${comm} -T"
notify-send 'NOTICE' 'Notifications have been enabled!'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment