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.

39 lines
631 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
  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. echo "off" > ~/.cache/screensaver
  15. notify-send "Screensaver off";
  16. }
  17. end_dnd() {
  18. xset s off +dpms
  19. echo "on" > ~/.cache/screensaver
  20. notify-send "Screensaver on.";
  21. }
  22. toggle_dnd() {
  23. if [ $(cat ~/.cache/screensaver) = "on" ]; then
  24. start_dnd
  25. else
  26. end_dnd
  27. fi
  28. }
  29. main() {
  30. getargs "$@";
  31. [[ "$start" ]] && start_dnd;
  32. [[ "$end" ]] && end_dnd;
  33. [[ "$toggle" ]] && toggle_dnd;
  34. kill -53 $(pidof dwmblocks)
  35. }
  36. main "$@"