From a470bb816f02bdaa00932434f6d48cb7a7cda466 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Sat, 29 Jul 2023 21:14:09 +0200 Subject: [PATCH] make getvol script nicer and work without amixer --- examples/eww-bar/scripts/getvol | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/eww-bar/scripts/getvol b/examples/eww-bar/scripts/getvol index 6a95077..5b92a39 100755 --- a/examples/eww-bar/scripts/getvol +++ b/examples/eww-bar/scripts/getvol @@ -1,2 +1,7 @@ #!/bin/sh -amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%' | head -1 + +if command -v pactl &>/dev/null; then + pactl get-sink-volume $(pactl get-default-sink) | awk -F '[^0-9]+' '/left:/{print $3}' +else + amixer -D pulse sget Master | awk -F '[^0-9]+' '/Left:/{print $3}' +fi