You are not logged in.
Hello,
so i'm using openbox and i'm wondering how to add a certain actions to my keyboard volume up/down buttons.
I've set up volumeicon with xfce4-notifyd support and everything works great. The thing is i'd like to add a sound notification every time I press XF86AudioRaise or XF86AudioLower on my keyboard.
I've tried to set it in openbox rc file
<keybind key="XF86AudioLowerVolume">
<action name="Execute">
<command>amixer set Master 5%- && play /usr/share/sounds/freedesktop/stereo/bell.oga -q</command>
</action>
</keybind>
<keybind key="XF86AudioRaiseVolume">
<action name="Execute">
<command>amixer set Master 5%+ && play /usr/share/sounds/freedesktop/stereo/bell.oga -q</command>
</action>
</keybind>
but i don't have visual notifications then (xfce4-notifyd).
Is there a simple way to have volumeicon + xfce4-notifyd working with playing sound on VolUp/Down keys pressed?
PS. Perhaps some command to send volume level via notify-send?
So, I've written my own script, which works good. (~/bin/volume)
~/bin/volume
#!/bin/bash
## sound level
STATUS=`amixer get Master | grep -m 1 '%' | cut -d'[' -f2 | cut -d'%' -f1`
## changing sound level
if [ "$1" = "toggle" ]; then
amixer set Master toggle
elif [ "$1" = "volup" ]; then
amixer set Master unmute
amixer set Master 10%+
elif [ "$1" = "voldown" ]; then
amixer set Master unmute
amixer set Master 10%-
fi
## playing sound
play /usr/share/sounds/freedesktop/stereo/bell.oga -q
## killing existing notifications
(pidof xfce4-notifyd 1>/dev/null && killall xfce4-notifyd)
## new sound level after change
STATUS_NEW=`amixer get Master | grep -m 1 '%' | cut -d'[' -f2 | cut -d'%' -f1`
## sound muted on/off
MUTED=`amixer get Master | grep -m 1 '%' | cut -d'[' -f3 | cut -d']' -f1`
## icon based on volume level
if [ "$STATUS_NEW" -le 33 ]; then
ICON="audio-volume-low"
elif [ "$STATUS_NEW" -ge 66 ]; then
ICON="audio-volume-high"
else
ICON="audio-volume-medium"
fi
if [ "$MUTED" = "off" ]; then
ICON="audio-volume-muted"
fi
## sending notification
notify-send " " -i $ICON -h int:value:$STATUS_NEW -h string:synchronous:volume
My openbox rc
<keybind key="XF86AudioMute">
<action name="Execute">
<command>volume toggle</command>
</action>
</keybind>
<keybind key="XF86AudioLowerVolume">
<action name="Execute">
<command>volume voldown</command>
</action>
</keybind>
<keybind key="XF86AudioRaiseVolume">
<action name="Execute">
<command>volume volup</command>
</action>
</keybind>
Last edited by nycko (2016-09-14 07:51:37)
Offline