Remapping capslock from .Xmodmap does not work as intended #148
Comments
fcitx has an addon called "X Keyboard Integration" (if installed, at fcitx-config-gtk -> Addon -> X Keyboard Integration). There you can configure any custom xmodmap command and/or xmodmap script which fcitx will execute every time it is necessary to preserve any changes that might be set by running this commands. |
I was already using this. I just found a solution while writing this reply. The problem was that as one might have guessed after attentively reading xmodmap's manpage, Here is the output of
And this is what
The solution is to include the line |
Unfortunately, I have to re-open this issue. The problem persists, under the following conditions:
At this point, I see two things that need to be done:
|
First of all, following behaviour I discussed is based on 4.2.8.3. that cpu hog is kinds of expected, you need to send a whole new key map to X server by using xmodmap. But you only use one layout right? did you have the us(altgr-intl) as the first input method in your fcitx settings? Fcitx will not apply xmodmap if it thinks layout doesn't need change. And could your configuration be done by 'setxkbmap' command? fcitx's xkb integration is kinds of a limited version of setxkbkmap, which only do the layout change (and keep all xkb option as it is). For your bluetooth keyboard case, the new keyboard event from X server is so confusing, that I've never figure out a way to listen to real hardware keyboard plugin event. If you suspend, and resume, x sever send new keyboard event, but it doesn't reset the keymap modified by xmodmap. If you execute xkbcomp (or do whatever its code does), will also trigger new keyboard event in X server, I examine all the fields in the event from xserver and I don't find a way to distinguish between them. So I never know when it will comes to a consistent state, the newly pluged keyboard doesn't affect by the xmodmap which is expected, no matter xmodmap is executed by fcitx or not. I could not implement a feature (named, apply xmodmap on new keyboard plugin) which is not supported by display server. You need to suffer this situation by yourself. While, for your specific problem, it's easy to make fcitx not to touch any your keyboard settings. Disable the xkb addon, by configuration tool (permenant) or command line option fcitx --disable fcitx-xkb (temporarily). And xmodmap or similar will go away in wayland world, I do consider xmodmap as a depracated thing. To summarize, fcitx xmodmap integration has its limitation, which is not resolvable for your work case. |
On my ubuntu 16.04,gnome desktop ,I use setxkbmap -o 'caps:swapescape' to swap escape key with caps key. 2..use the config panel to disable(unchecked) the x keyboard integration addon 3.configure x keyboard integration addon ,add the file full file path to the 'apply this custom xmodmap script after layout changes',which file contains expression something like this: 'keycode 66 = ESCAPE',which works fine for xmodmap. 4.unchecked the option 'allow to override the system x keyboard setting' it is really a pain when I using vim. |
On your ~/.xinitrc, the first let fcitx run, the after let xmodmap read ~/.Xmodmap. Something like this, Adjust sleep 2 seconds with your need. In my case 2 does the job. |
Hi,
I'm using a slightly customized variant of the US-international keyboard layout where I remapped the capslock key to act as a second escape key. Before using fcitx, I did this with the following shell script calling xkbcomp and xmodmap:
Now, for fcitx I generated a
.Xmodmap
usingxmodmap -pke
. In the xmodmap, the entries for the escape and capslock keys both correctly only contain escape, not capslock mappings. After starting fcitx, however, the capslock key will both emit an escape keycode and capslock the keyboard (which is extremely annoying). I have tracked this down to the fact that just xkbcomp is not enough to remap the caplock key, the xkbcomp script above is needed for that. Executing the script above solves the problem until a new keyboard is added to the system, fcitx is restarted or the fcitx input method is changed.How am I supposed to do this remapping properly? As far as I can tell, the
.Xmodmap
file is a poor hack and a proper solution would require a custom xkb script to be loaded, though I do not know how to do that with fcitx. Any comments are appreciated.The text was updated successfully, but these errors were encountered: