A variety of simple automation scripts and enhancements to Sway and i3.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

33 lines
1.1KB

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