waybar: Add pia vpn to wireguard script
Added checking for pia connections to script in addition to existing wireguard implementation.
This commit is contained in:
parent
bfc19636ad
commit
55604d5538
2 changed files with 16 additions and 8 deletions
0
wayland/.config/waybar/colorscheme.css
Normal file
0
wayland/.config/waybar/colorscheme.css
Normal file
|
@ -72,6 +72,17 @@ function get_conns {
|
|||
done < <($1)
|
||||
}
|
||||
|
||||
function get_pia {
|
||||
if ! command -v piactl >/dev/null 2>&1; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
status=$(piactl get connectionstate)
|
||||
if [[ $status = "Connected" ]]; then
|
||||
connected+=("$(piactl get region): $(piactl get vpnip)")
|
||||
fi
|
||||
}
|
||||
|
||||
function print_conns {
|
||||
local first="yes"
|
||||
local array_print="$1[@]"
|
||||
|
@ -110,23 +121,20 @@ function array_contains {
|
|||
echo "no"
|
||||
}
|
||||
|
||||
if [[ $nargs == 0 ]]; then
|
||||
if [[ $nargs == 0 ]] || [[ $printjson = "yes" ]]; then
|
||||
get_conns "$wgactive"
|
||||
get_pia
|
||||
print_conns connected
|
||||
|
||||
elif [[ $showmenu == "yes" ]]; then
|
||||
get_conns "$wgconns"
|
||||
get_pia
|
||||
print_conns connected "list"
|
||||
print_conns available "list"
|
||||
|
||||
elif [[ $printjson == "yes" ]]; then
|
||||
get_conns "$wgactive"
|
||||
print_conns connected
|
||||
|
||||
elif
|
||||
[[ $dotoggle == "yes" ]]
|
||||
then
|
||||
elif [[ $dotoggle == "yes" ]]; then
|
||||
get_conns "$wgconns"
|
||||
get_pia
|
||||
|
||||
if [[ "$(array_contains connected "$conn")" == "yes" ]]; then
|
||||
$nmclicmd down "$conn"
|
||||
|
|
Loading…
Reference in a new issue