feat: import menubar patterns from gitify (hideOnClose, contextMenu, globalShortcut, helpers) - #13
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Imports patterns that gitify-app/gitify currently reaches around the library to implement, plus fixes a leaky abstraction that forced gitify to access a private field.
Fixes
fix(06dd7cf): switch the library's window cleanup listener from'close'to'closed'. Consumer'close'handlers can now readmb.windowandevent.preventDefault()without racing our cleanup — removing the need for gitify's_browserWindowworkaround.fix(45aab90): the right-click context-menu popup now reads the current menu lazily, sosetContextMenu()swaps and clears take effect without stale closures.Features
feat(f5a0d0e):hideOnCloseoption interceptsclose, defers the hide viasetImmediate(Wayland half-closed-surface workaround), and passes through duringbefore-quit/destroy().escapeToHideoption hides the window on Escape viabefore-input-event.feat(f4856b7):ignoreDoubleClickEvents(defaulttrueon macOS) callstray.setIgnoreDoubleClickEventsto prevent tray-icon flicker.feat(528631d):contextMenuoption. On Linux usessetContextMenuand re-publishes on every show/hide to defeat the libappindicator/SNI cache. On macOS/Windows pops up viatray.popUpContextMenuon right-click so left-click stays bound to the window toggle.feat(4d08ff7):setGlobalShortcut(accelerator),toggleWindow(), andrecenterOnTray()helpers.globalShortcutis unregistered automatically ondestroy().refactor(66b9e76): alignsetContextMenusignature with Electron'sTray.setContextMenu(menu: Menu | null).Docs / chore
docs(64a10a8): README documents every new option and method.style(1949587): formatter pass on the touched files.Notes
'close'→'closed'change is a behavior change for anyone who registered a'close'listener onmb.windowand depended on it firing before our cleanup. None of the prior tests covered that path; gitify's usage benefits from the new ordering.Test plan
bun run test(62/62 passing locally)bun run typecheckbun run lint:checkbun run test:e2eon macOSbun linkand confirm the_browserWindowworkaround in their close handler can be removed