larswm contains a couple of features that makes it possible to set up your X environment in a way similar to the plan9 Acme or UNIX wily environments. Whenever an application is launched from a keyboard shortcut, a few environment variables are set before executing the application.
The primary selection, as a string.
The window id of the window that is the owner of the primary selection.
The WM_NAME of the window that is the owner of the primary selection.
The WM_ICON_NAME of the window that is the owner of the primary selection.
The window id of the currently focused window.
The WM_NAME of the currently focused window.
The WM_ICON_NAME of the currently focused window.
The variables above will be set if the data is available, otherwise they will be left unset.
Please see the file sample.editor, included in the source tarball and in the RPM. It shows how to make a script that launches an editor on a file that is highlighted in an xterm. That is just one example of what can be done with this. The sample.larswm contains another, that opens a manual page on a highlighted word.