[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to use stateful keys to switch keyboard layouts? (was: utilizing the Scroll key)

On Sun, Mar 20, 2011 at 03:38:58PM +0000, Camaleón wrote:
> On Sun, 20 Mar 2011 14:58:33 +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.
> Last time I checked, under an X environment the "scroll lock" key is 
> disabled (you can toggle the light on/off if you go to a tty, though).

Since xev recognizes it just fine as Scroll_Lock, this key doesn´t
seem to be disabled. That it doesn´t do anything makes it a good
choice for giving it a custum function :)

> lock one). I think the comma or period is written based on the keyboard 
> layout map which uses different decimal mark separators,

Yes --- in my case, the default would be to have a comma on the
Del-key of the numpad. I´ve changed it in my ~/.Xmodmap to a period
because I need the period much more often than a comma.

Now a fixed setting has turned out to be inconvenient because there
are cases where I need a period on this key and others where I need a
comma. To make things worse, there´s also buggy software ignoring the
fact that this key yields a period instead of a comma.

> so I guess that switching between two of them (one that uses the
> period and other that uses the comma) you could get the same
> behaviour although having to swap the complete keyboard layout seems
> a bit overwhelming :-?

It won´t take swapping the whole keyboard layout, you can switch keys
individually. The problem is to make the scroll key do that ...

The idea of keys having states isn´t at all new to the system. Just
think of the (obsolete) Caps_Lock (wich is Ctrl with my layout), and
of the Num_Lock key.

Scroll_Lock by itself is a key that does have a state, same as
Num_Lock. Where´s/what´s the mechnism behind keys that have states?
Can´t I use that mechnism to change what a single key does? Num_Lock,
for example, does it for a number of keys.

Now think of people who type in different languages and need very
different keyboard layouts for that. Their typing might be a little
easier if they could switch layouts just by pressing Scroll_Lock, and
they could even see from the LED on their keyboard which layout is
currently active. They could easily have four layouts with LED
indication, utilizing Scroll_Lock and Caps_Lock to switch --- more
when you include Num_Lock. I´d be suprised if I was the first one to
come up with this idea ...

Reply to: