��� HOWTO Use Multimedia Keys - Gentoo Linux Wiki

HOWTO Use Multimedia Keys

From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the HOWTO series.
Installation ��� Kernel & Hardware ��� Networks ��� Portage ��� Software ��� System ��� X Server ��� Gaming ��� Non-x86 ��� Emulators ��� Misc

Contents

Introduction

Most modern keyboards are equipped with a number of multimedia keys. This simple HOWTO explains what you have to do in order to use these keys.

Determine the keycodes

Whenever you hit a key on your keyboard the kernel generates a raw scancode, which can be mapped to a keycode. Whilst this is what happens at kernel level, X has a different way of mapping keys. It reads the kernel keycode table at startup, then maps the keycode to its own keycode table . Each keycode can be mapped to a keysym, which is a string that represents a key.

Determining the keycodes for your multimedia keys is very easy. Simply run the following command in an X terminal:

xev

Now press every multimedia key on your keyboard and note the generated keycodes. They can be found in the output of xev, which looks similar to this:


Code: Output of xev
KeyRelease event, serial 31, synthetic NO, window 0x2800001,
root 0x7d, subw 0x0, time 2792224, (-22,86), root:(565,101),
state 0x10, keycode 160, same_screen YES,
XLookupString gives 0 bytes:

The "keycode" value is what we are concerned with. In this example it is "160." Make note of each of each keycode value in respect to each extended key.

The following script can help you find the keycodes in the output of xev:


Code: xev and filter to run on its output
xev | grep keycode | \
sed s/"^.*keycode *\([0-9]\+\).*$"/"keycode \1 = "/ |  uniq

Run this instead of plain xev. Press all multimedia keys in order. Then close the xev window. The filtered output appears only after closing the window. Output example:

keycode 36 =
keycode 144 =
keycode 162 =
keycode 164 =

Most likely, like in this example, you will have a first line in the output which is NOT a multimedia key. Simply delete it.

A single key can be identified without ending xev by:

xev | sed -n '/keycode/!d;s/^.*keycode *\([0-9]\+\).*$/keycode \1 = /;p'



If pressing each key prodeces output from xev then you can jump ahead to Setting up xmodmap. If pressing a key doesn't do anything at all (ie, xev produeces no output), run the following command in an X terminal:

dmesg

You will probably see some lines like these:


