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