Swayscript : Refactor vpn a bit.

This commit is contained in:
Dmitry Voronin 2024-09-08 03:54:01 +03:00
parent 063641f5f0
commit 937f128019
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -1,23 +1,11 @@
{ ... }: {
text = ''
# Enable VPN.
function vpnon() {
nmcli connection up vpn
_vpnstate on
}
# Disable vpn.
function vpnoff() {
nmcli connection down vpn
_vpnstate off
}
# Toggle vpn.
function vpntoggle() {
if [[ "$(_vpnstate)" = "on" ]]; then
vpnoff
nmcli connection down vpn
else
vpnon
nmcli connection up vpn
fi
}