From d4ee19b25164ca8bf70f3d8235f20052444cf9ed Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 19 Apr 2020 00:54:24 -0400 Subject: vol: desktop-less volume control for xbindkeys --- vol | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vol b/vol index bf2f7de..ffc7fc6 100755 --- a/vol +++ b/vol @@ -43,7 +43,7 @@ FONT=12x24 # What color is the OSD bar and text? See /usr/share/X11/rgb.txt. # COLOR is for when we're unmuted, MUTECOLOR is for muted. -COLOR=green +COLOR=orange MUTECOLOR=red # Text drop shadow, 0 to disable. @@ -74,10 +74,10 @@ PIDFILE="$HOME/.$SELF.osd.pid" # system), the OSD bar will never get a chance to display. osd() { - local got="$( amixer $AMIXER_OPTS get $CHANNEL )" - local muted="$( echo $got | grep '\[off\]$' )" - local volpct="$( echo $got | cut -d'[' -f2 | cut -d% -f1 )" - local db="$( echo $got | cut -d'[' -f3 | cut -d']' -f1 )" + local got="$( amixer $AMIXER_OPTS get $CHANNEL | tail -1 )" + local muted="$( echo "$got" | grep '\[off\]$' )" + local volpct="$( echo "$got" | cut -d'[' -f2 | cut -d% -f1 )" + local db="$( echo "$got" | cut -d'[' -f3 | cut -d']' -f1 )" local text="Volume $db ($volpct%)" local color="$COLOR" local oldpid @@ -100,9 +100,9 @@ osd() { -P $volpct \ -p $POSITION \ -c $color \ - -s $SHADOW -T \ - "$text" \ - -f $FONT & + -s $SHADOW \ + -f $FONT \ + -T "$text" & echo "$!" > $PIDFILE } -- cgit v1.2.3