I want to use xbindkeys to set a key combination to increase/decrease the volume, but to do that I need a command to run to change the volume, without having to click the volume icon and change it with the mouse. How can I do this?
You can use
qdbus to access the graphical kmix from the command line. These are the commands to increase and decrease the volume:
qdbus org.kde.kmix /kmix/KMixWindow/actions/increase_volume com.trolltech.Qt.QAction.trigger qdbus org.kde.kmix /kmix/KMixWindow/actions/decrease_volume com.trolltech.Qt.QAction.trigger
man qdbus shows the syntax is
qdbus <service> <path> <method> <args>, and you can see a list of available options at each stage by running a shorter command - e.g, running
qdbus org.kde.kmix will show a list of available paths, and
qdbus org.kde.kmix /kmix/KMixWindow/actions/decrease_volume will show a list of available methods for that path, etc. Note that the methods marked as being read or readwrite can be called with no argument to get their current value - this may be useful to you for automation.
Alternatively, you can access the volume control directly - i.e. not via the graphical kmixer - with the /Mixers option.
qdbus org.kde.kmix /Mixers org.kde.KMix.MixSet.currentMasterControl to find out the current master control (in my case, alsa_output.pci-0000_00_1b.0.analog-stereo). Then use the mixer matching that name, i.e. /Mixers/0/alsa_output_pci_0000_00_1b_0_analog_stereo, with the method org.kde.KMix.Control.increaseVolume or org.kde.KMix.Control.decreaseVolume.
So, the direct access to the volume control will be something like this:
qdbus org.kde.kmix /Mixers/0/alsa_output_pci_0000_00_1b_0_analog_stereo org.kde.KMix.Control.increaseVolume qdbus org.kde.kmix /Mixers/0/alsa_output_pci_0000_00_1b_0_analog_stereo org.kde.KMix.Control.decreaseVolume
Which will change the volume, without doing anything graphical.