Have you seen the post
Mobipocket Reader for GNU/Linux, Mac, all!? It is about running the iLiad (Java) MobiPocket Reader on other machines. The strange thing about the reader is that it is just the book display pane (no icons etcetera) and is controlled by "a UDP socket running on port 50079". I initially attributed the strangeness to MobiPocket, but perhaps this is another example of splitting window manager like actions into a separate program.
By the way, FBReader has a menu item to bind keys to actions (keys tab under the options icon) and it will tell you what key it detected for each keypress. So you can get some of this info from FBReader without recompiling. It may also be possible to bind two actions to some keys (standard and long keypresses), which isn't something I would have thought to try.