You are not logged in.

#1 2011-01-07 22:28:19

starfox5194
Member
Registered: 2010-06-12
Posts: 13

[Solved] Control MPD with Macbook Pro Play/Pause keys

I have mpd installed and working with ncmpcpp as the client.
I have a 17" C2D 9600GT Mac book Po.
I have pommed installed and working.
I'm using openbox, but I sometimes use awesome when I feel like it.

I think that's all you really need to know. This is probably really simple, but I'm not sure how to do it.

I would like the play/pause key to play/pause, skip forward key to skip forward and the skip back to skip back.

This is a little unrelated, but if any of you have a macbook pro you would know about the alternate to the F3 key. In mac It takes all of your active windows and tiles them across the screen so you can select what window. In awesome, to change the tiling mode you press Command(super)+space. Can I make that alternate F3 key mapped to this?

Thanks guys.

Last edited by starfox5194 (2011-01-10 22:14:48)

Offline

#2 2011-01-07 23:17:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Control MPD with Macbook Pro Play/Pause keys

Have you looked at the Wiki article on Extra Keys?

https://wiki.archlinux.org/index.php/Ex … board_Keys


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2011-01-08 04:20:13

starfox5194
Member
Registered: 2010-06-12
Posts: 13

Re: [Solved] Control MPD with Macbook Pro Play/Pause keys

Got it all set. Thanks dude. That link helped quite a bit.

Just in case anyone was wondering, I ended up figuring out what the keys were mapped to and assigned them to control mpc via the rc.xml for openbox.

So basically, copy and paste this into your rc.xml as long as your keys are mapped to XF86 correctly.

    <keybind key="XF86AudioPrev">
    <action name="Execute">
    <execute>mpc prev</execute>
    </action>
    </keybind>
    <keybind key="XF86AudioPlay">
    <action name="Execute">
    <execute>mpc toggle</execute>
    </action>
    </keybind>
    <keybind key="XF86AudioNext">
    <action name="Execute">
    <execute>mpc next</execute>
    </action>
    </keybind>

Last edited by starfox5194 (2011-01-10 22:14:34)

Offline

#4 2011-01-08 04:28:50

kcirick
Member
Registered: 2010-06-21
Posts: 364

Re: [Solved] Control MPD with Macbook Pro Play/Pause keys

Funny, I was just looking this up, but for DWM. I didn't want to use pommed because I was reading earlier forums that pommed may cause extra heat issues (it was a very old post - maybe solved now?). Anyway, to do this in DWM, you need to edit config.h as such:

#include <X11/XF86keysym.h>

static const char *mpdprev[] = {"ncmpcpp", "prev", NULL };
static const char *mpdtoggle[] = {"ncmpcpp", "toggle", NULL };
static const char *mpdnext[] = {"ncmpcpp", "next", NULL };

static Key keys[] = {
   ...
   { 0,     XF86XK_AudioPrev,          spawn, {.v = mpdprev } },     
   { 0,     XF86XK_AudioPlay,          spawn, {.v = mpdtoggle } },  
   { 0,     XF86XK_AudioNext,          spawn, {.v = mpdnext } }, 
}

I hope this helps some people!

Offline

#5 2011-01-08 04:29:53

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Control MPD with Macbook Pro Play/Pause keys

Good to hear.

Can you please prepend [Solved] to the thread title and wrap your code in \[code\] tags?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB