Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
654 B

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #!/bin/zsh
  2. getargs() {
  3. while getopts "set" opt
  4. do
  5. case $opt in
  6. s) start="true";;
  7. e) end="true";;
  8. t) toggle="true";;
  9. esac
  10. done
  11. }
  12. start_dnd() {
  13. echo "off" > ~/.cache/dunst
  14. dunstctl set-paused true
  15. }
  16. end_dnd() {
  17. echo "on" > ~/.cache/dunst
  18. dunstctl set-paused false
  19. notify-send "Do Not Disturb" "Do Not Disturb mode ended. Notifications will be shown.";
  20. }
  21. toggle_dnd() {
  22. if [ $(cat ~/.cache/dunst) = "on" ]; then
  23. start_dnd
  24. else
  25. end_dnd
  26. fi
  27. }
  28. main() {
  29. getargs "$@";
  30. [[ "$start" ]] && start_dnd;
  31. [[ "$end" ]] && end_dnd;
  32. [[ "$toggle" ]] && toggle_dnd;
  33. kill -52 $(pidof dwmblocks)
  34. }
  35. main "$@"