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

19 lines
365 B
Bash
Executable File

#!/bin/sh
printf "{\"version\":1}\n"
printf "[\n"
while true
do
printf [
printf "{\"full_text\":\"%s\"},"\
"$(swaymsg -t get_inputs | jq -Mcj '
[.[]
| select(.type == "keyboard")][0]
| .xkb_active_layout_name')"\
"$(cat /sys/class/power_supply/BAT0/capacity)"\
"$(date +%c)"
printf ],
timeout 1 swaymsg -t subscribe '["input"]' >/dev/null
done