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.

32 lines
1.3KB

  1. #!/bin/bash
  2. # Passwordless sudo required
  3. res=$(echo "Connection|John.Me.tz|MailCleaner|Disconnect|Restart" | rofi -sep "|" -dmenu -i -p 'P ' "" -columns 9 -width 45 -l 1 -config /home/jpm/.config/rofi/config.rasi -hide-scrollbar -eh 1 -location 0 -auto-select -no-fullscreen)
  4. if [ $res = "Connection" ]; then
  5. /usr/bin/uxterm -e 'sudo /usr/bin/nmtui'
  6. elif [ $res = "John.Me.tz" ]; then
  7. sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
  8. sudo /usr/bin/systemctl restart wg-quick@wg0
  9. elif [ $res = "MailCleaner" ]; then
  10. sudo /usr/bin/systemctl stop wg-quick@wg0
  11. sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
  12. elif [ $res = "Disconnect" ]; then
  13. sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
  14. sudo /usr/bin/systemctl stop wg-quick@wg0
  15. elif [ $res = "Restart" ]; then
  16. if [ "`ip addr show wg0 2> /dev/null`" != "" ]; then
  17. sudo /usr/bin/systemctl restart wg-quick@wg0
  18. fi
  19. if [ "`ip addr show tun0 2> /dev/null`" != "" ]; then
  20. sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
  21. fi
  22. else
  23. exit
  24. fi
  25. # Waybar sometimes doesn't update with the VPN IP, for whatever reason. Restart it.
  26. # exits above because I change outputs more often than I change VPNs
  27. /home/jpm/scripts/sway/displays.pl -w