Macbook Fn hotkeys with DWM
Every since I started using DWM (I suspect I will post about this later), I’ve been looking for ways to minimize dependence on external programs, such as dmenu or conky. Getting rid of pommed is another thing, because I don’t need many of the functionalities that pommed have. All I need is to map a couple of function keys to useful applications. Here I will just give an example on how to map the previous, next, and play/pause button on macbooks (F7, F9, and F8 respectively). 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 } }, } |
Using this method, I can now use function keys to brighten/darken LCD screen, control MPD, turn volume up/down, and eject cd’s!

Nice. But i prefer to use mpc here instead of ncmpcpp. Its more straight and fast solution.
I had been looking for something like this for a while back when I was using awesome. I converted over to dwm, and now I’ll probably get around to implementing it. Thanks for the (mini) how-to!