dwmblock-startbutton (1008B)
1 #!/bin/sh 2 # dwmblocks script for do not disturb 3 4 case "$BUTTON" in 5 3) 6 case "$(printf 'Toggle DND\nToggle Sleep\nShutdown\nReboot' | dmenu -l 3 -i)" in 7 'Toggle DND') 8 dunstctl set-paused toggle 9 pkill -RTMIN+13 dwmblocks; 10 ;; 11 'Toggle Sleep') 12 if pgrep unsleep >/dev/null 2>&1; then 13 killall unsleep 14 notify 'Enabling sleep' '' 15 else 16 setsid -f unsleep >/dev/null 2>&1 17 notify 'Disabling sleep' '' 18 fi 19 pkill -RTMIN+13 dwmblocks 20 ;; 21 'Shutdown') 22 if [ "$(printf 'Yes\nNo' | dmenu -i)" = "Yes" ]; then 23 systemctl poweroff 24 fi 25 ;; 26 'Reboot') 27 if [ "$(printf 'Yes\nNo' | dmenu -i)" = "Yes" ]; then 28 systemctl reboot 29 fi 30 ;; 31 esac 32 ;; 33 6) "$TERMINAL" -e "$EDITOR" "$0" 34 ;; 35 esac 36 37 s='ī ' 38 case "$(dunstctl is-paused)" in 39 true) 40 s="$sđ ";; 41 esac 42 43 if pgrep unsleep >/dev/null 2>&1; then 44 s="$sī´ " 45 fi 46 printf '%s' "$s"