Swayscript : Refactor vpn a bit.
This commit is contained in:
parent
063641f5f0
commit
937f128019
|
@ -1,23 +1,11 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
text = ''
|
text = ''
|
||||||
# Enable VPN.
|
|
||||||
function vpnon() {
|
|
||||||
nmcli connection up vpn
|
|
||||||
_vpnstate on
|
|
||||||
}
|
|
||||||
|
|
||||||
# Disable vpn.
|
|
||||||
function vpnoff() {
|
|
||||||
nmcli connection down vpn
|
|
||||||
_vpnstate off
|
|
||||||
}
|
|
||||||
|
|
||||||
# Toggle vpn.
|
# Toggle vpn.
|
||||||
function vpntoggle() {
|
function vpntoggle() {
|
||||||
if [[ "$(_vpnstate)" = "on" ]]; then
|
if [[ "$(_vpnstate)" = "on" ]]; then
|
||||||
vpnoff
|
nmcli connection down vpn
|
||||||
else
|
else
|
||||||
vpnon
|
nmcli connection up vpn
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue