|
|
- #!/bin/zsh
- getargs() {
- while getopts "set" opt
- do
- case $opt in
- s) start="true";;
- e) end="true";;
- t) toggle="true";;
- esac
- done
- }
-
- start_dnd() {
- xset s off -dpms
- dunstify -r 51 -a " System" "Screensaver off"
- }
- end_dnd() {
- xset s off +dpms
- dunstify -r 51 -a " System" "Screensaver on"
- }
-
- toggle_dnd() {
- if [ $(xset q | grep "DPMS is" | xargs | cut -c9-) = "Enabled" ]; then
- start_dnd
- else
- end_dnd
- fi
- }
-
- main() {
- getargs "$@";
- [[ "$start" ]] && start_dnd;
- [[ "$end" ]] && end_dnd;
- [[ "$toggle" ]] && toggle_dnd;
- kill -53 $(pidof dwmblocks)
- }
-
- main "$@"
|