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

refactor to allow instances to be created and closed separately #44

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

DeedleFake
Copy link

The intention of this pull request, once it's ready, is to allow individual instances of tray icons to be created and closed without affecting others. This became a problem with my own app that I'm working on because it needed the ability to remove the tray icon while running and potentially create it again later, but I was somewhat disappointed to discover that Quit() uses a sync.Once and can't be called twice.

Once this refactor is finished, the goal is to have a new instance-based API that allows more fine control and to restructure the old API to simply call some default instance, thus allowing full backwards compatibility.

@andydotxyz
Copy link
Member

Would it not be easier to just support hiding the menu whilst this is still running?
Stopping a GUI event loop complete and then restarting can be really problematic.

@DeedleFake
Copy link
Author

Perhaps for some use cases. In my case, the icon can be disabled via user preferences, so it doesn't really make sense to keep the icon around doing nothing when the user has it turned off anyways.

@andydotxyz
Copy link
Member

Good point. Looks like a good enabler.
As long as the original API continues to work of course :).
I too prefer an instance object based API - but it would be nice for this to continue to be a drop-in replacement for the original getlantern project

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.

2 participants