Code: Output of dmesg
atkbd.c: Unknown key released (translated set 2, code 0x96 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e016 <keycode>' to make it known.

This means that the kernel doesn't have keycodes mapped to your keyboard's scancodes. You will have to add one line in /etc/conf.d/local.start for each missing key as follows:


File: /etc/conf.d/local.start
setkeycodes e008 136
setkeycodes e016 150
... And so on ...
Where the first number (e008) is what you see in dmesg, and the second number (136) is an unused keycode in your kernel. In general you can find a good keycode by taking the last 2 digits of this first number, converting it from hex (base-16) to decimal (base-10) and adding 128.
This will set up the proper scancode - keycode mapping every boot. To set them up without rebooting, run the following as root:
sh /etc/conf.d/local.start
After you have the proper mappings setup, restart X and try running xev again, to ensure that a keycode is displayed for each multimedia key you want to use.

Setting up xmodmap

All you need to do now is to create a file containing mappings for keycodes to keysyms. Create a file called .Xmodmap in your $HOME directory.


File: .Xmodmap Example
! This works with Trust Silverline Direct Access keyboard
! Use ! for comments

keycode 222 = XF86PowerOff
keycode 223 = XF86Sleep
keycode 236 = XF86Mail
keycode 229 = XF86Search
keycode 230 = XF86Favorites
keycode 178 = XF86WWW

keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 160 = XF86AudioMute
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume

A list of possible keysyms can be found in /usr/lib/X11/XKeysymDB or /usr/share/X11/XKeysymDB (the location of XKeysymDB may differ across distributions). The following is a list of the more commonly used keysyms as found in XKeysymDB.


File: /usr/lib/X11/XKeysymDB
XF86ModeLock            :1008FF01
XF86Standby             :1008FF10
XF86AudioLowerVolume    :1008FF11
XF86AudioMute           :1008FF12
XF86AudioRaiseVolume    :1008FF13
XF86AudioPlay           :1008FF14
XF86AudioStop           :1008FF15
XF86AudioPrev           :1008FF16
XF86AudioNext           :1008FF17

...

XF86HomePage            :1008FF18
XF86Mail                :1008FF19
XF86Start               :1008FF1A
XF86SplitScreen         :1008FF7D
XF86Support             :1008FF7E
XF86Away                :1008FF8D
XF86Messenger           :1008FF8E
XF86WebCam              :1008FF8F
XF86MailForward         :1008FF90
XF86Pictures            :1008FF91
XF86Music               :1008FF92


All you have to do now is to call xmodmap whenever your X session starts. Usually a good place to do this is your $HOME/.xsession file.


File: $HOME/.xsession
/usr/bin/xmodmap $HOME/.Xmodmap

Remember to substitute $HOME for the full path for your home directory.

GDM setup
If you are using GDM you can use the file /etc/X11/Xmodmap as a system wide Xmodmap. You can also change the location to another Xmodmap file if you wish. Simply change sysmodmap=/etc/X11/Xmodmap in the file /etc/X11/gdm/Init/Default to whatever you would like.

Assigning keys to special functions

Now that your multimedia keys have a keysym mapping, you can bind them to whatever function you want or your window manager allows you to respectivly.

Non window manager specific - xbindkeys

If your window manager doesn't have a facility for keyboard shortcuts, or indeed if you want to switch between multiple window managers/desktop environments and keep the same keyboard shortcuts throughout, then xbindkeys may be the solution for you.

To install, a simple emerge xbindkeys will do the trick.

After installation you must edit the config file ~/.xbindkeysrc. If you don't have the file (you won't), you'll get it by running xbindkeys and reading). The file is well commented with examples, but for completeness I will give an example here. To use the key XF86WWW to open your webbrowser (Firefox in this case), place the following code snippet into the config file:

File: ~/.xbindkeysrc
"firefox"
XF86WWW
#General format being:
"command to execute"
key combination

You can use various modifiers (alt, shift, ctrl) to add additional shortcuts. For example, to launch a urxvt terminal with the key combination Ctrl-n, place the following code snippet in your config file:

File: ~/.xbindkeysrc
"urxvt"
Control + n

When finished with your config file, simply run the command xbindkeys (or 'xbindkeys -n' if you do not want xbindkeys to run as a daemon).

Blackbox

You will need to emerge bbkeys. Once bbkeys is installed, make sure bbkeys is ran whenever you start X. Example xinitrc:


File: ~/.xinitrc
bbkeys &
exec blackbox


Now you will need to configure bbkeys. You can either use the global configuration file (usually /usr/share/bbkeys/bbkeysrc) or copy it to ~/.bbkeysrc and edit that instead. You can start from scratch but I recommend just adding to the already existing (and quite nice) defaults. Example:


File: ~/.bbkeysrc
[begin] (bbkeys configuration file)
 # * CUT DEFAULTS *
 [keybindings] (begin keybindings)
 # * CUT DEFAULTS *
 [Execute]   (XF86Mail)      {thunderbird}
 [Execute]   (XF86AudioPlay) {xmms --play-pause}
 [Execute]   (XF86AudioStop) {xmms --stop}
 [Execute]   (XF86AudioNext) {xmms --fwd}
 [Execute]   (XF86AudioPrev) {xmms --rew}
 [Execute]   (XF86AudioLowerVolume)  {amixer -q set PCM 2- unmute}
 [Execute]   (XF86AudioRaiseVolume)  {amixer -q set PCM 2+ unmute}
 [end] (end keybindings)
[end] (end bbkeys configuration)


That's all there is to it.

Fluxbox

Open up your ~/.fluxbox/keys with your favourite editor. To control for example the basic XMMS functionality you append my example to your file:


