diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-03-21 22:32:21 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-03-21 22:32:21 +0100 |
| commit | f83eb579c255fc764c182a02e70c149d913e9b6a (patch) | |
| tree | 800a57f5d8b32a8366599843925a623e5e11a92f /config/sway/status.sh | |
| parent | 97ffb49313d7dd51ad4ec1f8e15d02c0b8e0f490 (diff) | |
Add niri and firends
Diffstat (limited to 'config/sway/status.sh')
| -rwxr-xr-x | config/sway/status.sh | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/config/sway/status.sh b/config/sway/status.sh index b81c2d4..cad468e 100755 --- a/config/sway/status.sh +++ b/config/sway/status.sh @@ -1,9 +1,49 @@ -bat_capacity=$(cat /sys/class/power_supply/macsmc-battery/capacity) -bat_status=$(cat /sys/class/power_supply/macsmc-battery/status) -datestr=$(date +'%Y-%m-%d %H:%M') -drive=$(df -h / --output=avail | tail -n 1 | awk '{$1=$1};1') -wifi_status=$(nmcli -t -f IN-USE,BARS,SSID dev wifi | rg '^\*') -wifi_bars=$(echo ${wifi_status} | cut -d':' -f 2) -wifi_ssid=$(echo ${wifi_status} | cut -d':' -f 3) +echo "{\"version\": 1}" +echo "[" +echo "[]" -echo "${wifi_bars} ${wifi_ssid} | ${drive} | ${bat_capacity}% [${bat_status:0:1}] | ${datestr}" +while true; do + bat_capacity=$(cat /sys/class/power_supply/macsmc-battery/capacity) + bat_status=$(cat /sys/class/power_supply/macsmc-battery/status) + if [ "$bat_status" = "Discharging" ]; then + bat_color="#FA2B00" + else + bat_color="#23C17C" + fi + datestr=$(date +'%Y-%m-%d %H:%M') + drive=$(df -h / --output=avail | tail -n 1 | awk '{$1=$1};1') + wifi_status=$(nmcli -t -f IN-USE,BARS,SSID dev wifi | rg '^\*') + wifi_bars=$(echo ${wifi_status} | cut -d':' -f 2) + wifi_ssid=$(echo ${wifi_status} | cut -d':' -f 3) + vpn_status=$(mullvad status -j | jq -r .state) + if [ "$vpn_status" = "connected" ]; then + vpn_color="#23C17C" + else + vpn_color="#FA2B00" + fi + +cat << EOF +,[ + { + "full_text": "<span foreground=\"${vpn_color}\">${wifi_bars}</span> ${wifi_ssid}", + "markup": "pango", + }, + { + "full_text": "<span font-weight=\"100\">${drive}</span>", + "markup": "pango", + }, + { + "full_text": "<span foreground=\"${bat_color}\" font-weight=\"100\">${bat_capacity}%</span>", + "markup": "pango", + }, + { + "full_text": "<span font-weight=\"300\">${datestr}</span>", + "color": "#FFFFFF", + "markup": "pango", + } +] +EOF + + # Sleep for a second before updating again + sleep 1 +done |