Set hotkey for script execution?


#1

Is there a way to set a hotkey to execute some python code?

The fastest way right now seems to create an Action Plugin and go through the menu, but I would like to run my plugin/code through the press of a button.


#2

I did some research on this, but I did not find a solution. Going with pure python is not platform independent, and would require installing additional packages, so I’ve tried wxPython.

I’ve managed to trigger an event with keypress while the action plugin was active, but I did not succeed in registering a keypress when action plugin was not running. For the time being I’ve suspended my efforts here as the wxpython support in KiCad is uncertain.


#3

As far as I know this isn’t possible. What Mitja tried is interesting, but in any case the shortcuts should be left for the end user to decide. KiCad isn’t far from the situation when it needs some kind of extensible shortcut, like emacs Ctrl-x, which would open practically endless possibilities for new key combinations.


#4

I never tried, but there probably exists external software for making keyboard macro’s.
Some mouses have software for re-configurable macro buttons.


#5

Yes, using external tools is an option, but from my perspective main point of action plugins is that an author can share his work with the rest of KiCad community. Requiring external tools, additional python packages, or OS specific solutions greatly limit the audience.


#6

Sad to hear that there is no good solution for this problem right now. But I saw in the KiCAD 6 roadmap that they have a shortcut manager planned. So maybe we have to wait for its implementation…