#!/bin/zsh
getargs() {
  while getopts "se" opt
  do
    case $opt in
      s) start="true";;
      e) end="true";;
    esac
  done
}
start_dnd() {
  xset s off -dpms
  echo "off" > ~/.cache/screensaver
  notify-send "Screensaver off";
}
end_dnd() {
  xset s off +dpms
  echo "on" > ~/.cache/screensaver
  notify-send "Screensaver on.";
}
main() {
  getargs "$@";
  [[ "$start" ]] && start_dnd;
  [[ "$end" ]] && end_dnd;
  kill -53 $(pidof dwmblocks)
}
main "$@"
