chore: Update scripts
This commit is contained in:
parent
caa24fb255
commit
f446486678
4 changed files with 91 additions and 25 deletions
48
scripts/toggle-notifications.sh
Executable file
48
scripts/toggle-notifications.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue