Skip to content

feat: auto-group macros in the sidebar#2993

Open
mondalaci wants to merge 8 commits into
masterfrom
feat/macro-sidebar-grouping
Open

feat: auto-group macros in the sidebar#2993
mondalaci wants to merge 8 commits into
masterfrom
feat/macro-sidebar-grouping

Conversation

@mondalaci

Copy link
Copy Markdown
Member

Summary

  • Adds optional collapsible macro groups in the sidebar, derived from macro names at display time (no config schema change).
  • Splits on non-alphanumeric characters by default; optional camelCase splitting for names like bindMouseLeft.
  • Adds Settings controls with tooltips, dependent-option disabling, and persisted Agent preferences (off by default).
  • Handles smart-macro $ prefixes and avoids incorrect deeper nesting when siblings do not share a next segment.

Closes #1845

Test plan

  • Open Settings → Macro sidebar grouping: verify layout, tooltips, and that dependent options disable when grouping is off
  • Enable grouping with macros like Doom: Chainsaw, Doom: Plasma gun → collapsible Doom folder
  • Enable camelCase splitting with bindMouseLeft / bindMouseRightbind group
  • Verify $onInit / $onJoin group under $on, not on
  • Set max nesting depth to 2 with Open daily sites / Open weekly sitesOpen > daily sites, weekly sites (not full names)
  • Confirm grouped macro leaves show full name in hover tooltip when shortened
  • Run npm test in packages/uhk-common

Made with Cursor

Comment thread packages/uhk-common/src/util/group-macros-by-name.ts Outdated
@ert78gb
ert78gb force-pushed the feat/macro-sidebar-grouping branch from cdd1fe5 to 097c3d1 Compare July 14, 2026 10:11
@mondalaci

Copy link
Copy Markdown
Member Author

Good catch! Just committed. How about now?

@kareltucek

Copy link
Copy Markdown
Collaborator

Two suggestions:

  • Visually distinguish group headlines.
  • Always list full name even inside of a group.
    • Then, if there is a macro named same as an identified group, list it inside of that group rather than outside.
2026-07-14-153401_315x350_scrot 2026-07-14-153351_372x340_scrot

@mondalaci

Copy link
Copy Markdown
Member Author

By headlines, I assume you mean non-leaf items. I've tried to make them more prominent, but it looked overkill. The current indentation and the downward-pointing arrow should indicate that they're non-leaf nodes.

Implemented the rest of your suggestions.

@ert78gb

ert78gb commented Jul 14, 2026

Copy link
Copy Markdown
Member

Just a question I don't know what is the good behaviour. If I open the popover of a key action and navigate to the Macro tab. And Click on the Jump to macro button. Should the macro group expand if it was collapsed?

And may be worth to add a 3rd macro grouping option about how to show macros when Agent opens. In collapsed or opened. It is not a strong option I have to use this feature more to see better

@mondalaci

Copy link
Copy Markdown
Member Author

Great catch regarding the jump to macro! The macro should expand. Just submitted a commit.

Let's not add a default opening option for now. I think the current behavior is fine, and we'll add further options if requested.

@kareltucek

kareltucek commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Looking into the code/dom now, and... it seems that everything is a leaf item in that tree. That greatly limits any indent-related formatting. 😑

@kareltucek

Copy link
Copy Markdown
Collaborator

Just a suggestion:

2026-07-15-113517_1300x1899_scrot

@pcooke9

pcooke9 commented Jul 15, 2026

Copy link
Copy Markdown

Looks nice! Is this in a usable state now, or should I wait? Because I really don't wanna wait...😁

@kareltucek

Copy link
Copy Markdown
Collaborator

Usable state :)

mondalaci and others added 7 commits July 16, 2026 14:13
Add optional sidebar grouping derived from macro names, with settings for
camelCase splitting, nesting depth, and minimum group size. Grouping is off
by default and only affects sidebar display, not stored macro names.

Closes #1845

Co-authored-by: Cursor <cursoragent@cursor.com>
Use \p{L} and \p{N} so non-English macro names and unicode digits group
correctly in the sidebar instead of breaking on accented characters.

Co-authored-by: Cursor <cursoragent@cursor.com>
Grouped sidebar items now always display the full macro name, and macros
whose name matches a group label are listed inside that group.

Co-authored-by: Cursor <cursoragent@cursor.com>
When a macro is selected via Jump to macro or navigation, open its
ancestor sidebar groups so the target macro stays visible.

Co-authored-by: Cursor <cursoragent@cursor.com>
&__macro-group-children {
width: auto;
padding-left: $macro-tree-indent-step;
border-left: 1px solid silver;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I havent checked out the PR just looked into it. Is this silver looks goon in light and dark mode? Should not we use a predefined "silver" color?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the silver color does look good in light and dark modes alike.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not we use a predefined "silver" color?

We definitely should.

Keep persisted MacroGroupingSettings in uhk-common and colocate display-time
grouping, tree types, and layout-derived max depth with the Agent UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mondalaci
mondalaci force-pushed the feat/macro-sidebar-grouping branch from 751bed9 to 90f1cdb Compare July 16, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Group macros in the sidebar

4 participants