LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Key mapping reverts to default after changing keyboard layout in KDE (http://www.linuxquestions.org/questions/linux-general-1/key-mapping-reverts-to-default-after-changing-keyboard-layout-in-kde-535333/)

@milan 03-07-2007 07:18 AM

Key mapping reverts to default after changing keyboard layout in KDE
 
Hi. I'm using small keyboard (Media-Tech MILAN) which doesn't have right CTRL key, so I've decided to assign CTRL at two (because they are both small :)) other keys (Win-key and Menu-key) on the right half of the keyboard.

I've done this successfully with "xmodmap" program, by creating a file "~/.Xmodmap" with the following contents:
Code:

clear Control
keycode 116 = Control_R
keycode 117 = Control_R
add Control = Control_L Control_R

Besides english keyboard layout, I also use Serbian layout, and with above settings it worked well, with any keyboard layout, but only in Gnome.

In KDE I've had first to set manually a file-url in "~/.kde/Autostart", so command "xmodmap ~/.Xmodmap" would be executed automaticaly every time KDE start. And it worked until I've had to change keyboard layout to say, Serbian (another keyboard layout besides the english one, was added in Settings->Regional & Accesibility->Keyboard Layout) after which all keys that should act like CTRL "synonym" were reverted at their default state (Win-key was Win-key, not CTRL, and also Menu-key was Menu-key and not CTRL like ti was supposed to be), even when I after that, changed layout back to english.

With a little digging, I saw that the reason for this behaviour is because KDE always calls "setxkbmap" with every keyboard layout change, which reverts keys to their default mapping. But, even after layout change I cannot set intended mapping by calling "xmodmap ~/.Xmodmap" if directly before it was'nt called "setxkbmap" (with some options). Now, I've been trying to change change mapping of those two keys with "setxkbmap", although, I would'nt know what to do with it, since I cannot alter directly the way KDE calls that command on layout change, but nevertheless with no success. Commands "setxkbmap -option win:control", "setxkbmap -option win:ctrl", "setxkbmap -option control:win", "setxkbmap -option ctrl:win"... Have'nt gave any usefull result.

Temporarily I've made an extra button on the panel, which I have to press after I change keyboard layout (from English to Serbian or vice versa), and button itselfs executes a simple script:
Code:

setxkbmap;
xmodmap ~/.Xmodmap

This obviously is very impractical because I always need to press that button (with mouse) after I change layout. The possible alternative is to see how exactly "setxkbmap" program changes layouts, and then make two buttons (three actually in my case since Serbian language uses two different alphabets), but that is'nt much more practical then previous "solution", moreover, it may be more impractical then it.

In "Settings->Regional & Accessibility->Keyboard Layout->Xkb Options" is also set "Alt and Meta are on the Alt keys (default)" because without this even the right Alt key does'nt behave like expected, although I could probably solve this also with "xmodmap" command by adding the line "keycode 113 = Alt_R" in "~/.Xmodmap" file, at least until keyboard layout does'nt change.

So to put it simple, I'm interested does anyone knows how can I map CTRL on those two keys (Win-key and Menu-key), but which would be retained even after keyboard layout changes.


All times are GMT -5. The time now is 04:19 AM.