I've just switched from awesome to dwm, and in the process of migrating
my config from lua to the c header file I've encountered some trouble.

The first problem is I can't get my multimedia keys to function (volume
up/down/mute). I've searched through the mail archives and haven't
found a fix that works for me. In my config.h I've tried to use
XF86AudioRaiseVolume, XK_121 (that's the keycode), and the last thing I
could think of to try was 0x1008ff13 (keysym); but none work.

The next problem I've encountered was the same problem with the print
key. I've tried it's keycode, keysym, and XK_Print, but none of these
work either. I've added #include <X11/keysym.h> to dwm.c, but this
didn't help at all.

Has anyone else achived this sort of thing with just dwm without an
external program like xbindkeys?

I've attached my current config.h also.

Thanks for any help.
/* See LICENSE file for copyright and license details. */

/* appearance */
static const char font[]            = "-*-fixed-medium-r-*-*-12-*-*-*-*-*-iso8859-*";
static const char normbordercolor[] = "#4c4c4c";
static const char normbgcolor[]     = "#000000";
static const char normfgcolor[]     = "#c4c4c4";
static const char selbordercolor[]  = "#3579f8";
static const char selbgcolor[]      = "#1c1c1c";
static const char selfgcolor[]      = "#3579a8";
static unsigned int borderpx        = 1;        /* border pixel of windows */
static unsigned int snap            = 32;       /* snap pixel */
static Bool showbar                 = True;     /* False means no bar */
static Bool topbar                  = True;     /* False means bottom bar */
static Bool usegrab                 = False;    /* True means grabbing the X server during mouse-based resizals */
static Bool readin					= True;		/* False means not to read from stin */

/* tagging */
static const char tags[][MAXTAGLEN] = { "term", "web", "irc", "im", "media", "misc", };
static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */

static Rule rules[] = {
	/* class      instance    title       tags mask     isfloating */
	{ "Gimp",     NULL,       NULL,       0,            True },
	{ "Firefox",  NULL,      NULL,       1 << 4,		True },
};

/* layout(s) */
static float mfact      = 0.55; /* factor of master area size [0.05..0.95] */
static Bool resizehints = False; /* False means respect size hints in tiled resizals */

#include "bstack.c"
static Layout layouts[] = {
	/* symbol     arrange function */
	{ "[]=",	tile },    /* first entry is default */
	{ "><>",	NULL },    /* no layout function means floating behavior */
	{ "[M]",	monocle },
	{ "TTT",	bstack }
};

/* key definitions */
#define MODKEY Mod1Mask
#define SUPER  Mod4Mask
#define TAGKEYS(KEY,TAG) \
	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

/* commands */
static const char *termcmd[]  = { "xterm", NULL };
static const char *scrot[]  = { "scrot '%Y-%m-%d-%T_$wx$h_scrot.png' -e 'mv $f ~/media/pics/scrots/'", NULL };
static const char *firefox[]  = { "firefox", NULL };
static const char *pidgin[]  = { "pidgin", NULL };
static const char *gpodder[]  = { "gpodder", NULL };
static const char *vim[]  = { "xterm -name vim -e vim", NULL };
static const char *pcmanfm[]  = { "pcmanfm", NULL };
static const char *oowriter[]  = { "oowriter", NULL };
static const char *gimp[]  = { "gimp", NULL };
static const char *inkscape[]  = { "inkscape", NULL };
static const char *ripperx[]  = { "ripperx", NULL };
static const char *claws[]  = { "claws", NULL };
static const char *volup[]  = { "amixer -q Master 2+ toggle", NULL };
static const char *voldown[]  = { "amixer -q Master 2- toggle", NULL };
static const char *volmute[]  = { "amixer -q Master toggle", NULL };

static Key keys[] = {
	/* modifier                     key        function        argument */
	{ MODKEY,                       XK_b,      togglebar,      {0} },
	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
	{ MODKEY,                       XK_Return, zoom,           {0} },
	{ MODKEY,                       XK_Tab,    view,           {0} },
	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
	{ MODKEY,                       XK_q,      setlayout,      {.v = &layouts[3]} },
	{ MODKEY,                       XK_space,  setlayout,      {0} },
	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
	TAGKEYS(                        XK_1,                      0)
	TAGKEYS(                        XK_2,                      1)
	TAGKEYS(                        XK_3,                      2)
	TAGKEYS(                        XK_4,                      3)
	TAGKEYS(                        XK_5,                      4)
	TAGKEYS(                        XK_6,                      5)
	TAGKEYS(                        XK_7,                      6)
	TAGKEYS(                        XK_8,                      7)
	TAGKEYS(                        XK_9,                      8)
	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
	/* apps */
	{ SUPER,						XK_Return, spawn,          {.v = termcmd } },
	{ SUPER,						XK_i,	   spawn,		   {.v = firefox } },
	{ SUPER,						XK_p,	   spawn,		   {.v = pidgin } },
	{ SUPER,						XK_g,	   spawn,		   {.v = gpodder } },
	{ SUPER,						XK_v,	   spawn,		   {.v = vim } },
	{ SUPER,						XK_o,	   spawn,		   {.v = oowriter } },
	{ SUPER,						XK_r,	   spawn,		   {.v = ripperx } },
	{ SUPER|ShiftMask,				XK_p,	   spawn,		   {.v = pcmanfm } },
	{ SUPER|ShiftMask,				XK_g,	   spawn,		   {.v = gimp } },
	{ SUPER|ShiftMask,				XK_i,	   spawn,		   {.v = inkscape } },
	{ 0,							XK_Print,  spawn,		   {.v = scrot} },
	{ 0,							0x1008ff12,  spawn,		   {.v = volmute} },				   
	{ 0,							0x1008ff11,  spawn,		   {.v = voldown} },
	{ 0,							0x1008ff13,  spawn,		   {.v = volup} }
};

/* button definitions */
/* click can be a tag number (starting at 0),
 * ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
	/* click                event mask      button          function        argument */
	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
	{ ClkTagBar,            0,              Button1,        view,           {0} },
	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
};

Reply via email to