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.

37 lines
1.3KB

  1. #!/bin/bash
  2. BLFILE="/tmp/blc"
  3. if [ -z $1 ]; then
  4. echo "Missing argument: swayidlerun, swayidlewarn, swayidlesleep or" \
  5. " swayidlewake"
  6. elif [ $1 == "swayidlerun" ]; then
  7. swayidle timeout 270 "/home/jpm/scripts/swayidle.sh swayidlewarn" \
  8. before-sleep "/home/jpm/scripts/swayidle.sh swayidlesleep" \
  9. resume "/home/jpm/scripts/swayidle.sh swayidlewake"
  10. elif [ $1 == "swayidlewarn" ]; then
  11. # Store current brightness
  12. echo $(/home/jpm/bin/blc.pl %) > $BLFILE
  13. # Dim display
  14. /home/jpm/bin/blc.pl = 1
  15. # Warning notifications
  16. /home/jpm/scripts/swayidlecountdown.sh
  17. elif [ $1 == "swayidlesleep" ]; then
  18. # Change nick to AFK
  19. ssh jpm@john.me.tz -i /home/jpm/.ssh/no_pass -t \
  20. 'screen -S irssi -X stuff "/nick jpmAFK^M"'
  21. # Turn off monitor
  22. swaymsg 'swaymsg "output * dpms off"'
  23. # Lock screen
  24. swaylock -c 323232
  25. elif [ $1 == "swayidlewake" ]; then
  26. # Kill sleep if running
  27. # Turn on monitor
  28. swaymsg 'swaymsg "output * dpms on"'
  29. # Restore brightness level
  30. kill `pgrep swayidlecountdo`
  31. /home/jpm/bin/blc.pl = $(cat /tmp/blc)
  32. else
  33. echo "Invalid argument: run, sleep or wake"
  34. fi