File: ~/.fluxbox/keys
None XF86AudioPlay :ExecCommand /usr/bin/xmms --play-pause
None XF86AudioStop :ExecCommand /usr/bin/xmms --stop
None XF86AudioPrev :ExecCommand /usr/bin/xmms --rew
None XF86AudioNext :ExecCommand /usr/bin/xmms --fwd
None XF86AudioLowerVolume :ExecCommand amixer -q set PCM 2- unmute
None XF86AudioMute :ExecCommand amixer -q set Master toggle
None XF86AudioRaiseVolume :ExecCommand amixer -q set PCM 2+ unmute


For certain cards it might work if for mute you put PCM, instead of Master. It might give designed effect (volume up button when pressed will unmute the card):


File: ~/.fluxbox/keys
None XF86AudioMute :ExecCommand amixer -q set PCM toggle

Openbox

Open your ~/.config/openbox/rc.xml file, search for section keyboard and, following the examples add in the end of session:


File: ~/.config/openbox/rc.xml
<keybind key="XF86AudioPlay">
 <action name="Execute"><execute>/usr/bin/xmms --play-pause</execute></action>
</keybind>
<keybind key="XF86AudioStop">
 <action name="Execute"><execute>/usr/bin/xmms --stop</execute></action>
</keybind>

For more information see documentation of openbox about keybind in http://icculus.org/openbox/docs.php?page=details.html#keybindings.

See about actions in the same page also.

XFCE

Note: In xfce > 4.2.3.2 (SVN) the shortcut settings are under Settings > Keyboard Settings

Open the Settings Manager, click on "Window Manager" and select the "Keyboard" tab. To define our own key bindings we have to create a new theme. Click "Add" to create it (note that all key bindings from the default theme are copied into the new theme). In the "Command Shortcuts" section doubleclick on an empty slot, enter the command you would like to bind and press the according key. The keysym from your .Xmodmap should appear next to the command if everything works as expected. Done.

KDE

With KDE you can set almost all settings through the Control Center if you have a supported keyboard. Go to Control Center -> Regional & Accessibility -> Keyboard Layout and choose your Keyboard model (I have a Logitech iTouch).

If Keyboard Layout is missing:

$ emerge -av kde-base/kxkb

After you have set your model, use KHotKeys to map the keys to actions. I usually use simple DCOP calls to talk to Amarok.

If your keyboard is not supported you can try the following:

If you use kdm as your login manager, kdm will source the file ~/.xprofile on each login.

Note: If you use Debian, your Xsession file will be located in /etc/kde[version]/kdm/ (substitute [version] with your KDE version)

Simply create the file ~/.Xmodmap as mentioned above, then have a line in ~/.xprofile that has xmodmap use it.


File: ~/.xprofile
/usr/bin/xmodmap $HOME/.Xmodmap

Note: If everything is configured but nothing happens, try to install kde-base/kmilo:

$ emerge -av kde-base/kmilo

GNOME

Gnome-2.10:

Go to Desktop > Preferences > Keyboard Shortcuts, or run gnome-keyboard-bindings, whichever suits your fancy. Make sure the Sound category in the Actions column is expanded, then click on the desired action. The entry in the Shortcut column will change to "New accelerator...." Press the desired key for the binding, and the shortcut is made. A proper entry should look similar to

Action Shortcut
Volume mute XF86AudioMute

If you feel more comfortable with (or are just that more adventurous), open up Gnome's Configuration Editor, either through the menus, or through the command gconf-editor, then navigate to Apps > gnome_settings_daemon > keybindings. For the even-more-adventurous, use your favorite editor (such as vim), and open ~/.gconf/apps/gnome_settings_daemon/keybindings/%gconf.xml

A decent set to work with is:

