emap is a client for the X window system which listens for events such as certain keystrokes in the background and executes shell commands or takes other action in response. In addition to being able to create simple hotkeys, emap implements a prefix map, allowing sequences of keys to be bound to actions. emap also passes information on to shell commands via the environment, which lets commands change their behavior based on things such as the currently active application.
emap [-d <display>] -k
This will cause emap to spit out the symbols and modifiers of keys you press. this is purely informative for the user to find out what strings to use in the emap configuration files. Press the 'q' key to quit.
emap [-d <display>] [-l <file>] [-o] [-v] [-f] <emap files...>
emap's default behavior is to merge all available configuration files and run in the background if there were no fatal errors. emap sources all files which end in .emap and are in the .emap.d or etc/emap.d directories off the users home directory, for example if ones home directory were /home/john then /home/john/etc/emap.d/user.emap would be one of the files read. The command line options modify this behavior as follows:
Here is an example of what might occur in a configuration file. text between /* and */ is a comment and ignored.
key <mod1-a> { string "env" exec env | sort string "xt" exec xterm & string "mz" exec mozilla & } /* this matches the PrintScr key with any modifiers */ key <*-Print> exec echo DISPLAY=$DISPLAY SCREEN=$SCREEN FOCUS_APP=$FOCUS_APP
key events started with the 'key' identifier match a single keystroke, the format is <modifier-modifier-key> where key is the KeySym name and modifiers are one of the modifier keys or *, meaning any combination of modifiers. use emap -k to find out the names of keys you wish to map.
string events may only be used after a key event, and is an arbitrary string, the first to match exactly will be executed.
The following environment variables are set when an external program is called. they allow you to modify the behavior of your action depending on the state of the server and what app you are currently using.
Here are some examples of the environment settings shell commands will see.
E_APP_CLASS=xterm/XTerm E_APP_WINDOW=12582950 E_KEY=mod1-a E_MOUSE_COORD=196,1316 E_MOUSE_WINDOW=12582950 E_ROOT=63 E_STRING=env E_WINDOW=12582950 E_APP_CLASS=Mozilla/navigator:browser E_APP_WINDOW=14680179 E_KEY=*-Print E_MOUSE_COORD=688,421 E_MOUSE_WINDOW=14680179 E_ROOT=63 E_WINDOW=14680179 E_APP_CLASS=gvim/Gvim E_APP_WINDOW=18874486 E_KEY=*-Print E_MOUSE_COORD=520,954 E_MOUSE_WINDOW=12582950 E_ROOT=63 E_WINDOW=18874486
The following files are searched for mappings. it is recommended to put personal settings in a file called user.emap
emap was written by John Meacham. It's homepage is http://repetae.net/computer/emap/
Send comments to john@repetae.net