Which is the right context for keymaps

I have an addon that exports all the key maps to a html file
Currently I am grouping them via the KM_HIERARCHY from keyconfig_utils but the file is huge 1600 rows of table (without many addons enabled) so it’s almost unusable.

What I would like to do is use anchors in the html to allow a sought of context sensitive link between the current context/space/region and the appropriate section in the html. So that anywhere in the interface you press the shortcut key and it takes you to the relevant section in the html page to show all the shortcut keys available in your current context.

The code is not the problem now it’s more the concept
I really don’t have enough experience with blender to make an informed choice

Should I use km.name, km.space_type or km.region_type
none of these really seem to get it however name would get you close to the relevant section

If you don’t feel confident to answer this but do have some ideas just PM me.


space + region type kinda are, but I worry it’s more complex than that. Many operators don’t specify a space type, some or available in all (or many) area types. But there are also other keymaps with higher priority, which may override another hotkey. You need to investigate the priority order to create inference rules, which shortcuts actually apply, and for which context.

Yeah that’s sought of what I thought.

I think I will need to step back from this for a bit to get a bit of perspective on it.

Thanks again CoDEmanX

I have been trying to find where in the code the priority order would be set out I haven’t had much luck. I have had a bit look in the keymaps C code and through the API but I’m not sure where to go now.
Could someone point me in the right direction please.