updates
This commit is contained in:
parent
dd60fce00f
commit
fdd9dd20ae
14 changed files with 544 additions and 204 deletions
35
modules/home/apps/helpers/waybar/mullvad-status.sh
Executable file
35
modules/home/apps/helpers/waybar/mullvad-status.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Get status (fall back to “Disconnected” on error)
|
||||
STATUS=$(mullvad status 2>/dev/null || echo "Disconnected")
|
||||
|
||||
if echo "$STATUS" | grep -q "^Connected"; then
|
||||
# Extract relay hostname
|
||||
SERVER=$(echo "$STATUS" |
|
||||
sed -n 's/^[[:space:]]*Relay:[[:space:]]*//p' |
|
||||
sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
||||
|
||||
# Grab the entire Visible location line (location + IPs)
|
||||
FULL_LOC=$(echo "$STATUS" |
|
||||
sed -n 's/^[[:space:]]*Visible location:[[:space:]]*//p')
|
||||
|
||||
# Split off the human‐readable location (before first dot)
|
||||
LOCATION=${FULL_LOC%%.*}
|
||||
|
||||
# The part after the first “. ” is the IP info
|
||||
IPS=${FULL_LOC#*. }
|
||||
|
||||
TOOLTIP="Connected via ${SERVER} (${IPS})"
|
||||
|
||||
# Emit JSON for Waybar
|
||||
echo '{"text": "'"${LOCATION}"'"
|
||||
, "tooltip": "'"${TOOLTIP}"'"
|
||||
, "class": "connected"
|
||||
}'
|
||||
else
|
||||
echo '{"text": "Disconnected"
|
||||
, "tooltip": "Mullvad: Disconnected"
|
||||
, "class": "disconnected"
|
||||
}'
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue