A variety of simple automation scripts and enhancements to Sway and i3.
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.

44 lines
1.6KB

  1. #!/bin/bash
  2. BLFILE="/home/jpm/.config/blc.last"
  3. OPFILE="/home/jpm/.config/active_outputs"
  4. if [ -z $1 ]; then
  5. echo "Missing argument: run, warn, sleep or" \
  6. " wake"
  7. elif [ $1 == "start" ]; then
  8. swayidle -w timeout 270 "/home/jpm/scripts/sway/idle.sh warn" \
  9. resume "/home/jpm/scripts/sway/idle.sh resume" \
  10. timeout 300 "/home/jpm/scripts/sway/idle.sh sleep" \
  11. resume "/home/jpm/scripts/sway/idle.sh wake" \
  12. before-sleep "/usr/bin/swaylock -c 323232"
  13. elif [ $1 == "warn" ]; then
  14. # Store current brightness
  15. echo $(/home/jpm/scripts/thinkpad/blc.pl %) > $BLFILE
  16. # Dim display
  17. /home/jpm/scripts/thinkpad/blc.pl = 1
  18. # Warning notifications
  19. /home/jpm/scripts/sway/idlecountdown.sh
  20. elif [ $1 == "sleep" ]; then
  21. # Change nick to AFK
  22. ssh jpm@john.me.tz -i /home/jpm/.ssh/no_pass -t \
  23. 'screen -S irssi -X stuff "/nick jpmAFK^M"'
  24. # Turn off monitor
  25. for i in `cat $OPFILE`; do swaymsg "output $i dpms off"; done
  26. elif [ $1 == "wake" ]; then
  27. # Kill additional counters that might have been started
  28. /home/jpm/scripts/sway/idle.sh resume
  29. # Restore output(s)
  30. /home/jpm/scripts/sway/displays.pl
  31. #for i in `cat $OPFILE`; do swaymsg "output $i dpms on"; done
  32. # Lock screen
  33. swaylock -c 323232
  34. # Restore brightness level
  35. /home/jpm/scripts/thinkpad/blc.pl = $(cat $BLFILE)
  36. elif [ $1 == "resume" ]; then
  37. # Kill warning
  38. for i in `pgrep idlecountdown`; do kill $i; done
  39. else
  40. echo "Invalid argument: run, sleep or wake"
  41. fi