You are not logged in.

#1 2011-11-17 21:29:20

lightgreenpanda
Member
Registered: 2011-11-17
Posts: 11

dwm F-keys binding in config.h

I'm trying to bind the F-keys for few functions by declaring those keys like "XK_F1", but it doesn't work.
Though, the calling "q" and "w" keys like "XK_q" "XK_w" works normal (for the same function).
Maybe, the F-keys should called by different names, but I don't know how exactly and google doesn't help me either.
Any help appreciated.

Last edited by lightgreenpanda (2011-11-17 21:33:37)

Offline

#2 2011-11-17 22:13:59

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

Re: dwm F-keys binding in config.h

Hi,

I'm using the following in my config.h and it works fine:

    { MODKEY,                       XK_F12,    spawn,          {.v = scratchpadcmd} },
    { MODKEY|ShiftMask,             XK_F12,    spawn,          {.v = scratchpadtiledcmd} },
    { MODKEY,                       XK_F5,     spawn,          {.v = scratchpadcmd} },
    { MODKEY|ShiftMask,             XK_F5,     spawn,          {.v = scratchpadtiledcmd} },

Can you post your config.h with your attempts to bind the keys?

Offline

#3 2011-11-17 22:29:47

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: dwm F-keys binding in config.h

It works fine for me, so I don't know what your problem is I must confess...

        { MODKEY,                       XK_F1,     spawn,          {.v = termcmd } },
        { MODKEY,                       XK_F2,     spawn,          {.v = wwwcmd } },
        { MODKEY,                       XK_F12,    spawn,         {.v = haltcmd } },
        { MODKEY,                       XK_F11,    spawn,         {.v = rebootcmd } },
        { MODKEY,                       XK_Escape, killclient,    {0} },
        { 0,                                  0x1008ff13,spawn,        {.v = volupcmd } },
        { 0,                                  0x1008ff11,spawn,        {.v = voldowncmd } },
        { 0,                                  0x1008ff12,spawn,        {.v = volmutecmd } },

Please post me an example that dosen't work for you, and i'll test it out on my end ...

-- EDIT --

Forgot to refresh the page and so haden't seen knopwob allready providing help...

Last edited by mhertz (2011-11-18 00:08:38)

Offline

#4 2011-11-17 23:06:06

lightgreenpanda
Member
Registered: 2011-11-17
Posts: 11

Re: dwm F-keys binding in config.h

Sorry for this question, it was my silly fault. I forgot what I'm using alias in .bashrc "mpc" -> "ncmpcpp" and i was trying to call "mpc" instead of "ncmpcpp", meanwhile dwm-config didn't know about my aliases so no wonder why my config didn't work.
Anyway thanks for your replies, now all works right.

static const char *mpcnext[]   = { "ncmpcpp", "next", NULL };
static const char *mpcprev[]   = { "ncmpcpp", "prev", NULL };
static const char *mpctoogle[] = { "ncmpcpp", "toggle", NULL };
	{ 0,                       XK_F4,     spawn,          {.v = mpctoogle } },
	{ 0,                       XK_F6,     spawn,          {.v = mpcprev } },
	{ 0,                       XK_F7,     spawn,          {.v = mpcnext } },

Offline

#5 2012-07-02 01:31:37

sw2wolf
Member
From: China
Registered: 2009-06-08
Posts: 99
Website

Re: dwm F-keys binding in config.h

static const char *haltcmd[]  = { "sudo /sbin/shutdown -p now", NULL };
static const char *rebootcmd[]  = { "sudo /sbin/shutdown -r now", NULL };

static Key keys[] = {
    /* modifier                     key        function        argument */
    { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
    { MODKEY,                       XK_w,      spawn,          {.v = browsecmd } },
    { MODKEY,                       XK_F11,    spawn,          {.v = rebootcmd } },
    { MODKEY,                       XK_F12,    spawn,          {.v = haltcmd } },
...
};

Why donot XK_F11/XK_F12  work for me ?


e^(π⋅i) + 1 = 0

Offline

#6 2012-07-02 01:37:39

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

Re: dwm F-keys binding in config.h

Please use code tags: you can click on the BBCode at the bottom left of your text box to see examples…

Your keybinds don't work because you haven't formatted the commands correctly. Look at the mpc examples
in the post above and note how the quotation marks and commas are used to break up the commands.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB