Open jamieweavis opened 7 years ago
I'm thinking about adding the following options:
{
onClick: 'toggle' | () => void, // defaults to 'toggle'
onDoubleClick: 'toggle' | () => void, // defaults to noop
onRightClick: 'toggle' | () => void, // defaults to noop
}
'toggle'
just means the window will show/hide. But if the developer wants to customize, he/she can put any click handler on these events.
This will also deprecate the showOnRightClick
option, since {showOnRightClick: true} -> {onRightClick: 'toggle'}
What do you think?
@jamieweavis Would you like to continue on your PR, or should I take care of this?
Feel free to continue @amaurymartiny 👍
When the
showOnRightClick
config option istrue
, themenubar
probably shouldn't be shown when double clicking the tray icon.The
showOnRightClick
option will most likely be used when developers wish to use theclick
event for other purposes. For example a single click could show aBrowserWindow
while right-click would show themenubar
which contains preferences for their application. In this use-case double clicking the tray icon would show both theBrowserWindow
and themenubar
at the same time.This could also potentially be addressed by adding a new config option to disable the double-click event being added to the tray. However I can't think of a use-case where you would want the
menubar
to show on right-click & double-click but not single click. So I would suggest not adding the double-click event if theshowOnRightClick
config option istrue
.I'll create a pull request tomorrow.