Hotkeys: getting at the information
When you're lucky, the keyboard shortcut definitions are in an easy to locate, humanly readable configuration file that can be edited manually. In that case, a plugin will be a simple automation or actions you would otherwise do manually.
For example, GTK programs that use the standard accelerator key map format can be handled this way, even if it's not possible to change the shortcuts, and I've in fact already included some "library" routines to handle this so that they can be created with a few lines of code (examples are present).
When there's no way to get at such a configuration file, I generally resort to gathering the shortcuts from the help info or the menus or whatever way possible. Ater that, I either build the csv file directly or code the plugin to create the csv file from text or whatever (for this, examples are also present). It's also possible to use the Manual Entry dialog for this purpose.
When a tool has a lot of internal commands that you can define shortcuts for, things get a little more complicated. Not only do you want to map the shortcuts, but you'll also want to get at the list of commands. If a tool allows you to define your own actions, there's even more fun to it. The plugins for SciTE, Total Commander and Double Commander demonstrate this.
Currently the keydef file is in json format.