How could I modify keystrokes programatically, per application?
wjcferguson at gmail.com
Wed Sep 16 12:38:26 PDT 2009
I'm hoping for some pointers to get me on the right path... I am a
developer who is unfamiliar with X development, but have a task in mind.
I want to create an equivalent under X to the (Windows) XKeymacs app which
makes emacs-style key bindings work almost universally, even for CUA-style
applications (shift+movement to select, C-x to cut etc.). Ironically,
XKeymacs makes XP nicer for those with deep emacs muscle-memory than X11 is.
To do this I need to be able to:
1. Map or modify keystrokes depending on an internal state. e.g. if they
enter Ctrl+n, then a down-arrow key would result; if the user has set a
mark, then arrow-key movement needs a shift modifier added until a
2. know what application is receiving the keystroke so the internal state
for that application can be used.
It seems that a naive approach with XGrabKeyboard and XNextEvent /
XSendEvent won't work because many apps will not accept the events.
Would I need to create a tweaked X Keyboard input driver, which monitors
which window has focus? How would you approach it?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the xorg-devel