You are not logged in.
hello fellow archers!
my window manager is openbox and i use xmodmap to swap caps lock and escape keys with the following configuration file:
~/.keyswap
remove Lock = Caps_Lock
remove Control = Escape
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
add Control = Escape
and now comes the wierd part: when i run "xmodmap ~/.keyswap" manually from terminal
or using gmrun it works as expected and escape key toggles the caps lock led on the keyboard. but if i put the same command in my
autostart.sh or in .xinitrc the keys are swapped but caps lock key still toggles the caps lock led on the keyboard.
i've tried everything i found in the various forums and on google but this behaviour still persists. while it's
not a showstopper it is an annoyance. could this be a some kind of a bug or i missed something?
thank you in advance for your input.
best regards
Offline
No guarantees, but my .Xmodmap begins with
clear Lock
Offline
just tried adding that. no effect
Offline
This is an unsolved problem for quite some time.
A similar xmodmap does not work here neither whith .xinitrc nor openbox autostart.sh. It appears to be an X issue.
To know or not to know ...
... the questions remain forever.
Offline
I'm wondering whether this is caused by a race condition. Does invoking xmodmap with something like this help?
( sleep 5; xmodmap ~/.keyswap ) &
Offline
It does not work here. I suspect that X either does not see the xmodmap change or simply resets it at startup. It might be a hal issue as well but I did not check this one.
I finally wrote a simple keyboard changer script and bound this to a shortcut key so it is a mere nuisance now. (And I can revert the mapping if I want to.)
To know or not to know ...
... the questions remain forever.
Offline
i have already tried delaying xmodmap starting. it had no effect.
now i noticed that the caps lock key, if i try to autostart xmodmap, functions as both escape and caps lock, but xev reports that only escape was pressed.
and it does that only if i try to autostart xmodmap. if i launch it manually everything is perfect.
Offline
I remember having similar problems. Now I do use in fact three separate definitions:
$ cat EscCL_swapped
! Swap caps lock and escape
remove lock = 0x42
keycode 0x9 = Caps_Lock
keycode 0x42 = Escape
add lock = Caps_Lock
$ cat EscCL_standard
! Original caps lock and escape
remove lock = 0x42
keycode 0x9 = Escape
keycode 0x42 = Caps_Lock
add lock = Caps_Lock
$ cat EscCL_toggle
! Toggle caps lock and escape key arrangements
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
Maybe it helps.
To know or not to know ...
... the questions remain forever.
Offline
i've tried your definitions and that wierd behaviour still persists. and i've also tried every method of keyboard configuration (xorg.conf, hal, every available driver) and still a no go. so it shouldn't be a keyboard driver or configuration fault.
now i have another question: do the system or xorg log keymap changes anywhere? if there's a log i might be able to find something of use there.
btw, in Xorg.log the only keyboard relevant lines are:
(**) Option "CoreKeyboard"
(**) Keyboard0: always reports core events
(**) Option "Protocol" "standard"
(**) Keyboard0: Protocol: standard
(**) Option "XkbRules" "base"
(**) Keyboard0: XkbRules: "base"
(**) Option "XkbModel" "pc105"
(**) Keyboard0: XkbModel: "pc105"
(**) Option "XkbLayout" "hr"
(**) Keyboard0: XkbLayout: "hr"
(**) Option "CustomKeycodes" "off"
(**) Keyboard0: CustomKeycodes disabled
Offline
Hey guys,
I've been having the same issue and ended up with a script with a while loop that is called from my startup script (autostart.sh under Openbox) that does the job. I put something along the lines of
while xmodmap | grep '^lock.*(0x42)' ; do
xmodmap ~/.keyswap
sleep 1
done
in a separate script called ~/Tools/keyswap, ran chmod +x on it, and put
~/Tools/keyswap &
in my autostart.sh. I found that you couldn't embed the loop inside autostart.sh directly and must execute the script in the background or Openbox would never start.
Of course, change the grep in the condition to match what you actually want to do with xmodmap.
Cheers.
Last edited by jichuan89 (2011-03-06 20:05:00)
Offline
jichuan89,
I have set it up exactly like you proposed but no remapping takes place on Openbox startup. If I manually run my equivalent to "~/Tools/keyswap", it's being remapped instantly. In the console I see that "keyswap" is indeed being executed on startup of Openbox.
Edit: "Fixed" it with this ugly .xinitrc entry: "(sleep 1 && xmodmap .Xmodmap && sleep 1 && xmodmap .Xmodmap && sleep 1 && xmodmap .Xmodmap) &" Running the command less often does not reliably work for me.
Last edited by Markus00000 (2011-04-07 18:26:11)
Offline