shortcut for toggling vpn
This commit is contained in:
parent
39930f86ce
commit
d38b1d46f7
2 changed files with 25 additions and 1 deletions
|
@ -27,7 +27,7 @@ bindsym ctrl+Print exec $HOME/.local/scripts/screenshot.sh fullscreen
|
|||
bindsym shift+Print exec $HOME/.local/scripts/screenshot.sh window
|
||||
bindsym $mod+p exec $HOME/.local/scripts/passmenu.sh
|
||||
bindsym $mod+semicolon exec alacritty -e nvim $HOME/todos.md
|
||||
bindsym $mod+m exec alacritty -e aerc
|
||||
bindsym $mod+m exec $HOME/.local/scripts/toggle-vpn.sh sift-vpn-mzhang
|
||||
|
||||
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
|
||||
# they are included here as an example. Modify as you see fit.
|
||||
|
|
24
dot_local/scripts/executable_toggle-vpn.sh
Normal file
24
dot_local/scripts/executable_toggle-vpn.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# https://robertbasic.com/blog/toggle-a-vpn-connection/
|
||||
|
||||
VPN=$1
|
||||
|
||||
if [ -z "$VPN" ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ACTIVE=`nmcli con show --active | grep "$VPN"`
|
||||
|
||||
if [ -z "$ACTIVE" ]
|
||||
then
|
||||
nmcli con up id "$VPN"
|
||||
notify-send "connected to $VPN"
|
||||
else
|
||||
nmcli con down id "$VPN"
|
||||
notify-send "disconnected from $VPN"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
Loading…
Reference in a new issue