summaryrefslogtreecommitdiff
path: root/sway/status.sh
blob: a4ea8141d2a4c7112624502fcad4399553a95e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh


MPV_SOCKET="${XDG_RUNTIME_DIR}/mpv-socket"


temp() {
       find /sys/class/thermal -type l -name 'thermal_zone*' | \
       while read -r zone
       do
               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 "${icy_title}| $(temp)| ${bat}| ${time} |"