waybar changes 1

This commit is contained in:
cnst
2024-12-27 16:46:50 +01:00
parent 542bac2fe7
commit 10716da678
22 changed files with 1007 additions and 159 deletions

View File

@@ -0,0 +1,37 @@
#!/bin/bash
socket="${XDG_RUNTIME_DIR:-/run/user/$UID}/yubikey-touch-detector.socket"
while true; do
touch_reasons=()
if [ ! -e "$socket" ]; then
printf '{"text": "Waiting for YubiKey socket"}\n'
while [ ! -e "$socket" ]; do sleep 1; done
fi
printf '{"text": ""}\n'
while read -n5 cmd; do
reason="${cmd:0:3}"
if [ "${cmd:4:1}" = "1" ]; then
touch_reasons+=("$reason")
else
for i in "${!touch_reasons[@]}"; do
if [ "${touch_reasons[i]}" = "$reason" ]; then
unset 'touch_reasons[i]'
break
fi
done
fi
if [ "${#touch_reasons[@]}" -eq 0 ]; then
printf '{"text": ""}\n'
else
tooltip="YubiKey is waiting for a touch, reasons: ${touch_reasons[@]}"
printf '{"text": "  ", "tooltip": "%s"}\n' "$tooltip"
fi
done < <(nc -U "$socket")
sleep 1
done