25 lines
610 B
Bash
Executable File
25 lines
610 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Clean up the voxtype --follow child when Waybar reloads
|
|
|
|
if omarchy-cmd-present voxtype; then
|
|
coproc VOXTYPE_STATUS { voxtype status --follow --extended --format json; }
|
|
voxtype_pid=$VOXTYPE_STATUS_PID
|
|
|
|
cleanup() {
|
|
kill "$voxtype_pid" 2>/dev/null || true
|
|
}
|
|
|
|
trap cleanup EXIT INT TERM
|
|
|
|
while IFS= read -r line <&"${VOXTYPE_STATUS[0]}"; do
|
|
if omarchy-cmd-present jq; then
|
|
jq -c '. + {alt: (.class // "")}' <<<"$line" || printf '%s\n' "$line"
|
|
else
|
|
printf '%s\n' "$line"
|
|
fi
|
|
done
|
|
else
|
|
echo '{"alt": "", "class": "idle", "tooltip": ""}'
|
|
fi
|