Add support for click event in Windows#59
Add support for click event in Windows#59jrsearles wants to merge 2 commits intogetlantern:masterfrom
Conversation
|
No - i want to be able to perform some action on left click. Often in Windows for systray icons left-click will perform some default action (which can be showing the context menu) and right-click will bring up the context menu. This wouldn't change behavior for current users - since nothing will be listening to the channel it will continue to show the context-menu. But it will allow that behavior to be overridden in Windows. I think supporting overrides of both left and right-clicks, while definitely adding flexibility would also cause the behavior to diverge more between architectures. And there is probably less of a use case for intercepting right-click. I could add left-click support in Linux, where it will fire an event. However i can't find how to stop it from still performing the action of opening the dialog, which is behavior i want in Windows. |
|
I was looking for such feature in this lib. For my windows app I want left click to be a quick toggle (having only "Quit" in menu). Please merge this PR. |
|
I've caught this PR up with master. Would still love to get this merged. |
|
I need this too, thanks for your changes 👍 While a right click opens an option menu, I want the left click to be a fast on/off toggle :) |
|
Besides giving thumbs up, I am writing a "mee too" note with the hope to see this PR resurrected. Please! |
This adds support for hooking into the left-click event on the systray icon in Windows. It adds a global ClickedCh channel, similar to the menu item channel. If there are no receivers it will open the menu as it currently does. If there is a receiver, then the event is passed through the channel.
I looked into adding similar functionality for Linux. I could hook into the click event (by listening to about-to-show signal on the menu). However i could not find a way to prevent the menu from loading, so the behavior would be different. Not sure if the support would be useful, but i can submit as well if it would be.
Haven't looked at Mac support yet, but may be able to later this week. I'm not sure that overriding left-click behavior would be desirable on Mac/Linux, however in the case of Windows it's not common to show a menu on left-click so i think this PR may be reasonable.