From 8f54bec168f862b9bda2ec4227381b852c54b08e Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Mon, 26 Apr 2021 20:17:48 +0200 Subject: [PATCH] Change text in mullvad waybar component --- tree/.local/bin/mullvad-waybar | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tree/.local/bin/mullvad-waybar b/tree/.local/bin/mullvad-waybar index 8ae3329..3eb231c 100755 --- a/tree/.local/bin/mullvad-waybar +++ b/tree/.local/bin/mullvad-waybar @@ -2,8 +2,8 @@ if ! which mullvad &> /dev/null then - echo "ERROR: command 'mullvad' does not exist" - exit 1 + echo "ERROR: command 'mullvad' does not exist" + exit 1 fi STATUS="$(mullvad status)" @@ -13,26 +13,24 @@ CONNECTED="Tunnel status: Connected" DISCONNECTED="Tunnel status: Disconnected" check_status() { - STRING="$1" - echo "$STATUS" | grep -iq "$STRING" + STRING="$1" + echo "$STATUS" | grep -iq "$STRING" } TOOLTIP="$STATUS" +TEXT="VPN" + if check_status "$CONNECTED"; then - TEXT="Connected" ON_CLICK="mullvad disconnect" CLASS="" elif check_status "$DISCONNECTED"; then - TEXT="Disconnected" ON_CLICK="mullvad connect" CLASS="disconnected" elif check_status "$CONNECTING"; then - TEXT="Connecting..." ON_CLICK="mullvad disconnect" CLASS="connecting" else - TEXT="Error" ON_CLICK="mullvad reconnect" CLASS="disconnected" fi