My goal is to have a program that sleeps in the background but can be activated by the user via some \"hotkey\". From digging around the Xlib manual and the Xlib O\'reilly m
If you're using/targeting gtk on X11, there's a C library with a much simpler interface:
https://github.com/engla/keybinder
Includes Python, Lua and Vala bindings. (Also mentioned here.)