nix/package/swayscript/script/Vpn.nix

19 lines
357 B
Nix
Raw Normal View History

{ ... }:
{
text = ''
# Toggle vpn.
function vpn() {
if [[ "$(_vpn)" = "on" ]]; then
nmcli connection down vpn
else
nmcli connection up vpn
fi
}
2024-07-27 03:35:59 +03:00
function _vpn() {
local state=$(nmcli connection show vpn | rg -i state.*activated)
[ "''${state}" != "" ] && printf on || printf off
}
'';
2024-07-27 03:35:59 +03:00
}