Skip to content

Add disable click option#485

Open
haydendonald wants to merge 1 commit into
max-mapper:masterfrom
haydendonald:master
Open

Add disable click option#485
haydendonald wants to merge 1 commit into
max-mapper:masterfrom
haydendonald:master

Conversation

@haydendonald
Copy link
Copy Markdown

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

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
@haydendonald
Copy link
Copy Markdown
Author

Bump

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

Successfully merging this pull request may close these issues.

1 participant