Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-07-2007, 06:18 AM   #1
LQ Newbie
Registered: Mar 2007
Posts: 1

Rep: Reputation: 0
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:
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:
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard layout config error 1 key wrong flebber Linux - General 4 12-10-2006 11:46 PM
changing keyboard layout in KDE/fluxbox tamor Linux - Newbie 1 04-09-2006 11:28 AM
keyboard layout (alternative key with mode_switch) super-momo Debian 2 02-12-2005 11:22 PM
choosing default keyboard layout in KDE or how to switch languages correctly sensovision Linux - General 3 05-23-2004 04:56 PM
Can't get my AltGr key to work with Norwegian keyboard layout orjanp Slackware 8 11-02-2003 08:53 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration