diff --git a/bin/vpn_status.sh b/bin/vpn_status.sh new file mode 100755 index 0000000..671aecd --- /dev/null +++ b/bin/vpn_status.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# checks mullvad status for monitoring in polybar + +CONNECTED=$(printf '%s%s' '%{F#0F0}' $(echo -e '\Uf0318')) # green +DISCONNECTED=$(printf '%s%s' '%{F#F00}' $(echo -e '\Uf0319')) # red + +# check that its installed +if ! command -v mullvad &>/dev/null ; then + echo "Seafile not downloaded to device!">&2 + echo "$DISCONNECTED" + exit 1 +fi + +# getting vpn status +VPN_DISCONNECTED=$(mullvad status | grep Disconnected) + +if [[ -n "$VPN_DISCONNECTED" ]] ; then + # vpn is disconnected + echo "$DISCONNECTED" + exit 0 +fi + +# connected +echo "$CONNECTED" diff --git a/gui/polybar/config.ini b/gui/polybar/config.ini index d3db9c3..f56977b 100644 --- a/gui/polybar/config.ini +++ b/gui/polybar/config.ini @@ -6,7 +6,7 @@ foreground = #DDD primary = #F0C674 secondary = #8ABEB7 disabled = #707880 -alert = #A54242 +alert = #A54242S [section/base-bar] ; base bar settings @@ -38,7 +38,7 @@ font-0 = Hack Nerd Font:size=10;2 height = 14pt ; modules modules-left = xworkspaces weather-thinkpad -modules-right = battery pulseaudio memory cpu wlan uptime seafile calendar-sync bg-selector date-tp powermenu +modules-right = battery pulseaudio memory cpu wlan vpn uptime seafile calendar-sync bg-selector date-tp powermenu [bar/desktop-bar] ; desktop bar config @@ -49,7 +49,7 @@ height = 24pt modules-left = xworkspaces focus-fast spotify spotify-len ;modules-left = xworkspaces spotify spotify-len modules-center = weather-desktop -modules-right = pulseaudio memory cpu temperature eth dev-bat packages seafile calendar-sync bg-selector quotes date powermenu +modules-right = pulseaudio memory cpu temperature eth vpn dev-bat packages seafile calendar-sync bg-selector quotes date powermenu [bar/work-bar] ; desktop bar config @@ -303,5 +303,11 @@ type = custom/script interval = 600 exec = printf "%s %s\n" `echo -e '\ueb29'` `pacman -Qu | wc -l` +[module/vpn] +; custom vpn script +type = custom/script +exec = vpn_status.sh +interval = 30 + [settings] screenchange-reload = true diff --git a/meta/configs/scripts.yaml b/meta/configs/scripts.yaml index 9422c89..40ec5c0 100644 --- a/meta/configs/scripts.yaml +++ b/meta/configs/scripts.yaml @@ -14,6 +14,7 @@ ~/.local/bin/markdown-preview.sh: bin/markdown-preview.sh ~/.local/bin/docker_check: bin/docker_check ~/.local/bin/seafile_check: bin/seafile_check + ~/.local/bin/vpn_status.sh: bin/vpn_status.sh ~/.local/bin/watertracker: src/watertracker/watertracker ~/.local/bin/device_battery.sh: src/device-battery/device_battery.sh ~/.local/bin/weather: src/weather/weather diff --git a/passwords/gnupg/pubring.kbx b/passwords/gnupg/pubring.kbx index 8694847..84b72d8 100644 Binary files a/passwords/gnupg/pubring.kbx and b/passwords/gnupg/pubring.kbx differ diff --git a/passwords/gnupg/pubring.kbx~ b/passwords/gnupg/pubring.kbx~ index 8236d67..8694847 100644 Binary files a/passwords/gnupg/pubring.kbx~ and b/passwords/gnupg/pubring.kbx~ differ