This document describes how to get your multimedia keyboard keys working with Mesk.

To use this method you need the following:

  • DBus and Mesk >= 0.3.0
  • The xev program to determine the key-codes used by the individual multimedia keys.
  • xbindkeys to bind keycodes to actions
  1. The first thing you need to do is determine the key codes for each of the keys you want to bind to Mesk. The key code is a unique numeric value that your keyboard generates for each key. Run xev and press each of the keys you want to bind and note each key code.

Example: xev output when a play/pause key is pressed is 162 (Logitech keyboard):

    KeyPress event, serial 32, synthetic NO, window 0x3c00001,
        root 0x187, subw 0x3c00002, time 1223170513, (39,37), root:(46,63),
        state 0x10, keycode 162 (keysym 0x0, NoSymbol), same_screen YES,  
        XLookupString gives 0 bytes: 
        XmbLookupString gives 0 bytes: 
        XFilterEvent returns: False

    KeyRelease event, serial 32, synthetic NO, window 0x3c00001,
        root 0x187, subw 0x3c00002, time 1223170713, (39,37), root:(46,63), 
        state 0x10, keycode 162 (keysym 0x0, NoSymbol), same_screen YES,
        XLookupString gives 0 bytes: 
        XFilterEvent returns: False
  1. Using xbindkeys map each key to a call to a running Mesk process.

Example: ${HOME}/.xbindkeysrc:

    ### Mesk keybindings ###
    "mesk --play-pause"
        m:0x10 + c:162
    "mesk --prev"
        m:0x10 + c:144
    "mesk --next"
        m:0x10 + c:153
    "mesk --toggle-mute"
        m:0x10 + c:160
    "mesk --vol-down=0.05"
        m:0x10 + c:174
    "mesk --vol-up=0.05"
        m:0x10 + c:176

Note that in the above example the default profile is used, you can communicate with other Mesk processes by specifying a profile argument (-p/--profile).

  1. Run xbindkeys each time you start X. For example, ${HOME}/.xinitrc or add it to your Gnome/KDE startup programs.

Hopefully this is helpful to some, feel free to update the Wiki page with any experiences or suggestions.