Closed trans closed 12 years ago
Have a look here, this is where the friendly syntax gets turned into key bindings (which are registered on in X11 almost directly):
https://github.com/mixu/nwm/blob/master/nwm-user-sample.js#L168
which goes through a few calls and becomes a X11 call here : https://github.com/mixu/nwm/blob/master/src/nwm/nwm.c#L211
Basically you can more directly register a shortcut via:
nwm.addKey({ key: (X11 keysym int), modifier: (X11 modifier bitmask) }, callback);
Key names to ints lookup is from the XK array, which is defined here: https://github.com/mixu/nwm/blob/master/lib/keysymdef.js
You can find the X11 keysym corresponding to a key using xev
.
Only "shift" and "ctrl" are supported as modifiers by name, however, you could use the other modifiers (mod keys) listed in https://github.com/mixu/nwm/blob/master/lib/x.js
The bitmask is something like:
var mask = Xh.Mod4Mask|Xh.ShiftMask|Xh.ControlMask;
X11 doesn't have a fixed "alt" key modifier, it refers to modifier keys other than shift and ctrl as Mod1 ... Mod5 and those must be bound by the user. You can run xmodmap
to find out what your mod keys are (and google for configuration):
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
Closing this as "not a bug".
Thanks. It wasn't easy but I was able to work it out. To help I added:
(shortcut.modifier.indexOf('alt') > -1) && (modifier = modifier|Xh.Mod1Mask);
It doesn't limit it too just left alt, but it's good enough, at least for now.
Also, I added a wiki pages called "Launchers" with a section for "dmenu".
Hi, I am trying to redefine some of the short-cuts, and I can't get some of them to work.
First, I am trying to get dmenu to run. I added:
I tried a number of alternatives to
Menu
, includingslash
,backslash
andInsert
, but none worked.Another is trying to use
Alt_L
in place ofshift
for moving windows to other workspaces.I tried
alt_l
andAlt_L
. I'm thinking that maybe theevent.keysym
is changed by using alt? Or is it something more fundamental?