Summary: define key with return

From: Dave Stern - Former Rocket Scientist (dave@umiacs.umd.edu)
Date: Tue Jun 22 2004 - 07:37:20 EDT


Original query:
I want to map a key to run some program and not have to hit <CR>.
One way to do this is to

alias z 'ps -elf'
xmodmap -e "keycode 23 = z"

So keycode 23 (F7) is mapped to "z" which is an alias to the command I
wish to run. But I still have to press <CR>. I thought there was a way
to add a <CR> to keycode mapping. Anyone remember what it is?
For extra credit, the above works but you lose the ability to type a
"z". Is there a more elegant way to map a command to a key?

----------------------------------------------------------------------------
Thanks to David Deaves for putting me on the right track. Munging what
he said for my (ea) environments: best way is with Xresources or .Xdefaults.

Depending on how you run your window manager, you may need some or all of
these steps

1/ in .cshrc, have test for X11 eg

if ( ! $?DISPLAY ) then
   xrdb -load $HOME/.Xresources
endif

2/ $HOME/.Xresources contains eg

XTerm*VT100*translations: #override \
        <Key>Home: string("ps -elf\n") \n\

 Now all xterms will define Home key as "ps -elf"
    This will therefore even work on remote xterms ie if you ssh elsewhere

 NB, this will obviously only work in Xterms; If you start an aterm...

 =-=-=-=-=-=-=-=-=-=-=-=- generated by /dev/dave -=-=-=-=-=-=-=-=-=-=-=-=-=-=
 David Stern University of Maryland
                Institute for Advanced Computer Studies
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:28:55 EDT