What is this in short:
Setting shortcuts on the keyboard for kmix a kde dcop compatible alsa mixer frontend which can be used via mouse.

F11 will decrease volume and F12 will increase volume.

As most of you I also like listening to music with my PC. The best way nowadays is by using alsa capable audio application as xmms or amarok.

traditional way of mixing - kmix

kmix is a very nice tool for fast-volume settings but I need a even faster way - using the keyboard. Ok let's have a look at keybindings, it needs to be fast, so let's put it on F11 for decrease and F12 for increase.

Originally I've been using the mouse wheel over the corresponding icon in the "System Tray" but this means centering the mouse over the icon ... slow solution but good for not to frequent use IMHO.

let's find the according dcop switches

First let's have a look what we get running dcop kmix:

joachim@knabber:~$ dcop kmix
qt
MainApplication-Interface
Mixer0
Mixer1
kmix
kmix-mainwindow#1

Oh interesting, we have two soundcards listed at Mixer0 and Mixer1. I think you know best what soundcard you want to give the commands. Let's see what functions Mixer0 contains:

joachim@knabber:~$ dcop kmix Mixer0
QCStringList interfaces()
QCStringList functions()
void setVolume(int deviceidx,int percentage)
void setMasterVolume(int percentage)
void increaseVolume(int deviceidx)
void decreaseVolume(int deviceidx)
int volume(int deviceidx)
int masterVolume()
void setAbsoluteVolume(int deviceidx,long int absoluteVolume)
long int absoluteVolume(int deviceidx)
long int absoluteVolumeMin(int deviceidx)
long int absoluteVolumeMax(int deviceidx)
void setMute(int deviceidx,bool on)
void toggleMute(int deviceidx)
bool mute(int deviceidx)
void setRecordSource(int deviceidx,bool on)
bool isRecordSource(int deviceidx)
void setBalance(int balance)
bool isAvailableDevice(int deviceidx)
QString mixerName()  

Ha! We found it, let's now play with it, try these comamnds:

joachim@knabber:~$ dcop kmix Mixer0 setVolume 0 4
joachim@knabber:~$ dcop kmix Mixer0 setVolume 0 44
joachim@knabber:~$ dcop kmix Mixer0 setVolume 0 102

Oh this one is odd, we missed something, hehe!?

joachim@knabber:~$ dcop kmix Mixer0 increaseVolume
Not enough arguments.

Ok, some more:

joachim@knabber:~$ dcop kmix Mixer0 increaseVolume 0

Running commands above should change your volume while playing a song with a alsa application.

Setting the global shortcut

After starting the "Control Center" you should go to "Regional & Accessibility" - "KHotKeys".

  1. Create a new action with "New Action"
  2. Give it a name in the "General" menu
  3. Set a new shortcut trigger and set F11 key
  4. In the actions tab set a new "dcop call"
Remote application:
  kmix
Remote object:
  Mixer0
Called function:
  increaseVolume
Arguments:
  0
  1. Click the try button and test your settings
  2. Afterwards click "apply" and your shortcut should be set!

summary

Setting shortcuts is very useful, you should play around with dcop to find more useful posibilities. Creativity will help you!

May the force be with you.

Powered by MediaWiki