1
0
Fork 0
dot/.config/sway/status.sh

16 lines
708 B
Bash
Raw Normal View History

2024-01-27 21:06:04 +01:00
#!/bin/sh
printf "{\"version\":1}\n"
printf "[\n"
while true
do
printf [
swaymsg -t get_inputs | jq -Mcj '[.[] | select(.type=="keyboard")][0] | {"full_text":.xkb_active_layout_name,"urgent":.xkb_active_layout_index}, ","'
cat /sys/class/power_supply/BAT0/capacity | jq -Mcj '{"full_text":.}, ","'
date +%c | jq -RMcj '{"full_text":.}, ","'
swaymsg -t get_tree | jq -Mcj '.nodes[] | select(.name=="__i3").nodes[] | select(.name=="__i3_scratch").floating_nodes | {"full_text":length,"urgent":length}, ","'
makoctl list | jq -Mcj '.data[][0] | {"full_text":(.summary.data // 0),"urgent":((.urgency.data // 0) == 2)}, ","'
printf ],
timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null
done