Add disable click option#485
Open
haydendonald wants to merge 1 commit into
Open
Conversation
Added disableClick which will disable the opening of the window when the user clicks the tray icon. You can still use showWindow to open the window
Author
|
Bump |
4 tasks
afonsojramos
added a commit
to gitify-app/menubar
that referenced
this pull request
May 9, 2026
## Summary Introduces `Options.trigger` — a `'click' | 'right-click' | 'none'` enum that controls which tray event toggles the menubar window. Deprecates the `showOnRightClick` boolean, which is kept as a fallback for one minor. `trigger: 'none'` skips all tray click bindings, enabling the **one tray icon, multiple anchored windows** pattern: a secondary `Menubar` instance reuses tray-anchored positioning while the caller drives visibility via `showWindow()` (typically from a context-menu entry). ## Why an enum, not a `disableClick` boolean The motivating use case was raised upstream as [max-mapper#485](max-mapper#485) by @haydendonald, who proposed a `disableClick: boolean` flag. We're going further: - `disableClick` is a negative-named boolean, and `disableClick: false` reads as a double-negative. - It silently overlaps with the existing `showOnRightClick` — `{ showOnRightClick: true, disableClick: true }` quietly disables right-click too, since the wrapping `if` covers both registration paths. The name lies. - It's asymmetric: there's no `disableDoubleClick` or `disableRightClick`, so the API can't grow cleanly. A single `trigger` enum subsumes both flags, is self-documenting, leaves room for future values (e.g. `'double-click'`), and gives a clean migration path off `showOnRightClick`. ## Migration | Before | After | | -------------------------------------- | ------------------------------ | | (default) | (default — `trigger: 'click'`) | | `showOnRightClick: true` | `trigger: 'right-click'` | | (no equivalent — was upstream PR max-mapper#485) | `trigger: 'none'` | `showOnRightClick` still works and is honored when `trigger` is unset; it's marked `@deprecated` and slated for removal in the next major. ## Test plan - [x] `bun run test` — 18 tests pass, including 5 new cases for `trigger`: - default binds `click` + `double-click` - `trigger: 'right-click'` binds `right-click` + `double-click`, not `click` - `trigger: 'none'` binds nothing - unset `trigger` falls back to `showOnRightClick` - `trigger` wins over `showOnRightClick` when both are set - [x] `bun run typecheck` — clean - [x] `bun run lint:check` — clean (one pre-existing warning, unrelated) - [x] `bun run build` — ESM/CJS bundles produced
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.
Added disableClick which will disable the opening of the window when the user clicks the tray icon. You can still use showWindow to open the window.
This allows for multiple windows to be assigned to a tray icon. In my instance i have the main window still assigned to the default option, and a about window which has disableClick=true which is opened via a context menu. Both windows open under the tray icon nicely :)

