You are not logged in.
Pages: 1
Hi,
I have a strange problem with xmodmap. In my startup scripts, I run "xmodmap /home/.../.xmodmaprc" before starting my window manager, xmonad. My .xmodmaprc file looks like this (mapping CapsLock to Control_R):
clear lock
keycode 66 = Control_R
add control = Control_R
However, this messes up my right Alt-button, making it impossible to write for example @-tokens. If run xmodmap -pm I get the following output:
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock
control Control_L (0x25), Control_R (0x69), Control_R (0x42)
mod1 Alt_L (0x40), ISO_Level3_Shift (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
The strange thing is that ISO_Level3_Shift (which my right Alt key is mapped to) appears in mod1. Because if I don't run xmodmap on startup, xmodmap -pm returns the following:
xmodmap: up to 2 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), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
Finally, if I run "xmodmap ~/.xmodmaprc from a terminal after I have started my window manager (and don't run it from the startup script), then I get the correct mappings, and my keys work as expected:
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock
control Control_L (0x25), Control_R (0x69), Control_R (0x42)
mod1 Alt_L (0x40), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
So the question is why do xmodmap behave differently depending on when it is executed? I have tried letting xmonad run xmodmap when it starts, but it also gives the incorrect mappings. Only if I run xmodmap from a terminal, it behaves correctly.
Has anyone seen this behaviour before? Or do someone have a suggestion about what I could try?
Offline
that's very odd behavior. i can't tell you why but i can give you a workaround:
# .xinitrc
(sleep 3 && xmodmap $HOME/.xmodmaprc) &
this should mimic you starting X, waiting 3 seconds (at which time your window manager should be loaded?), then running the command yourself which you say, works as you need.
let me know how it turns out.
Last edited by brisbin33 (2009-04-02 18:42:19)
//github/
Offline
It did help, although I had to increase the sleep time to 8 seconds. This is strange. Could it maybe have something with evdev/hal autodetection of the keyboard to do? Maybe xmodmap is executed before the keyboard is intialized?
Offline
it's got to be some conflict between X setting the keymap and xmodmap doing it's thing. do you have any kbd or keymap options in your xorg.conf? i used to start xmodmap via .xinit (w/o the sleep part) and it worked fine. i've since stopped doing that so i don't know. i've heard xmodmap is buggy in general anyway, maybe try xbindkeys?
//github/
Offline
I looked briefly at xbindkeys now, but to me it did seem as if it was only for mapping keys to commands? Or is it possible to change the X modifiers and key mappings with it?
Offline
I looked briefly at xbindkeys now, but to me it did seem as if it was only for mapping keys to commands? Or is it possible to change the X modifiers and key mappings with it?
you may be right, i've never used it. maybe someone else can jump in with a possible fix for you.
//github/
Offline
Pages: 1