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.

30 lines
1.0KB

  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 -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@*
  8. sudo /usr/bin/systemctl start openvpn-client@john.me.tz
  9. elif [ $res = "MailCleaner" ]; then
  10. sudo /usr/bin/systemctl stop openvpn-client@*
  11. sudo /usr/bin/systemctl start openvpn-client@mailcleaner
  12. elif [ $res = "Disconnect" ]; then
  13. sudo /usr/bin/systemctl stop openvpn-client@*
  14. elif [ $res = "Restart" ]; then
  15. sudo /usr/bin/systemctl restart openvpn-client@*
  16. fi
  17. exit
  18. # Waybar sometimes doesn't update with the VPN IP, for whatever reason. Restart it.
  19. # exits above because I change outputs more often than I change VPNs
  20. if [ "$(pgrep -c waybar)" -gt 0 ]; then
  21. sleep 2s
  22. pkill waybar
  23. waybar
  24. fi