I&#39;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.<br><br>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.<br>
<br>To do this I need to be able to:<br><br>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 copy/cut/quit .<br>
2.  know what application is receiving the keystroke so the internal state for that application can be used.<br><br>It seems that a naive approach with XGrabKeyboard and XNextEvent / XSendEvent won&#39;t work because many apps will not accept the events.<br>
<br>Would I need to create a tweaked X Keyboard input driver, which monitors which window has focus?  How would you approach it?<br><br><br>Thanks,<br><br>James.<br><br><br><br>