How to get on screen display when the volume / mute button is pressed.
1. emerge xosd
2. Create the executable files that will be executed when the buttons are pressed. For me, down.sh (when 'Volume decrease" is pressed), up.sh (Volume increase) and mute.sh (toggle between mute and unmute)
Contents of down.sh
amixer set Master 5%-
killall osd_cat
osd_cat -p middle -A center -f "-adobe-new century schoolbook-medium-i-normal--34-240-100-100-p-182-iso8859-1" -c blue -b percentage -P `amixer sget Master |grep "Front Left: Playback" |cut -c 28-30` -T `amixer sget Master |grep "Front Left: Playback" |cut -c 28-30` -d 2 &
Contents of up.sh
amixer set Master 5%+
killall osd_cat
osd_cat -p middle -A center -c blue -f "-adobe-new century schoolbook-medium-i-normal--34-240-100-100-p-182-iso8859-1" -b percentage -P `amixer sget Master |grep "Front Left: Playback" |cut -c 28-30` -T `amixer sget Master |grep "Front Left: Playback" |cut -c 28-30` -d 2 &
Contents of mute.sh
killall osd_cat
if /usr/bin/amixer sget Master | grep -q "Front Left: Playback 0 \[0%\]"
then
echo "Volume unmuted" | osd_cat -p bottom -A center -f "-adobe-new century schoolbook-medium-i-normal--34-240-100-100-p-182-iso8859-1" -c green -d 2 &
amixer set Master 75%+ on ## the 'on' allows the LED button turn blue
else
echo "Volume muted" | osd_cat -p bottom -A center -f "-adobe-new century schoolbook-medium-i-normal--34-240-100-100-p-182-iso8859-1" -c green -d 2 &
amixer set Master 0 off ## LED button turns orange
fi
3. Map the appropriate keycodes to the volume buttons by using xev into .Xmodmap.
4. Edit ~/.fluxbox/keys so that the respective files (down.sh, up.sh, mute.sh) will be executed when the respective buttons are pressed.
None XF86AudioRaiseVolume :ExecCommand ~/bin/up.sh
None XF86AudioLowerVolume :ExecCommand ~/bin/down.sh
None XF86AudioMute :ExecCommand ~/bin/mute.sh
1. emerge xosd
2. Create the executable files that will be executed when the buttons are pressed. For me, down.sh (when 'Volume decrease" is pressed), up.sh (Volume increase) and mute.sh (toggle between mute and unmute)
Contents of down.sh
amixer set Master 5%-
killall osd_cat
osd_cat -p middle -A center -f "-adobe-new century schoolbook-medium-i-normal--34-240-100-100-p-182-iso8859-1" -c blue -b percentage -P `amixer sget Master |grep "Front Left: Playback" |cut -c 28-30` -T `amixer sget Master |grep "Front Left: Playback" |cut -c 28-30` -d 2 &
Contents of up.sh
amixer set Master 5%+
killall osd_cat
osd_cat -p middle -A center -c blue -f "-adobe-new century schoolbook-medium-i-normal--34-240-100-100-p-182-iso8859-1" -b percentage -P `amixer sget Master |grep "Front Left: Playback" |cut -c 28-30` -T `amixer sget Master |grep "Front Left: Playback" |cut -c 28-30` -d 2 &
Contents of mute.sh
killall osd_cat
if /usr/bin/amixer sget Master | grep -q "Front Left: Playback 0 \[0%\]"
then
echo "Volume unmuted" | osd_cat -p bottom -A center -f "-adobe-new century schoolbook-medium-i-normal--34-240-100-100-p-182-iso8859-1" -c green -d 2 &
amixer set Master 75%+ on ## the 'on' allows the LED button turn blue
else
echo "Volume muted" | osd_cat -p bottom -A center -f "-adobe-new century schoolbook-medium-i-normal--34-240-100-100-p-182-iso8859-1" -c green -d 2 &
amixer set Master 0 off ## LED button turns orange
fi
3. Map the appropriate keycodes to the volume buttons by using xev into .Xmodmap.
4. Edit ~/.fluxbox/keys so that the respective files (down.sh, up.sh, mute.sh) will be executed when the respective buttons are pressed.
None XF86AudioRaiseVolume :ExecCommand ~/bin/up.sh
None XF86AudioLowerVolume :ExecCommand ~/bin/down.sh
None XF86AudioMute :ExecCommand ~/bin/mute.sh
No comments:
Post a Comment