You are not logged in.

#1 2009-01-04 07:47:27

gregn
Member
Registered: 2008-12-31
Posts: 5

xmonad & Logitech G15 (and possibly other) Media Keys

Just decided to share this one quickly...I didn't find it elsewhere on the forums and I know a lot of people around here are into the tiling WMs.  Basically, with the Logitech G15 keyboard, and possibly other keyboards, the media keys are able to be used without using anything extra such as xbindkeys.  In order to bind keys, you just need to get the keysym from xev.  It's very simple, just run xev, hover the mouse inside of the black box, and press your media keys.  For ease of copy/paste into your xmonad config you can write the output to a file (xev > keysyms).  Each key pressed (as well as mouse movements and other events) will have output like so:

KeyPress event, serial 29, synthetic NO, window 0x2000001,
    root 0x13b, subw 0x2000002, time 93967351, (23,51), root:(1234,739),
    state 0x0, keycode 172 (keysym 0x1008ff14, XF86AudioPlay), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

As you can see above, the keysym for the XF86AudioPlay button is 0x1008ff14.  Once you have all of the keysyms, you can enter them into your xmonad config in the keys section like so:

    -- XF86AudioNext
    , ((0 , 0x1008ff17), spawn "ncmpcpp next")
    -- XF86AudioPrev
    , ((0 , 0x1008ff16), spawn "ncmpcpp prev")
    -- XF86AudioStop
    , ((0 , 0x1008ff15), spawn "ncmpcpp stop")
    -- XF86AudioPlay
    , ((0 , 0x1008ff14), spawn "ncmpcpp toggle")

Obviously if you're not using ncmpcpp, you'll need to find out what the command line options for your music player of choice is and enter them in place of the commands I'm using.  Well, that's about it.  You can use this method to bind any key you might need.  Enjoy!

Greg Newman
mjuad on Freenode #archlinux

Offline

#2 2009-01-04 11:35:54

andre.ramaciotti
Member
From: Brazil
Registered: 2007-04-06
Posts: 649

Re: xmonad & Logitech G15 (and possibly other) Media Keys

Very good. There's a Tips and Tricks section on the Xmonad article in our Wiki, you should post it there. smile


(lambda ())

Offline

Board footer

Powered by FluxBB