[NTLUG:Discuss] Map key entry
kbrannen@gte.net
kbrannen at gte.net
Mon Feb 10 14:13:47 CST 2003
Greg Edwards wrote:
> Well I guess I should have paid better attention ;)
>
> I need to program a way for my users to reset usb services without
> having to remember much. I'd like to program the F12 key to run
> "service usb restart" when pressed. Doing this as part of the X server
> would be acceptable but I'd rather it be set during the init process
> like the <CTL><ATL>del mapping.
>
> I know that there have been discussions on setting key mappings here but
> I can't seem to find them in the archives and I can't remember the
> suggestions.
>
> So can we go down that road again ;)
>
> Thanks,
There may be a way to do it system-wide, but the easier way will be thru X, at
least it seems that way for me. :-) How you do it depends on the window
manager. For example, with Mwm, I could do:
<Key>F12 root|icon|window f.exec "/some/program &"
in the key binding section to achieve that. As I recall, Fvwm and Twm have
similiar things; I suspect the KDE and Gnome window managers also have
equivalents. OTOH, Wm2 and Wmx (what I use) don't have anything like that,
but then I doubt your users would so minimalistic. :-)
You can use "loadkeys" to have it type out the string to run, and I guess if
it had a LF at the end it would execute, assuming the user had permission to
run the program (set up "sudo" if you have permission problems). This is
probably the most user-independent way that I can think of, thought the Window
Manager may try to override it. You'll have to test. :-)
HTH,
Kevin
More information about the Discuss
mailing list