chore: Update scripts

This commit is contained in:
Tibo De Peuter 2025-09-16 21:05:04 +02:00
parent caa24fb255
commit f446486678
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
4 changed files with 91 additions and 25 deletions

48
scripts/toggle-notifications.sh Executable file
View file

@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Script to toggle Do not disturb mode for dunst
# Get current state
if [ "$( command -v dunstctl )" ]; then
current_state="$( dunstctl is-paused )"
fi
while getopts ":g" option; do
case "${option}" in
g)
if [ "${current_state}" == "false" ]; then
state='normal'
tooltip='Hide notifications'
class='none'
else
state='paused'
tooltip='Show notifications'
class='activated'
fi
printf '{"alt": "%s", "tooltip": "%s", "class": "%s" }' \
"${state}" "${tooltip}" "${class}"
exit 0
;;
esac
done
# Toggle
if [ "${current_state}" == "false" ] ; then
notify-send 'Hiding notifications'
sleep 5
if [ "$(command -v makoctl)" ]; then
makoctl set-mode do-not-disturb
fi
if [ "$(command -v dunstctl)" ]; then
dunstctl set-paused true
fi
else
if [ "$(command -v makoctl)" ]; then
makoctl set-mode default
fi
if [ "$(command -v dunstctl)" ]; then
dunstctl set-paused false
fi
notify-send 'Showing notifications'
fi