-
Notifications
You must be signed in to change notification settings - Fork 118
Fix collapsing submenus on refresh (Issues #143, #29, #40) + optional reopen/minwidth support #179
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
base: master
Are you sure you want to change the base?
Conversation
mwilck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, except for the whitespace issue.
|
Awesome, a few notes:
I didn't really check the code, but wouldn't it be possible to load the old menu while the command is being run ? That would reduce flicker. Or best, avoid closing it in the first place ;-) Well, I feel this is incrementally better, but a little quirky feeling. I'm unsure of what to think about if this is better than just avoiding refreshes while a submenu is open for people only minding about the submenu closing upon refresh. Screencast.from.2025-10-03.05-36-25.webmAlso, this PR is not ready for merge as-is strictly speaking : there is no doc, and it contains other unrelated stuff. |
Summary
This PR addresses a long-standing usability issue in Argos: collapsing submenus after each refresh.
Currently, whenever the menu rebuilds (e.g., due to
updateInterval), all open submenus are lost and collapse.This is tracked in multiple open issues: #143, #29, #40.
The result is a frustrating user experience whenever scripts display structured information across submenus — users constantly need to reopen the submenu they were working with.
This PR introduces backward-compatible, optional extensions to improve daily usability while leaving existing BitBar/Argos scripts untouched.
Changes
1. Preserve Submenu State
removeAll()and restored afterwards.idto submenu headers:idis not set, the submenu behaves as before (collapses on refresh).submenu_state.jsmanages capture/restore. UsesGLib.idle_addto avoid race conditions during menu rebuild.2. Reopen Menu After Action
reopen=trueto an item.submenu_state.jswithrequestReopen()andfinalizeUpdate().3. Minimum Width for Submenus
minwidthin pixels:min-widthstyle to the correspondingPopupSubMenuMenuItem.button.jswhen building submenus.Backward Compatibility
id,reopen, orminwidthproperties behave exactly as before.Impact
Screenshots / Demo
(optional: add screenshots or a short screencast here to illustrate submenu state being preserved and menu reopening)
Conclusion
This PR makes Argos more robust and convenient in daily use without breaking compatibility.
Users frustrated by collapsing submenus (#143 / #29 / #40) finally get relief, while all existing scripts continue to function as before.
Example
The new features can be seen in the attached demo script: