Files
dotfiles/bin/dunstctl

26 lines
494 B
Plaintext
Raw Normal View History

2020-10-05 21:55:12 +02:00
#!/usr/bin/env bash
set -o nounset
2024-04-14 02:14:12 +02:00
_logfile="$XDG_RUNTIME_DIR/dunstctl.log"
2020-10-05 21:55:12 +02:00
log() {
printf '[%s] %s\n' "$(date -uIseconds)" "$*" >> "$_logfile"
}
case "$1 $2" in
"set-paused false")
2020-10-05 21:55:12 +02:00
log "Enabling dunst"
systemctl --user --no-block kill --signal SIGUSR2 dunst
2020-10-05 21:55:12 +02:00
;;
"set-paused true")
2020-10-05 21:55:12 +02:00
log "Disabling dunst"
systemctl --user --no-block kill --signal SIGUSR1 dunst
2020-10-05 21:55:12 +02:00
;;
*)
>&2 printf 'Unknown command\n'
exit 1
esac