Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for click event in Windows #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jrsearles
Copy link

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.

@jsearles
Copy link

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.

@vearutop
Copy link

vearutop commented May 4, 2019

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.

@jrsearles
Copy link
Author

I've caught this PR up with master. Would still love to get this merged.

@fbrinker
Copy link

fbrinker commented Nov 8, 2020

I need this too, thanks for your changes 👍
But it would be awesome for every OS :)

While a right click opens an option menu, I want the left click to be a fast on/off toggle :)

@getlantern getlantern deleted a comment from joesis Mar 1, 2021
@wsw70
Copy link

wsw70 commented Apr 25, 2021

Besides giving thumbs up, I am writing a "mee too" note with the hope to see this PR resurrected. Please!

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.

5 participants