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

Re: how to tell which key was pressed to execute a script?



On Fri, Jun 06, 2003 at 12:05:10PM -0400, David Z Maze wrote:
> So use command-line arguments, or write a separate script for each
> key.  They're cheap.  :-)

No, that won't go. Suppose you'd want -- as do I -- to press only
the F1 key every time you'd like to check your mail. You'd do it
with loadkeys and using a string, such as "fetchmail\n".

That's quite ok but if you'd map it to something like "loadkeys us\n",
what do you think would happen if you pressed that in your editor?
Will it really change your keyboard-layout? No; you'd merely see it
written out in your text. If you check what "dumpkeys" says, you'll
note the absence of a function like "loadkeys ...". (Which is quite
natural, right?)

Now here you have two possibilities: you can either add a custom
function to the kernel sources or use the "KeyboardSignal" function.
You map it to a key and edit your /etc/inittab to activate it. Then
you may press your magic key and your keyboard becomes different, if
that's what you want. You can do it from within your editor and you
won't even notice it until you try it out.

So I thought I'd map more keys to that function, which always
executes one script -- and the script would know how it was called,
so that it could execute a different function for each key. 

Does anyone know how this could be accomplished?

    andrej

-- 
echo ${girl_name} > /etc/dumpdates



Reply to: