Re: utilizing the Scroll key
On Sun, Mar 20, 2011 at 02:58:33PM +0100, lee wrote:
> I would like to use the scroll key to switch the function of the Del
> key on the numpad so that pressing the Del key on the numpad either
> produces a comma (",") or a colon ("."), depending on the state of the
> Scroll key. There?s even a LED on the keyboard to display the state of
> the Scroll key, the LED doesn?t light when pressing the Scroll key.
> How would I do this?
You'll need some way of triggering execution on a keypress. Many window
managers provide this facility, but I don't know which one you use and I
haven't spent any time customizing any of the modern ones (the last one I
made any effort to customize was tvtwm, so sue me).
Once you figure out how to bind a key to executing something, you'll write
a script that will store its state somewhere (/tmp, most likely) and use
xmodmap (in the x11-xserver-utils package, man xmodmap for details) to
change the keysym the Del key produces. In fact, xmodmap can probably make
Scroll control that LED, though you might find that it interferes with
You will probably find xev (in the x11-utils package, man xev for details)
instructive in figuring out various keycodes and keysyms. You'll probably
also want to run the script at X login so you are in a known state when
things start up.
Note that this is a brute force mechanism. I don't know of any other
approach, however, and I'm confident it will do the job. Please don't ask
me for further details; the man pages and a bunch of experimentation are
all you need. I did similar trickery back in the 90s, but I'd have to do
the same reading and experimentation to figure out how to recreate it.