[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: i3 wm sound volume and brightness




On Fri, 9 Feb 2018, Robert Ford wrote:

> Two questions:
> - How to bind hot key so that there would have volume sound display on screen?
> - How to bind hot key so that brightness would also display on screen?
> 
> My i3 config for sound volume and brightness is https://paste.debian.net/1009555
> 
> The problem is configuration for sound works but there is no display. And for brightness, xbacklight -inc N or xbacklight -dec N returns message
> 

I don't use i3, but for display of sound vol/mute changes, this is 
probably a common issue on wm systems.  On fluxbox I use aosd_cat and a 
script that is called by the hotkeys.  There are a lot of good examples on 
the net.  Just search for aosd_cat+volume and you will find plenty of 
scripts, with all kinds of features.

#!/bin/sh
# fbvolhelper script to control/display volume and mute using aosd_cat
# see ~/.fluxbox/keys
# :Exec fbvolhelper.sh up|down|mute

SCONTROL=Master
OSDFONT="terminus bold 20"
STEP=5

case "$1" in
        up)
		amixer -q sset $SCONTROL,0 unmute
		VOLSTR=$(amixer sset $SCONTROL,0 $STEP+ | egrep -om 1 '[0-9]+%')
		OSDSTR="Vol: $VOLSTR"
	;;
        down)
		amixer -q sset $SCONTROL,0 unmute
		VOLSTR=$(amixer sset $SCONTROL,0 $STEP- | egrep -om 1 '[0-9]+%')
		OSDSTR="Vol: $VOLSTR"
	;;
        mute)
		MUTESTR=$(amixer sset $SCONTROL,0 toggle | egrep -om 1 '\[o+[a-z]+\]')
		case "$MUTESTR" in
			\[off\])	MUTESTATE="ON"	;;
			\[on\])		MUTESTATE="OFF"	;;
		esac
		OSDSTR="Mute: $MUTESTATE"
	;;
	*) exit
esac

killall -q aosd_cat >/dev/null

echo $OSDSTR | \
aosd_cat -y 35 -x -10 -e 1 -p 2 -f 0 -u 1000 -o 0 \
-n "$OSDFONT" \
&>/dev/null
---


Reply to: