-   Linux - Newbie (
-   -   Centos 5.6, Gnome terminal, Xmodmap: remap multiple keystrokes? (

needsleep 05-23-2011 04:56 AM

Centos 5.6, Gnome terminal, Xmodmap: remap multiple keystrokes?
Several posts refer to Xmodmap as solution to remapping a key in Gnome terminal. Some of these posts refer to external documents. There is a manual of sorts for Xmodmap at

I wish to remap Control-y to "ESC-_". Running xev shows ESC is keycode 9, shift is keycode 50 and _ is keycode 20.

I have not run across how to map a set of keystrokes to a single key; only a single key to another single key.

Please tell me if this is possible. Could you give me an example? Is there a better program to use for this?


needsleep 05-23-2011 10:00 AM

It turns out the referenced external manual is the same as running "man xmodmap". This man page references X(7), but it does not exist. Is there a man page for X-Window?

needsleep 05-23-2011 10:43 AM

The information I sought regarding mapping a keystroke to a string (or a set of commands) is one of the functions in the utility loadkeys. man loadkeys will start you off. I intend to update thread with more specific instructions as I discover them.

needsleep 06-03-2011 12:07 AM

man keymaps is the driving document to read. The strings section occurs near the end of that document and is limited to assigning strings (ie, multiple commands) per keystroke to function keys alone. In addition to normal PC function keys (F keys, eg, F1, F2, F3 ... F12), it is possible to give non-keyboard imprinted function keys (F13 ... F2xx) a string value to generate upon pressing.

This was not my intention. Instead I wished to re-assign a specific key, CONTROL-y, to generate the multibyte string, "ESCAPE-_". This is a common unix shell command to retrieve the last word of the previous command and insert it at the cursor position of the line being currently crafted. I got in the habit of using CONTROL-y as I had remapped it using an early version of Reflections software, a unix terminal emulator. Reflections had a neat and easy GUI that allowed you to assign any keyboard key to any arbitrary string, any Windows PC command (like copy or paste), any function (using a built in command language).

I would like any information you have as to what I could do for a similar experience. Whether available as a GUI or using the shell. Frankly, I was surprised Gnome Terminal did not have the ability to remap keys, but then I'm new to Linux. Thanks,

needsleep 06-09-2011 09:02 AM

I was not able to remap a key as a script, which is what I finally decided I was trying to do. In fact, when that failed after all attempts, I tried to remap Control_y to an underscore. Although I can see from dumpkeys that was successful, I cannot get it to print when Control_y is pressed. Nothing prints!

On another search for keyboard mapping, I ran into,
which says this needs to be done with c native library.

So now I need to learn how to run a c program in Linux.

All times are GMT -5. The time now is 09:36 AM.