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

Feature/systray #2812

Merged
merged 14 commits into from
Mar 10, 2022
Merged

Feature/systray #2812

merged 14 commits into from
Mar 10, 2022

Conversation

andydotxyz
Copy link
Member

@andydotxyz andydotxyz commented Feb 28, 2022

Description:

Add support for system tray on macOS, Windows and Linux/BSD.
This adds a 6% increase in binary size, but I cannot find a way to do this with less.

Fixes #283

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

Where applicable:

  • Public APIs match existing style.
  • Updated the vendor folder (using go mod vendor).
  • Check for binary size increases when importing new modules.

@Bluebugs
Copy link
Contributor

Just wondering if the icon approach is the right one here. I haven't used systray on multiple platform, but it doesn't seems to be an in sync behavior on Linux. You can have "blinky" icon in the systray, but I haven't noticed them much in the application window icon.

@andydotxyz
Copy link
Member Author

Can you clarify what you mean by whether “the icon approach” being right @Bluebugs ? I’m not sure what aspect is being questioned.

@Bluebugs
Copy link
Contributor

My understanding is that the current PR does use the application icon as the one for the systray icon. This might be limiting, especially because icon are usually "animated" or show some kind of state information by changing there content, which I don't think is necessarily expected for the application icon. Basically I am not sure that they have the same purpose.

@andydotxyz
Copy link
Member Author

My understanding is that the current PR does use the application icon as the one for the systray icon. This might be limiting, especially because icon are usually "animated" or show some kind of state information by changing there content, which I don't think is necessarily expected for the application icon. Basically I am not sure that they have the same purpose.

Thanks. The plan is that this will be the fallback but developers will be able to specify an override, I hope this makes sense (I do still need to add that API).
Plan is that by default the icons will be the same (no user surprise), but that they can be animated etc by setting different ones.

@Bluebugs
Copy link
Contributor

Bluebugs commented Mar 1, 2022

The plan is that this will be the fallback but developers will be able to specify an override, I hope this makes sense (I do still need to add that API). Plan is that by default the icons will be the same (no user surprise), but that they can be animated etc by setting different ones.

That does make sense indeed.

@coveralls
Copy link

coveralls commented Mar 6, 2022

Coverage Status

Coverage decreased (-0.1%) to 61.713% when pulling 070c7ae on andydotxyz:feature/systray into e12f3a2 on fyne-io:develop.

@andydotxyz andydotxyz marked this pull request as ready for review March 6, 2022 18:43
@andydotxyz
Copy link
Member Author

Icon replace is in and this seems feature complete.
I cannot figure how to make tests for it, but open to suggestions.

Bluebugs
Bluebugs previously approved these changes Mar 6, 2022
@stuartmscott
Copy link
Member

I cannot figure how to make tests for it, but open to suggestions.

Seems tricky as it is such an OS-dependent API. I'm not even sure you can programmatically trigger system tray elements on most OSes.

It might be good to add a couple of usage tests tho - to ensure it doesn't break if someone calls the APIs, or calls them in the wrong order, or updates the menu & icon every frame, and that the icon adjusts to theme-changes etc.

@andydotxyz
Copy link
Member Author

It might be good to add a couple of usage tests tho - to ensure it doesn't break if someone calls the APIs, or calls them in the wrong order, or updates the menu & icon every frame, and that the icon adjusts to theme-changes etc.

But if we call any of these APIs then icons will appear and disappear from system tray, something we generally try to avoid in tests. Such testing should be in the fyne-io/systray package not here I would think.

@stuartmscott
Copy link
Member

Running fyne test already flashes up windows and changes the menus in the top bar, icons appearing and disappearing from the system tray isn't the end of the world

@andydotxyz
Copy link
Member Author

Running fyne test already flashes up windows and changes the menus in the top bar

Only on macOS IIRC. And it's a bit of a regression, we used to manage without visually interfering with the screen.

@andydotxyz
Copy link
Member Author

Is not having the test in a blocker @stuartmscott? I would happily add some Os specific testing to the "systray" project, the only thing to test here really is that a fyne.Menu translates to a systray menu, I guess that would be possible?

@andydotxyz
Copy link
Member Author

Sorry @Bluebugs I did an update and it invalidated your review :(

@Jacalz Jacalz self-requested a review March 9, 2022 05:56
@stuartmscott
Copy link
Member

I would happily add some Os specific testing to the "systray" project

Sounds good!

The only other thing to check is that the Icon updates on theme change

@andydotxyz
Copy link
Member Author

The only other thing to check is that the Icon updates on theme change

Wow now that is an interesting thought. I don't think any of our app/window icon code refreshes on theme change.
Most icons like that are not part of the theme but I guess it is entirely possible that they could be and/or would want to match the current settings.

Copy link
Member

@stuartmscott stuartmscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining items could land in a follow up PR. This feature is in high demand so let's land it and get it in the hands of devs for testing.

@andydotxyz
Copy link
Member Author

Remaining items could land in a follow up PR.

Added #2842 to follow up on the icon theme change

@andydotxyz andydotxyz merged commit e9dcfad into fyne-io:develop Mar 10, 2022
@andydotxyz andydotxyz deleted the feature/systray branch March 10, 2022 17:57
@andydotxyz
Copy link
Member Author

Jacob said continue without him, so I did

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.

None yet

4 participants