summaryrefslogtreecommitdiff
path: root/sway/status.sh
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-12-16 22:21:06 +0100
committerxengineering <me@xengineering.eu>2024-12-16 22:21:06 +0100
commit6eeb80c04e88872346ed70d356111e69f312e2a1 (patch)
tree399565815a0144a8ee40b1199e85e4fd13a18fca /sway/status.sh
parent12cc15e968185dff9dc4a6951c6487f7041a8dec (diff)
downloaddotfiles-icy-titles.tar
dotfiles-icy-titles.tar.zst
dotfiles-icy-titles.zip
WIP: sway: Display mpv icy_title in status baricy-titles
TODO: Do not display bar if socket is not responding.
Diffstat (limited to 'sway/status.sh')
-rwxr-xr-xsway/status.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/sway/status.sh b/sway/status.sh
index 6bbbd63..a4ea814 100755
--- a/sway/status.sh
+++ b/sway/status.sh
@@ -1,6 +1,9 @@
#!/bin/sh
+MPV_SOCKET="${XDG_RUNTIME_DIR}/mpv-socket"
+
+
temp() {
find /sys/class/thermal -type l -name 'thermal_zone*' | \
while read -r zone
@@ -8,8 +11,15 @@ temp() {
printf "%s °C " "$(( $(cat ${zone}/temp) / 1000 ))"
done
}
+
bat="BAT $(cat /sys/class/power_supply/BAT*/capacity | tr '\n' ' ')"
+
time="$(date '+KW %W %a %Y-%m-%d %H:%M')"
+icy_title=''
+if [ -S "$MPV_SOCKET" ]
+then
+ icy_title="| $(echo '{"command": ["get_property", "metadata"] }' | socat - "$MPV_SOCKET" | jq -r '.data["icy-title"]') "
+fi
-echo "| $(temp)| ${bat}| ${time} |"
+echo "${icy_title}| $(temp)| ${bat}| ${time} |"