First of all, many thanks for getting involved! It is really great to finally see someone taking enough of an interest in the workings of the shortcut system to want to help improve it.
Since this is touching a fundamental part of the application, there are many aspects/thoughts to take into account.
“focused widgets” hasn’t been that much of a thing in dt, because everybody was assumed to be using the mouse anyway, so one can’t just assume things will “just work”. The only things (that I can think of) that take focus are the bauhaus widgets and Entry fields. Anything else quite often forcefully returns focus to the center (so that shortcuts work again; this was more an issue with the previous shortcut system, but to be able to pan with arrow keys, you need the center focused). you don’t want a toggle to retain focus after you clicked it if that means you can’t pan (also reason for colorpicker behavior). But that also (?) means you can’t assign it focus as part of cycling through all widgets. So if people suddenly want to be able to navigate between nodes of a curve with the keyboard, that needs to all be built from scratch. And the shortcut system doesn’t deal with configurability of actions-on-focused-objects, so you can’t change what arrow keys do to bauhaus widgets, but equally you can’t change what shift+scroll does when you’re manipulating mask shapes. Could all be built on top of what we have, but it is work that at the very least would need people to show enough interest to do the (regression) testing. Which first means they need to understand the intent and what is and isn’t supposed to work. Shortcuts in dt sometimes feels a little like quantum physics in that only maybe five people in the world really understand it. And that may be an overestimate.
Anyway, back to the topic at hand
And continuing with the random order nature of this response:
The shortcuts dialog has an import button…
Maybe most importantly, bauhaus widgets are not darkroom specific. So though it is tempting to implement something that will work just there, people will then be disappointed if they can’t work with the, say, export module widgets in the same way. So the action for “focused slider or dropdown” needs to live in global. As I suggested earlier, to make fallbacks work correctly we need to intercept this special proxy action early on in the shortcut matching system. I’ve implemented this here shortcut action for focused bh widget · dterrahe/darktable@4a5f42d. With this you won’t need a separate action for manipulating the button anymore (even the +left click fallback just works). I’m having the proxy action masquerade as a combo because that has fewer elements than the slider type, so you don’t end up with a combo unexpectedly being confronted with a fourth element (“zoom”) that only a slider would know what to do with. To really productise this commit, we’d introduce a separate _action_def_slider_or_combo that has more generic names for the first element and its effects (“selection or value”, “next or up”, “previous or down”) but that is just polish. You’d also want to show a different error rather than “shortcut not assigned” when there is no focused widget.
In theory _action_def_slider_or_combo could have a 3rd element, “change focus”, that would cause it not to be proxied to the focused widget but be handled by the action itself.
Cycle module groups should really live inside utility modules/module groups. In fact, when implementing the “active modules” and “quick access panel” actions there I was a bit lazy; this should really have looked more like the notebook type actions (that you often see as “page”). So the first two elements should be “active modules” and “qap”, but then if you assign a shortcut to either one of these, a fallback would let you “scroll” to other pages (or you could, of course, assign PgUp/Down whatever).
At this point I’d be happy if you submit this as a draft PR so we can have further discussions on github. That way there’ll be a record of the deliberations so future interested persons can find out why certain choices were made. There’s no urgency so lets aim to get something merged early next year.
