Files
dotfiles/.config/sway/status.sh
2026-06-18 15:13:57 +02:00

28 lines
728 B
Bash
Executable File

#!/bin/sh
print_status() {
volume_info=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null)
volume=$(printf '%s' "$volume_info" | awk '{printf "%d%%", $2 * 100}')
printf '%s' "$volume_info" | grep -q MUTED && volume="muted"
brightness=$(brightnessctl -m 2>/dev/null | awk -F, '{print $4}')
voxtype_state=$(voxtype status 2>/dev/null)
case "$voxtype_state" in
recording) voxtype=' | VOX REC' ;;
transcribing) voxtype=' | VOX ...' ;;
*) voxtype='' ;;
esac
printf 'VOL %s | BRI %s%s | %s\n' "${volume:-n/a}" "${brightness:-n/a}" "$voxtype" "$(date +'%Y-%m-%d %H:%M:%S')"
}
trap print_status USR1
print_status
while :; do
sleep 1 &
wait $!
print_status
done