Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group macros in the sidebar #1845

Open
rftw opened this issue Sep 15, 2022 · 6 comments
Open

Group macros in the sidebar #1845

rftw opened this issue Sep 15, 2022 · 6 comments

Comments

@rftw
Copy link

rftw commented Sep 15, 2022

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
Copy link

I have the same problem.
image

@mondalaci mondalaci changed the title [Feature Request] Ability to group macros in the sidebar Group macros in the sidebar Jun 27, 2024
@mondalaci
Copy link
Member

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
Copy link
Contributor

kareltucek commented Jun 28, 2024

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:

  • Anki
    • Reschedule
    • Switch to

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):

  • $onKeymapChange
    • QT3
  • $onKeymapLayerChange QT3
  • Aux
  • Bind
    • Mouse
      • Macros
    • Numbers
  • Brightness
  • Cfg
  • Fty
  • Qpad

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
Copy link
Member

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
Copy link
Contributor

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
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants