diff --git a/wayland/.config/waybar/colorscheme.css b/wayland/.config/waybar/colorscheme.css new file mode 100644 index 0000000..e69de29 diff --git a/wayland/.config/waybar/modules/wireguard b/wayland/.config/waybar/modules/wireguard index fe8d717..82256b8 100755 --- a/wayland/.config/waybar/modules/wireguard +++ b/wayland/.config/waybar/modules/wireguard @@ -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"