UltimateHackingKeyboard / agent

Ultimate Hacking Keyboard configurator
https://ultimatehackingkeyboard.github.io/agent/
Other
702 stars 77 forks source link

Group macros in the sidebar #1845

Open rftw opened 2 years ago

rftw commented 2 years ago

I made a lot of macros lately and cluttered my sidebar. Would it be possible to add the ability to organize macros into collapsible folders/groups?

0x7FFFFFFFFFFFFFFF commented 2 years ago

I have the same problem. image

mondalaci commented 3 months ago

Agent will optionally auto-group macros, but it's not trivial how.

I suggest using the : string as a separator. If Agent finds multiple macro names with the same left-side content, such as Doom: Chainsaw and Doom: Plasma gun, it'd create a Doom group with Chainsaw and Plasma gun in it.

Sounds good?

kareltucek commented 3 months ago

Due to macro calling, I tend to favour special-character-less macro names, so I strongly oppose using : as a single hardcoded "special meaning" separator. I usually use camel case without spaces, but other variants may work too. (The minimum extension of your usggestion that I find acceptable is to allow simple underscore _ as an alternative to :.)

A more general, more smart brainstorm idea is to use the following regex:

(([A-Z]*|.)[a-z0-9]*)[^a-zA-Z]*

\1 would be used as the group label

It would be used recursively (I am happy to write that algorithm), and the recursion levels would be concatenated if the above regex identifies only one subgroup. E.g., in the example above it could create groups as:

On my config:

2024-06-28-112131_356x1842_scrot

it would yield (I am not saying that it is an ideal grouping - just what the algorithm that I have in mind would yield):

Some intelligent clustering should be devised to flatten above groups - e.g., the $onKeymapChange QT3 group that contains just 2 members is strongly suboptimal. If you want only one nesting level, I am sure I cam come up with a suitable algorithm.

mondalaci commented 3 months ago

In hindsight, I can see the limitation of my suggestion. However, to be more explicit about what to separate, I'd only allow non-alphanumeric characters for the separator substring.

I'd make the maximum depth and the minimum number of children to cluster configurable via Agent settings.

kareltucek commented 3 months ago

If we want to make it configurable, then I would like to add a checkbox to allow camel case separation.

If we dont want to clutter the configuration at all (by clustering parameters) then I find the suggested non-alpha separation to be reasonable.

mondalaci commented 3 months ago

I'm not against camel case separation, but I'd like to see how many other users would use it.

Please comment about your use cases, folks!