You are not logged in.

#1 2010-06-09 08:13:14

eldamar
Member
From: Sweden
Registered: 2008-02-11
Posts: 104

DWM Custom keyboard buttons

My new keyboard has a bunch of custom buttons, i'd like to set them up to use with dwm, surf and tabbed.
How can i go about doing that?

This is the keyboard: http://www.microsoft.com/presspass/imag … WK3_lg.jpg

Offline

#2 2010-06-09 09:45:15

Meyithi
Member
From: Wirral, UK
Registered: 2009-06-21
Posts: 550
Website

Re: DWM Custom keyboard buttons

From my config.h (netbook)

/* commands */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[]  = { "sakura", NULL };
static const char *mutecmd[] = { "amixer", "-q", "sset", "Master", "toggle", NULL };
static const char *volupcmd[] = { "amixer", "-q", "sset", "Master", "3+", "unmute", NULL };
static const char *voldowncmd[] = { "amixer", "-q", "sset", "Master", "3-", "unmute", NULL };
static const char *brightupcmd[] = { "sudo", "/usr/local/sbin/backlight", "up", NULL };
static const char *brightdowncmd[] = { "sudo", "/usr/local/sbin/backlight", "down", NULL };
static const char *brightresetcmd[] = { "sudo", "/usr/local/sbin/backlight_reset", NULL };
static const char *touchpadcmd[] = { "/usr/local/bin/report_touchpad", NULL };
static const char *togglecpucmd[] = { "/usr/local/bin/cpufreq_toggle_osd", NULL };
static const char *togglewirelesscmd[] = { "sudo", "/usr/local/sbin/rftoggle", NULL };
static const char *killcmd[] = { "dwmquit", NULL };

static Key keys[] = {
    /* modifier                     key        function        argument */
        { 0,                       0x1008ff11,     spawn,         {.v = voldowncmd } },
        { 0,                       0x1008ff13,     spawn,         {.v = volupcmd } },
        { 0,                       0x1008ff12,     spawn,         {.v = mutecmd } },
        { 0,                       0x1008ff02,     spawn,         {.v = brightupcmd } },
        { 0,                       0x1008ff03,     spawn,         {.v = brightdowncmd } },
        { 0,                       0x1008ff41,     spawn,         {.v = brightresetcmd } },
        { 0,                       0x1008ffa9,     spawn,         {.v = touchpadcmd } },
        { 0,                       0x1008ff43,     spawn,         {.v = togglecpucmd } },
        { 0,                       0x1008ff95,     spawn,         {.v = togglewirelesscmd } },
    { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
    { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
    { 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_space,  setlayout,      {0} },
    { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    { MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    { MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    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,      spawn,           {.v = killcmd } },
};

Use xev to grab your keycodes.


The mind roams more freely in empty rooms.
dwm - colours - ncmpcpp - system
irc://irc.freenode.net:meyithi

Offline

#3 2010-06-09 10:29:10

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 456
Website

Re: DWM Custom keyboard buttons

You can also find the value (all the numbers after the "0x"), in your XKeysymDB.  That file is located here:
/usr/share/X11/XKeysymDB

Either method should work for you.


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

#4 2010-06-25 07:49:13

sdellysse
Member
Registered: 2009-12-15
Posts: 33

Re: DWM Custom keyboard buttons

@Meyithi: very useful information. thanks from the rest of us who had ever wondered!

Offline

Board footer

Powered by FluxBB