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
621 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
  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. xset s off -dpms
  14. dunstify -r 51 -a " System" "Screensaver off"
  15. }
  16. end_dnd() {
  17. xset s off +dpms
  18. dunstify -r 51 -a " System" "Screensaver on"
  19. }
  20. toggle_dnd() {
  21. if [ $(xset q | grep "DPMS is" | xargs | cut -c9-) = "Enabled" ]; then
  22. start_dnd
  23. else
  24. end_dnd
  25. fi
  26. }
  27. main() {
  28. getargs "$@";
  29. [[ "$start" ]] && start_dnd;
  30. [[ "$end" ]] && end_dnd;
  31. [[ "$toggle" ]] && toggle_dnd;
  32. kill -53 $(pidof dwmblocks)
  33. }
  34. main "$@"