File: ~/.gconf/apps/gnome_settings_daemon/keybindings/%gconf.xml
<?xml version="1.0"?>
<gconf>
        <entry name="www" mtime="1115511556" type="string">
                <stringvalue>XF86HomePage</stringvalue>
        </entry>
        <entry name="email" mtime="1115511554" type="string">
                <stringvalue>XF86Mail</stringvalue>
        </entry>
        <entry name="next" mtime="1115511504" type="string">
                <stringvalue>XF86AudioNext</stringvalue>
        </entry>
        <entry name="previous" mtime="1115511503" type="string">
                <stringvalue>XF86AudioPrev</stringvalue>
        </entry>
        <entry name="stop" mtime="1115511498" type="string">
                <stringvalue>XF86AudioStop</stringvalue>
        </entry>
        <entry name="play" mtime="1115511489" type="string">
                <stringvalue>XF86AudioPlay</stringvalue>
        </entry>
        <entry name="volume_up" mtime="1116696662" type="string">
                <stringvalue>XF86AudioRaiseVolume</stringvalue>
        </entry>
        <entry name="volume_down" mtime="1115511485" type="string">
                <stringvalue>XF86AudioLowerVolume</stringvalue>
        </entry>
        <entry name="volume_mute" mtime="1116697540" type="string">
                <stringvalue>XF86AudioMute</stringvalue>
        </entry>
</gconf>

Window Maker

Adding shortcuts to Window Maker is simple using the Window Maker Preferences Utility: WPrefs. By default WPrefs is the third icon down in the dock. If WPrefs is no longer in the dock, you can access it on most distros by running the following command in an X terminal:

$ /usr/lib/GNUstep/Applications/WPrefs.app/WPrefs

You can go to the keyboard section of WPrefs to bind the extended keys to some predefined internal Window Maker commands.

Simply scroll right until the keyboard icon is visible and click on it.

You will see a list of internal commands that you can higlight. Select the command you want to bind and then click the "capture" button. Now simply hit the key and any modifiers (ctrl, alt, shift etc.) you want to bind to this function.

While binding internal Window Maker commands is useful, more useful is binding external commands to keystrokes. The only way to do this is to add them to the main Window Maker menu, the same menu you can access from right clicking on the root window or hitting F12 by default.

In WPrefs you can click on the menu icon: the one next to the keyboard icon to access the menu.
An editable version of the menu will pop up outside of the main WPref window. You can drag any of the sample elements from the main WPrefs window to the editable menu to create a new element of that type.
Double-click on an element in the editable menu to change its name. Be sure to press Enter after completing the name change or else it will revert.

Adding a shortcut to a program entry will result in the shortcut keysym showing up in the menu; It will not show up in the editable version of the menu. Because the keysyms are a bit ugly you can tidy up the menu by sticking the programs in a submenu.

You can add a shortcut to a "Run Program" element by selecting it in the dummy menu and clicking the "Capture" button then pressing the key/keystroke you want to bind to that program.

Enlightenment DR16

Emerge the e16keyedit package. Then run 'e16keyedit' inside of enlightenment. Create a new keybinding, and press the 'Change' button to record a keystroke. Just press your new multimedia key and bind it to whatever action you'd like (use the 'Run' action to bind it to a command like aumix). Remember to press the 'Save' button when you're done.

Ion 3

Copy /etc/X11/ion3/cfg_bindings.lua to ~/.ion3/cfg_bindings.lua (if you did not do this already) and edit it. By using kpress(KEY, ACTION) you can bind actions to multimedia keys:

File: ~/.ion3/cfg_bindings.lua
   (...)
   bdoc("Mute/Unmute Sound."),
   kpress("AnyModifier+XF86AudioMute", "ioncore.exec_on(_, 'amixer sset Master toggle')"),
   bdoc("Increase Volume."),
   kpress("AnyModifier+XF86AudioRaiseVolume", "ioncore.exec_on(_, 'amixer sset Master 3%+')"),
   bdoc("Decrease Volume."),
   kpress("AnyModifier+XF86AudioLowerVolume", "ioncore.exec_on(_, 'amixer sset Master 3%-')"),
   (...)

FVWM and FVWM-Crystal

Add a binding in your configuration. FVWM-Crystal users can find a description of the modifiers used by Crystal in /usr/share/fvwm-crystal/fvwm/components/functions/Keyboard-Modifiers

