From 7ff798534a6fb9c99611d18ee22757346798ef61 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 23 Aug 2023 06:47:03 +0300 Subject: eww: Add an eww configuration --- .config/eww/scripts/volume-listener | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 .config/eww/scripts/volume-listener (limited to '.config/eww/scripts/volume-listener') 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 -- cgit v1.2.3