diff options
author | B. Watson <yalhcru@gmail.com> | 2020-04-19 00:54:24 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2020-04-19 00:54:24 -0400 |
commit | d4ee19b25164ca8bf70f3d8235f20052444cf9ed (patch) | |
tree | 072112c39e20334fff289ad1cb45138178a124af | |
parent | 926f740f5445dfcde1c43990566c719053ff2238 (diff) | |
download | misc-scripts-d4ee19b25164ca8bf70f3d8235f20052444cf9ed.tar.gz |
vol: desktop-less volume control for xbindkeys
-rwxr-xr-x | vol | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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 } |