[SGVLUG] Remapping keys in X? Howtos? Leads?

Terry Hancock hancock at anansispaceworks.com
Wed Jun 28 12:45:33 PDT 2006


I'm getting tired of copying and pasting certain unicode characters in
X applications, and I'm starting to wonder if I could just re-configure my
keyboard to generate them at a keystroke.

E.g. it'd be nice if I could type "typographer's left single quote" (‘)
by hitting 'Alt+`' (Alt+Backtick) for example.

And so on.  I have about a dozen characters I need to type frequently
that aren't in the standard layout.

I figure something like this must happen when people define new 
language-bindings
for keyboards, but I have a specific set of characters I want to bind, 
and I don't
really want to change my usual USA keyboard bindings (beyond the few tweaks
I want, I mean).

I also want to get Japanese Kanji input working for all my apps, but (I 
think)
that's a separate problem (and I found a HOWTO for exactly that part).

It'd also be kind of cool to find a way to switch keyboard-mappings 
on-the-fly,
like I can within Yudit (but at the X or KDE level, so it would work for all
(or most) of my apps).

I've been looking for the right way to tackle this, but I've found 
several leads
with Google, and I'm not sure which to follow up on:

xmodmap:
    Seems to allow remapping the keyboard, but I'm not sure if it can handle
    generic unicode substitutions (mostly for things like swapping 'delete'
    and 'backspace'?).

KDE: Control Center --> Regional & Accessibility --> Keyboard Layout
    Lets me change layouts, but I don't see how to create one.  Mentions
    'xkb', but I haven't found that.

Xinput
    I know that the Kanji server grabs the keyboard input and potentially
    takes over when it's called for, but I don't know if this is related 
to my
    goal here or not.

Also, I may well have missed something.  I find that localizing queries
to 'X' is a real pain, since you get far more hits for 'OS X' and other 
instances
of 'X'.  It's just too common a string.  So you have to know a better 
keyword
to find what you're looking for, and I guess I don't.

I remember 'way back when' that the old Macs had an application that would
display the keyboard graphically with the currently-mapped characters for
each key.  If you could change the layout graphic to match different 
keyboards
and make each key remappable, that would be a really cool Linux app -- I
wonder if someone has tried that already. (?)

If they haven't, I wonder how I could write one.  I could write code with
simpletal, SVG, and PIL to display it if I knew how to get and set the
mappings themselves (in Python, of course, but if there's any way to do it,
I'm sure I get figure out how to get it into Python).

Anyway, HOWTO, RTFM (with reference), etc. would be just fine -- I just
need a better lead to follow.

Thanks,
Terry

-- 
Terry Hancock (hancock at AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com




More information about the SGVLUG mailing list