volnoti on KDE using alsamixer
The only program that worked for a HP laptop to control the volume correctly on KDE.
@todo this script is for alsamixer, and kde, more needs to be added to support other environments
create a script /usr/local/bin/sound.sh. This script will be called by another script placed in autostart.
insert the following contents in this script
#!/bin/bash #this script is made for volnoti # Configuration STEP="2" # Anything you like. UNIT="dB" # dB, %, etc. # Set volume SETVOL="/usr/bin/amixer -qc 0 set Master" SETHEADPHONE="/usr/bin/amixer -qc 0 set Headphone" case "$1" in "up") $SETVOL $STEP$UNIT+ ;; "down") $SETVOL $STEP$UNIT- ;; "mute") $SETVOL toggle ;; esac # Get current volume and state VOLUME=$(amixer get Master | grep 'Mono:' | cut -d ' ' -f 6 | sed -e 's/[^0-9]//g') STATE=$(amixer get Master | grep 'Mono:' | grep -o "\[off\]") # Show volume with volnoti if -n $STATE ; then volnoti-show -m else volnoti-show $VOLUME # If headphone is being used, mute is treated a bit differently when muted. Make sure headphones follows master mute. amixer -c 0 set Headphone unmute amixer -c 0 set Speaker unmute amixer -qc 0 set Speaker 100% fi exit 0
Note, the broken line above is this, i guess the wiki mishandles brackets in code
if -n $STATE ; then
ok, so its creating a link here too, ok let me spell it out for you
if left bracket, left bracket, -n $STATE right bracket, right bracket; then
save this script then set permissions
#chown root:users /usr/local/bin/sound.sh #chmod 755 /usr/local/bin/sound.sh
install xbindkeys so that you can control volume with your keyboard
pacman -S xbindkeys
Logged in as user, create a xbindkeys config file ~/.xbindkeysrc with the following information for xbindkeys. This example sets the volume to the f7 (mute), f8 (vol down), and f9(vol up) keys
# increase volume "sh /usr/local/bin/sound.sh up" m:0x0 + c:75 F9 # Decrease volume "sh /usr/local/bin/sound.sh down" m:0x0 + c:74 F8 # Toggle mute "sh /usr/local/bin/sound.sh mute" m:0x0 + c:73 F7 #"amixer set Master playback 1+"
Logged in as user create the kde autostart script in ~/.kde4/Autostart. Name it anything e.g. start-volnoti.sh
#!/bin/bash xbindkeys volnoti
Save this script. Next time kde starts, it will run this script since its located in the autostart folder. It will call xbindkeys and volnoti, which will be waiting for keypresses to control alsamixer.