Example for Crystal, I use the Aumix mixer here. For a system wide configuration, modify the file /usr/share/fvwm-crystal/fvwm/components/functions/Mixer-aumix, otherwise copy it in ~/.fvwm-crystal/components/functions and add:

File: ~/.fvwm-crystal/components/functions/Mixer-aumix
   (...)
   Key XF86AudioLowerVolume A $[Mod0] Mixer-Volume-Down
   Key XF86AudioRaiseVolume A $[Mod0] Mixer-Volume-Up
   (...)

Another example with FVWM functions, parameters, external command and key modifiers:

File: ~/.fvwm-crystal/components/functions/Music-myplayer
   (...)
   # Same key with modifiers and call to an external program
   Key XF86AudioMute A $[Mod0] Exec exec alsaplayer --volume 0
   key XF86AudioMute A C Exec exec alsaplayer --volume 1
   (...)
   # Another key with modifiers
   # + FVWM function
   key XF86AudioPlay A $[Mod0] Music-PlayPause
   key XF86AudioPlay A C Music-Pause
   # + FVWM function with parameter
   key XF86AudioPlay A $[Mod1] Music-Speed normal
   (...)

Alternative: lineakd or keyTouch

If you're looking for a possibly easier way to bring your multimedia keys to life, you might want to look at "lineakd" or keyTouch (http://keytouch.sf.net/). Lineak is available via portage (see http://lineak.sourceforge.net/ for details).

Sample: eMachines m68xx

If you own an eMachines m68xx notebook and want to jump right to using the keys, you can use the following to setup the keys. NB: These were created on an m6809, but I assume they're the same for the other m68xx models, if you have access to one of the other models and can confirm/deny this, please update this page.

First, we update the the keysyms. On an x86_64 system the file we want is /usr/lib64/X11/xkb/symbols/inet. Insert the following code:

File: /usr/lib64/X11/xkb/symbols/inet
 // eMachines

 partial alphanumeric_keys
 xkb_symbols "emachines" {
     name[Group1]= "Laptop/notebook eMachines m68xx";

     key <I2E> {       [ XF86AudioLowerVolume  ]       };
     key <I6D> {       [ XF86AudioMedia        ]       };
     key <I30> {       [ XF86AudioRaiseVolume  ]       };
     key <I20> {       [ XF86AudioMute ]       };
     key <I6C> {       [ XF86Mail      ]       };
     key <I32> {       [ XF86iTouch    ]       };
     key <I65> {       [ XF86Search    ]       };
     key <I5F> {       [ XF86Sleep     ]       };
     key <I22> {       [ XF86AudioPlay, XF86AudioPause ]       };
     key <I24> {       [ XF86AudioStop ]       };
     key <I10> {       [ XF86AudioPrev ]       };
     key <I19> {       [ XF86AudioNext ]       };
     key <KP0> {       [ KP_0  ]       };
     key <KP1> {       [ KP_1  ]       };
     key <KP2> {       [ KP_2  ]       };
     key <KP3> {       [ KP_3  ]       };
     key <KP4> {       [ KP_4  ]       };
     key <KP5> {       [ KP_5  ]       };
     key <KP6> {       [ KP_6  ]       };
     key <KP7> {       [ KP_7  ]       };
     key <KP8> {       [ KP_8  ]       };
     key <KP9> {       [ KP_9  ]       };
     key <KPDL>        {       [ KP_Decimal    ]       };
     key <KPAD>        {       [ KP_Add        ]       };
     key <KPSU>        {       [ KP_Subtract   ]       };
     key <KPMU>        {       [ KP_Multiply   ]       };
     key <KPDV>        {       [ KP_Divide     ]       };
 };
 

