diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-08-23 06:47:03 +0300 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-08-23 06:47:03 +0300 |
commit | 7ff798534a6fb9c99611d18ee22757346798ef61 (patch) | |
tree | 1f6603ff9f3eede365e6963b3ac66b5edbd232fb /.config/eww/scripts/volume-listener | |
parent | 8f7cbf4ad87d63fe82173645ecb590ebb0f12354 (diff) |
eww: Add an eww configuration
Diffstat (limited to '.config/eww/scripts/volume-listener')
-rwxr-xr-x | .config/eww/scripts/volume-listener | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/.config/eww/scripts/volume-listener b/.config/eww/scripts/volume-listener new file mode 100755 index 0000000..9c0368c --- /dev/null +++ b/.config/eww/scripts/volume-listener @@ -0,0 +1,34 @@ +#!/bin/sh + +stdbuf -oL amixer events \ + | stdbuf -oL sed 's/event value: //' \ + | while IFS= read -r line + do + IFS='=,' + set -- $line + x=${6#\'} + x=${x%\'} + case "$x" in + 'Master Playback'*) + wpctl get-volume @DEFAULT_AUDIO_SINK@ \ + | awk ' + /MUTED/ { + print "icon=" + print "percentage=Muted" + exit + } + { + printf "icon=" + if ($2 < 0.33) + print "" + else if ($2 <= 0.66) + print "" + else + print "" + printf "percentage=%s%d%%\n", pad, $2 * 100 + } + ' \ + | jo + ;; + esac + done |