Rename and refactor swaystatus script
parent
a887681f2a
commit
69411dd2c2
|
@ -51,7 +51,7 @@ set $swaylock swaylock -f \
|
|||
# bar ##########################################################################
|
||||
bar {
|
||||
separator_symbol " | "
|
||||
status_command status.sh
|
||||
status_command exec swaystatus
|
||||
strip_workspace_numbers yes
|
||||
wrap_scroll yes
|
||||
colors {
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
printf "{\"version\":1}\n"
|
||||
printf "[\n"
|
||||
|
||||
if ! command -v jq >/dev/null; then
|
||||
while :; do
|
||||
printf '[{ "full_text":"jq: command not found", "urgent":true },],'
|
||||
sleep 60
|
||||
done
|
||||
fi
|
||||
|
||||
while :; do
|
||||
printf "["
|
||||
# notifications
|
||||
makoctl list | jq -Mcj '.data[] |
|
||||
if length>0 then {
|
||||
"full_text":(["(",length,") ",.[0].summary.data]|join("")),
|
||||
"urgent":(.[0].urgency.data==2),
|
||||
} else {
|
||||
"full_text":"(0)",
|
||||
} end, ","'
|
||||
# battery
|
||||
# shellcheck disable=SC2002
|
||||
cat /sys/class/power_supply/BAT0/capacity | jq -Mcj '
|
||||
if .<20 then {
|
||||
"full_text":([.," %"]|join("")),
|
||||
"urgent":true,
|
||||
} else {
|
||||
"full_text":([.," %"]|join("")),
|
||||
} end, ","'
|
||||
# date
|
||||
date +%c | jq -RMcj '{ "full_text":., }, ","'
|
||||
# scratchpad
|
||||
swaymsg -t get_tree | jq -Mcj '.nodes[] | select(.name=="__i3").nodes[] |
|
||||
select(.name=="__i3_scratch").floating_nodes | {
|
||||
"full_text":length,
|
||||
"urgent":length,
|
||||
}, ","'
|
||||
printf "],"
|
||||
# timeout
|
||||
timeout 1 swaymsg -qt subscribe '["binding"]' >/dev/null
|
||||
sleep 0.1
|
||||
done
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
printf "{\"version\":1}\n"
|
||||
printf "[\n"
|
||||
|
||||
if ! command -v jq >/dev/null; then
|
||||
while :; do
|
||||
printf '[{"full_text":"jq: command not found","urgent":true},],'
|
||||
sleep 60
|
||||
done
|
||||
fi
|
||||
|
||||
while :; do
|
||||
printf "["
|
||||
# notifications
|
||||
makoctl list | jq -cj '.data[][0] | {"full_text":.summary.data,"urgent":(.urgency.data==2)}, ","'
|
||||
# battery
|
||||
# shellcheck disable=SC2002
|
||||
cat /sys/class/power_supply/BAT0/capacity | jq -cj '{"full_text":((.|tostring)+" %"),"urgent":(.<20)}, ","'
|
||||
# date
|
||||
date | jq -Rcj '{"full_text":.}, ","'
|
||||
# scratchpad
|
||||
swaymsg -t get_tree | jq -cj 'recurse(.nodes[]) | select(.name=="__i3_scratch").floating_nodes | {"full_text":length,"urgent":length}, ","'
|
||||
printf "],"
|
||||
# timeout
|
||||
timeout 1 swaymsg -qt subscribe '["binding"]' >/dev/null
|
||||
sleep 0.1
|
||||
done
|
Loading…
Reference in New Issue