dotfiles

dotfiles - ryukamish edition
Log | Files | Refs | README

commit b7535c43ee05e543842ea55da66c31aa444ea7af
parent 88ad6b51e3ed35a6c0f4e243be67b528ba991dc5
Author: ryukamish <[email protected]>
Date:   Thu, 25 Jun 2026 13:09:25 +0530

fix: only show the status of vpn connection

Diffstat:
M.config/waybar/config.jsonc | 2+-
M.local/bin/waybar-vpn | 35++++++-----------------------------
2 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc @@ -80,7 +80,7 @@ }, "custom/vpn": { "format": "VPN: <span color='#aaaaaa'>{}</span>", - "exec": "~/.local/bin/waybar-vpn status", + "exec": "~/.local/bin/waybar-vpn", "return-type": "json", "interval": 30 }, diff --git a/.local/bin/waybar-vpn b/.local/bin/waybar-vpn @@ -1,31 +1,8 @@ #!/bin/sh -# first user argument -cmd="$1" - -case "$cmd" in - connect) - # TODO: handle root permission password input - if [ -n $(type "nmcli") ]; then - nmcli connection show --active \ - rg -i 'wireguard' - fi - ;; - disconnect) - # `wg-quick` requires root permission to disconnect - # don't have the solution right now - ;; - status) - vpn=$(nmcli connection show --active | rg -i 'wireguard' | awk '{print $1}') - if [ -n "$vpn" ]; then - printf "{\"text\": \"$vpn\", \"class\": \"wireguard\", \"alt\": \"disconnected\" }\n" - else - printf "{\"text\": \"DC'D\", \"class\": \"wireguard\", \"alt\": \"disconnected\" }\n" - fi - ;; - *) - # print usage if not used with any of the below three commands - echo -e "Usage: %s {status|connect|disconnect}\n" - exit 1 - ;; -esac +vpn=$(nmcli connection show --active | rg -i 'wireguard' | awk '{print $1}') +if [ -n "$vpn" ]; then + printf "{\"text\": \"$vpn\", \"class\": \"wireguard\", \"alt\": \"disconnected\" }\n" +else + printf "{\"text\": \"DC'D\", \"class\": \"wireguard\", \"alt\": \"disconnected\" }\n" +fi