For executing external commands you may consult the https://nim-lang.org/docs/osproc.html module, startProcess() and related procs.
Hotkeys are closely bound to Operating systems. Basically you should be able to do it very similar as you did it in other languages. If you still have no idea, you may do a google search for terms like "hotkey python" which may give you some hits for stackoverflow and similar pages...