Now, we add the required references to this keyboard layout to X11/kxb/rules/(xorg

In the xorg file we add it to the list of $inetkbds like so:


File: /usr/lib64/X11/xkb/rules/xorg
 ! $inetkbds = airkey acpi scorpius azonaRF2300 \
              brother \
              btc5113rf btc5126t btc9000 btc9000a btc9001ah btc5090\
              cherryblue cherrybluea cherryblueb \
              chicony chicony9885 \
              compaqeak8 compaqik7 compaqik13 compaqik18 armada presario ipaq \
              dell inspiron dtk2000 \
              dexxa diamond genius geniuscomfy2 \
              emachines ennyah_dkb1008 \
              hpi6 hp2501 hp2505 hp5181 hpxe3gc hpxe3gf hpxe4xxx hpzt11xx \
              hp500fa hp5xx hp5185 \
              honeywell_euroboard \
              rapidaccess rapidaccess2 rapidaccess2a \
              ltcd logiaccess logicdp logicdpa logicink logiciink \
              logiinkse logiinkseusb logiik itouch \
              mx1998 mx2500 mx2750 \
              microsoftinet microsoftpro microsoftprooem microsoftprose \
              microsoftoffice microsoftmult \
              oretec \
              propeller \
              qtronix \
              samsung4500 samsung4510 \
              sk1300 sk2500 sk6200 sk7100 \
              sven symplon toshiba_s3000 trust trustda yahoo
 

In xorg.lst we add one line among the large list of models.


File: /usr/lib64/X11/xkb/rules/xorg.lst
 ...
 emachines     Laptop/notebook eMachines m68xx
 ...
 

And finally in xorg.xml we give it a description, which can be localized.


File: /usr/lib64/X11/xkb/rules/xorg.xml
    ...
    <model>
      <configItem>
        <name>emachines</name>
        <description>Laptop/notebook eMachines m68xx</description>
      </configItem>
    </model>
    ...
 

Now, after all that, restart your X server and there's a fresh new m68xx keyboard waiting to be selected. In KDE this can be selected easily by opening the Keyboard Layout Control Module and choosing the newly added "Laptop/notebook eMachines m68xx" from the Keyboard Model list. Any of the specials keys can then be bound as shortcuts the way you configure any other shortcut.

Since this is at the X server level, and system wide, it should be accessible to all users in any window manager.

Getting bizzare keyboards working

I have an HP keyboard that has a volume wheel. Unfortunately, this and half of the other buttons don't generate X keyboard events, so I wrote a perl script to take care of those keys. It's a bit of a pain to use, but it will get ANY keys or buttons that the keyboard sends working, by going to the low level evdev interface.

In the kernel, enable the "Event interface" driver (evdev module) to get kernel support.

Then, grab the photkeys script (Description: http://thequux.com/modules/zmagazine/article.php?articleid=2 Download: http://thequux.com/modules/wmpdownloads/), and follow the instructions there to set it up.


Code: You should run this script like this
gus alexg # photkeys /dev/input/event1
Unrecognized event: '4:4:28'. Define it in /usr/bin/photkeys
...
Unrecognized event: '4:4:139'. Define it in /usr/bin/photkeys

For me when I press buttons something appears in /dev/input/event1, may be in your system device file would be different.

... Or check one of this alternatives:

Command Line Functions to Control Common Applications

Many applications have methods to control them from command line. These are perfect for creating shortcuts to use with multimedia keys.

xmms

xmms has some straightforward command line switches. You can see more by executing this command in a terminal:

$ man xmms


Code: xmms command line switches from the xmms manpage
xmms --rew        # Skip backwards in playlist.
xmms --stop       # Stop current song.
xmms --play-pause # Pause if playing, play otherwise.
xmms --fwd        # Skip forward in playlist.

Also, xmms has a plugin in portage called : xmms-itouch. It allows you to configure your media keys with ease.

Note: Sometimes itouch incorrectly detects keys (or the keyboard reports them wrongly. In my case it set the backspace key (22) to start calc so i couldn't then use backspace while xmms is running. All the media keys should have relatively high values ~120+.


Note: This works the same for Audacious. Just replace any 'xmms' with 'audacious'.

Rhythmbox

Like xmms, Rhythmbox can be controlled using the command line:

Code: rhythmbox-client command line switches
rhythmbox-client --previous   # Skip backwards in playlist
rhythmbox-client --next       # Skip forward in playlist
rhythmbox-client --play-pause # Pause if playing, play otherwise
rhythmbox-client --pause      # Pause

amarok

Code: amarok command line switches from "dcop amarok player" (v. 1.4.4)
QCStringList interfaces()
QCStringList functions()
QString version()
bool dynamicModeStatus()
bool equalizerEnabled()
bool osdEnabled()
bool isPlaying()
bool randomModeStatus()
bool repeatPlaylistStatus()
bool repeatTrackStatus()
int getVolume()
int sampleRate()
int score()
int rating()
int status()
int trackCurrentTime()
int trackCurrentTimeMs()
int trackPlayCounter()
int trackTotalTime()
QString album()
QString artist()
QString bitrate()
QString comment()
QString coverImage()
QString currentTime()
QString encodedURL()
QString engine()
QString genre()
QString lyrics()
QString lyricsByPath(QString path)
QString lastfmStation()
QString nowPlaying()
QString path()
QString setContextStyle(QString)
QString title()
QString totalTime()
QString track()
QString type()
QString year()
void configEqualizer()
void enableOSD(bool enable)
void enableRandomMode(bool enable)
void enableRepeatPlaylist(bool enable)
void enableRepeatTrack(bool enable)
void mediaDeviceMount()
void mediaDeviceUmount()
void mute()
void next()
void pause()
void play()
void playPause()
void prev()
void queueForTransfer(KURL url)
void seek(int s)
void seekRelative(int s)
void setEqualizer(int,int,int,int,int,int,int,int,int,int,int)
void setEqualizerEnabled(bool active)
void setEqualizerPreset(QString name)
void setLyricsByPath(QString url,QString lyrics)
void setBpm(float bpm)
void setBpmByPath(QString url,float bpm)
void setScore(int score)
void setScoreByPath(QString url,int score)
void setRating(int rating)
void setRatingByPath(QString url,int rating)
void setVolume(int volume)
void setVolumeRelative(int ticks)
void showBrowser(QString browser)
void showOSD()
void stop()
void transferDeviceFiles()
void volumeDown()
void volumeUp()
void transferCliArgs(QStringList args)

Quod Libet

Code: Quod Libet command line switches from "quodlibet --help"
 quodlibet --previous   # Skip backwards in playlist
 quodlibet --play       # Start playing current playlist
 quodlibet --play-pause # Play if stopped, pause if playing
 quodlibet --pause      # Pause playback
 quodlibet --next       # Skip forwards in playlis

MPD/MPC

If you use MPD your client may already support some keysyms. For instance gmpc correctly recognises XF86AudioNext, XF86AudioPrev, XF86AudioStop, and XF86AudioPlay.

If you do not use gmpc, or do not want to leave gmpc running then you may want to bind these keys to short cuts to the command line MPD client, mpc. first you must install mpc by executing:

$ emerge mpc

The mpc command line switches are:


Code: mpc switches from "mpc --help"
mpc next     # Play the next song in the current playlist
mpc prev     # Play the previous song in the current playlist
mpc toggle   # Toggles Play/Pause, plays if stopped
mpc stop     # Stop the currently playing playlists

ALSA

alsa can be controlled using amixer. The following commands will adjust the PCM levels of your ALSA soundcard.


Code: Controling PCM levels with amixer
amixer sset PCM 2+       # This will increase the PCM hardware volume value by 2
amixer sset PCM 2-       # This will decrease the PCM hardware volume value by 2
amixer sset PCM toggle   # This will toggle the PCM between muted and unmuted states

Banshee player

Code: Banshee command line switches from "banshee --help"
Usage: banshee [ options ... ]
       where options include:
...
  --show              Show window
  --hide              Hide window
  --next              Play next song
  --previous          Play previous song
  --toggle-playing    Toggle playing of current song
  --play              Play current song
  --pause             Pause current song
  --shutdown          Shutdown Banshee
...
Personal tools