duplicate edit keys to C-some_letter

Jonas Bernoulli jonas at artavatar.org
Mon Oct 24 06:07:53 PDT 2005


 Hello

At first it might seam a bit strange but i would like some alphabetic keys combined with Control to produce the same keysyms as the edit keys. For example C-j shouldnt be passed on as Control+j but as Left.

First a few words why i want to do this (in the hope that some experienced person might catch on, and help out):

I dont like the default keybindings of gnu apps like emacs and bash (not to speak of those of firefox and alike). As we all know, traditionally commands are bound to keys depending on some relationship between the command name ([_B_]ackward-char is bound to C-[_B_]...).

I find it more usfull to have commands with related meanings to be physically grouped on the keyboard. this way its not only easier to remember the locations of commands but its also quicker to reach the keys.

here is a overview how what i call "movment related commands" should be arranged on the keyboard for emacs. similar mapping would aplay for other applications:

C-i    beginning-of-line
C-o    end-of-line
C-j    backward-char
C-k    previous-line
C-l    next-line
C-;    forward-char
C-m    backward-delete-char-untabify
C-,    backward-kill-line
C-.    kill-line
C-/    delete-char

M-i    beginning-of-buffer
M-o    end-of-buffer
M-j    backward-word
M-k    scroll-down
M-l    scroll-up
M-;    forward-word
M-m    backward-kill-word
M-,    kill-region
M-.    kill-ring-save
M-/    kill-word

the "easiest" (ha!!) way to do this is to change keybindings for each application. i did this but this approach has some problems and also some disadvantage to the solution i now have in mind.

one major problem was that C-m is Return and C-i is Tab, both keys that i really need for the arrangment of commands i want. i was able to work around this in emacs by remapping Return and Tab to some function keys but i was not able to do so in bash/xterm (let me know if you know how to do this).

another problem i would have to adjust the command-binding of many many applications. some of these like firefox dont even allow to set C-j to do the same as the left arrow.

so far i havent used the edit and arrow keys as i find it unconfinent to move my right hand between the lettersection and the keys to the right. but i have noticed that the command (what a surprise after all the have quite definite names) bound to the arrow and edit keys behave the same not only for gnu apps (emacs, bash) but also gui applications (firefox).

i therefor propose that the C-some_letter_right_fingers produces some_edit/arrow_key. doing this allows to work around the C-m/Return problem and also to have consistant keybehaviour for virtually all application, which wouldnt be possible as completely in some other way.

therefor eighter the kernel-keymaps or xkb for X have to do the job of converting. it was quite easy doing this without x in files in /usr/share/keymap but i was not able to do so in xkb.

Here is the remapping that needs to be done (only for control, i leave out Meta since i havent even looked into that yet):

-           Home    End       -
Left      Up        Down    Right
backspace  -            -      delete

the problem is that pressing Control and a letter produces (as it normally should) the output Control and the edit key bound to level3 for the alphabetic key pressed. but Control should be consumed and only the keysym of the edit key should be passed along.

i have tried this for a few days now and am completely lost. i would very much apprechiate it if some one could tell me how to keep Control from being send. i doubt that i will be able to do this on my own by now. i would also be interested to know what you think of the idee in general.

in a file in /etc/X11/xkb/symbols i have keys defined like this:

key <AC07> { type="THREE_CONTROL", symbols[Group1]= [ j, J, Left ] };

they use my type that looks like this:

   type "THREE_CONTROL" {
       modifiers = Shift+Control;
       map[None] = Level1;
       map[Shift] = Level2;
       map[Control] = Level3;
       level_name[Level1] = "Base";
       level_name[Level2] = "Shift";
       level_name[Level3] = "Edit";
   };

i hope that it is possible to add something to this definition to prevent Control from being send. but i have no idee if this is the correct location to do this and if it is even possible. i had a look at the xkb protocol specification, and it seams that it is possible to do this but i couldnt find out how.


thx for any help, suggestions and comments


Jonas Bernoulli



More information about the xorg mailing list