.local/bin: update
parent
d7a6698375
commit
81df236bd8
|
@ -4,39 +4,33 @@ printf "{\"version\":1}\n"
|
||||||
printf "[\n"
|
printf "[\n"
|
||||||
|
|
||||||
if ! command -v jq >/dev/null; then
|
if ! command -v jq >/dev/null; then
|
||||||
while true; do
|
while :; do
|
||||||
printf '[{ "full_text":"jq: command not found", "urgent":true },],'
|
printf '[{ "full_text":"jq: command not found", "urgent":true },],'
|
||||||
sleep 1
|
sleep 60
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while :; do
|
||||||
printf "["
|
printf "["
|
||||||
# keyboard layout
|
# keyboard layout
|
||||||
swaymsg -t get_inputs | jq -Mcj '[.[] | select(.type=="keyboard")][0] |
|
swaymsg -t get_inputs | jq -Mcj '[.[] | select(.type=="keyboard")][0] | {
|
||||||
{
|
|
||||||
"full_text":.xkb_active_layout_name,
|
"full_text":.xkb_active_layout_name,
|
||||||
"urgent":.xkb_active_layout_index,
|
"urgent":.xkb_active_layout_index,
|
||||||
}, ","'
|
}, ","'
|
||||||
# battery
|
# battery
|
||||||
# shellcheck disable=SC2002
|
# shellcheck disable=SC2002
|
||||||
cat /sys/class/power_supply/BAT0/capacity | jq -Mcj '
|
cat /sys/class/power_supply/BAT0/capacity | jq -Mcj '
|
||||||
if .<20 then
|
if .<20 then {
|
||||||
{
|
|
||||||
"full_text":([.," %"]|join("")),
|
"full_text":([.," %"]|join("")),
|
||||||
"urgent":true,
|
"urgent":true,
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
"full_text":([.," %"]|join("")),
|
"full_text":([.," %"]|join("")),
|
||||||
}
|
} end, ","'
|
||||||
end, ","'
|
|
||||||
# date
|
# date
|
||||||
date +%c | jq -RMcj '{ "full_text":., }, ","'
|
date +%c | jq -RMcj '{ "full_text":., }, ","'
|
||||||
# scratchpad
|
# scratchpad
|
||||||
swaymsg -t get_tree | jq -Mcj '.nodes[] | select(.name=="__i3").nodes[] |
|
swaymsg -t get_tree | jq -Mcj '.nodes[] | select(.name=="__i3").nodes[] |
|
||||||
select(.name=="__i3_scratch").floating_nodes |
|
select(.name=="__i3_scratch").floating_nodes | {
|
||||||
{
|
|
||||||
"full_text":length,
|
"full_text":length,
|
||||||
"urgent":length,
|
"urgent":length,
|
||||||
}, ","'
|
}, ","'
|
||||||
|
@ -46,9 +40,10 @@ while true; do
|
||||||
"full_text":(["(",length,") ",.[0].summary.data]|join("")),
|
"full_text":(["(",length,") ",.[0].summary.data]|join("")),
|
||||||
"urgent":(.[0].urgency.data==2),
|
"urgent":(.[0].urgency.data==2),
|
||||||
} else {
|
} else {
|
||||||
"full_text":(["(",length,")"]|join("")),
|
"full_text":"(0)",
|
||||||
} end, ","'
|
} end, ","'
|
||||||
printf "],"
|
printf "],"
|
||||||
# timeout
|
# timeout
|
||||||
timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null
|
timeout 1 swaymsg -t subscribe '["input","binding"]' >/dev/null
|
||||||
|
sleep 0.02
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue