[Ilugc] Key Bindings

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Thu Sep 3 11:16:10 2009

On Thu, Sep 3, 2009 at 10:17 AM, Kapil Hari Paranjape<kapil@xxxxxxxxxxx> wrote:

string F1 = "\033[[ls -l\n"

This looks wrong. I think it should be
?string F1 = "ls -l\n"
The additional Esc+[+[ seems to be unneccesary.


Yes. I later tested it. I also wanted to say that many of my
steps were unnecessary. I was just playing it safe, that is all.

# echo 'string F1 = "ls -l\n" ' | loadkeys

would work too.

And so will

# loadkeys
string F1 = "ls -l\n"
 <Ctrl-D>

You don't have to dumpkeys and copy it back. Once again I
was playing it safe.

The above key sequence settings may cause additional problems with X.
For example, did you use "xev" to check whether pressing "F1" still
gives the "F1" XKSymbol after this wierd definition?

We can set the same sequence with xbindkeys also.

http://www.linux.com/archive/articles/59494

And we don't have to use F1. We can use some unused key. There
are many useless keys in the keyboard. More if you have a
multimedia keyboard.

We can set it to good purpose this way.

Another advantage is that of practical use in this thing.

Hotkeys help you to simply switch the CPU on. Don't care if
you are in X or any terminal even. No need to switch on the
monitor. Just press a hotkey and get your job done.

Usually this makes sense when you want to play a song.

I have been wanting this for a long time but never got there.

Overall, I have found that messing around with loadkeys is only
useful if you _only_ use the Linux console. Even in that case it is
better to define key sequences in specific applications rather than
replacing the characters that the console stuffs into the buffer.

Sorry but I beg to differ.

I even think that you could be wrong here. We are only replacing
the string buffer , and in this case for F1 it was a totally
useless representation. We are not really diddling with the
keycodes or anything like that.

Having the same key bindings at both X and console is what I
want.

Now my problem is that there would be no loadkeys under
OpenBSD and I will be back to square one. But that is my
problem.

Most terminal applications (vi,emacs,mc,git,screen ...) and a few
graphical ones (like Emacs-with-X, gvim) allow you to assign commands
or character strings to key sequences.

Not useful I think. As I said, the use case is different.

I don't even want to switch on the monitor.


The later in the food chain that you assign a key sequence, the more
likely it is that the meaning (semantics) can be application specific.

It is true that it would be nice if there was a general way to say
something like the following for all applications at once:
?F1 should be help
?F2 should be prompt for command/function
?F3 should be prompt for external file/URL
and so on. Moreover, this should be user configurable in one place
for all applications.

Clearly this needs some kind of hotkey callback library that all
applications should link to. Perhaps the Desktop Environments do this
but I wouldn't know since I don't really use them.

I would not get pedagogical on this.

I for one wanted this hotkey business for a long time.

-Girish

-- 
Gayatri Hitech
web: http://gayatri-hitech.com

SpamCheetah Spam filter:
http://spam-cheetah.com

Other related posts: