You are not logged in.

#1 2014-11-18 03:47:59

inurl
Member
Registered: 2013-09-18
Posts: 19

dwm - how to assign a second Meta key

I'm using dwm and I'm trying to figure out how can I assign the Microsoft Menu key (or context menu key) as a second Meta key?

I usually use ALT as the meta key. #define MODKEY Mod1Mask, however, I'm not sure if I can use as well the MS key. Thanks

Offline

#2 2014-11-18 08:19:59

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: dwm - how to assign a second Meta key

Does it work if you add:

#define MOD2KEY Mod4Mask

To config.h and then use "MOD2KEY" in the "static key" bit?


Jin, Jîyan, Azadî

Offline

#3 2014-11-18 12:29:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: dwm - how to assign a second Meta key

Head_on_a_Stick, that'd be for the "Windows" key, not the menu key.

The menu key does not function as a modifier so it cannot be simply configured in dwm's config.h.  When a key is pressed dwm checks the key symbol sent from the x server, and the modifier mask of what modifiers were held while the key was pressed.  The menu key will never be included in the modifier mask, it will only be treated as a key in the eky symbol varaible for the event.  That is unless you make the X server treat is as a modifier with Xmodmap.

You could map the menu key to one of the 'normal' mod keys, but others are are available that are generally not used (I'd suggest Mod5Mask).  Once mapped, you can just change your modkey in dwm's config.g to match.

EDIT: I just reread you initial post - you say you want to use the menu key "as well".  Do you mean you'd like to switch between them, or have them both do the same thing?  If you want to switch, use Mod5 as suggested above.  If you want them to do the same thing, simply use Xmodmap to make the menu key a Mod1 key, then don't do anything to your config.h.

Last edited by Trilby (2014-11-18 12:31:06)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2014-11-19 01:15:06

inurl
Member
Registered: 2013-09-18
Posts: 19

Re: dwm - how to assign a second Meta key

Thanks for your reply. I was able to do the following:

xmodmap -e "remove mod4 = Super_L"
xmodmap -e "add mod1 = Super_L"

However, adding these two commands to xinitrc won't stick. Seems this is because when X.org starts, it runs the xkbcomp program, which overwrites what was set with xmodmap, though, I'm not sure.

Any ideas?

Last edited by inurl (2014-11-19 01:16:07)

Offline

Board footer

Powered by FluxBB