-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
TrayIcon should support "template" icons #146
Comments
I haven't fully grasped the issue yet. Can it be explained by Java opting out of dark mode? See #120. |
@aahlenst no but let me go into detail...
So in summary, the need for template images isn't new, but rather, it's at a point where there's no longer a workaround that's viable on MacOS. A hypothetical |
@tresf I'm still trying to figure out a successful way to communicate those things to OpenJDK. At least for issues that are a problem in the newest versions (15, 16 at the moment), it might make sense to try https://bugreport.java.com/bugreport/. Once a report has been triaged by Oracle, it should end up in JBS. Would you be willing to give it a shot? |
Ok, I've done this in the past and it takes a considerable amount of time to make it into the tracker, but I'll do just that. To that point, my developer's working directly with the OpenJDK11 source code and he's making a proof of concept change to awt to support this new technique (since MacOS 10.10). The JDK11 roadmap seems like this won't break anything, but we'll need to expand the API to allow the |
Submitted. Review ID: Review ID: 9066316 (click to expand)java.awt.TrayIcon requires updates for template imagesAccording to Apple's human interface guidelines, developers should:
These template images could be effectively simulated in appearance prior to MacOS 11.0 "Big Sur" by using platform-specific workarounds to predict the color of the icon, however starting with 11.0 "Big Sur", workarounds are ineffective as described here: (AdoptOpenJDK) #146 Supporting template icons requires an API change to In order for this feature to be implemented, Java will need to change the Due to the introduction of macOS 11.0 in fall of 2020 combined with the state of Java 11 being LTS until 2023, |
Review ID:
|
OpenJDK has accepted the bug report here: https://bugs.openjdk.java.net/browse/JDK-8252015. Next is engaging the awt team. |
The awt team has replied asking for us to submit a PR. Our JDK support provider has helped in warning us about awt API changes (to avoid them) so we're moving some flags to system properties instead. The conversation can be tracked here: https://mail.openjdk.java.net/pipermail/awt-dev/2020-September/016085.html A pull request will be issued against openjdk with this feature in the next week or so, just wrapping up the Objective-C and JNI calls. |
Here's our code which adds a new system property to the JDK allowing a monochrome template image in the System Tray for macOS: AdoptOpenJDK/openjdk-jdk11u@master...qzind:trayicon The code which toggles the template image on/off is here which calls To use this JDK:
Slight correction: the vendor will be doing this on our behalf. We'll update accordingly. |
PR initiated upstream: openjdk/jdk#481 |
Merged upstream via openjdk/jdk@400dc76, awaiting backport for OpenJDK11. |
Thanks to @dyorgio for sharing a workaround while we await the backport: https://github.com/dyorgio/macos-tray-icon-fixer |
We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable. |
https://bugs.openjdk.java.net/browse/JDK-8252015 is the upstream issue. It has not been backported and may not be due to the CSR involvment. |
@karianna as the original submitter, I'm perfectly fine closing this out. JDK17 is available and LTS now, so there's a fix available. Furthermore, the workaround even works on Apple Silicon since JNA added support for that hardware so tracking this over at Adoptium seems like a futile effort at this point. ❤️ |
Starting with macOS (10.16 "Beta"/11.0) "Big Sur", the menu-bar and system tray no longer honor the Desktop dark-mode preference, making it difficult to properly theme a system tray icon for this Desktop.
For frameworks such as Qt, they use a "template" mode flag which tells the
NSImage
that the image can be effectively treated as mask icon, however Java doesn't have a way to set this.Please observe the system tray area in this video below. It illustrates that starting with MacOS 10.16(beta)/11.0 "Big Sur", the System Tray changes based on wallpaper -- NOT based on Dark/Light desktop theme.
Please observe the wifi, battery icons. They switch from white to black regardless of the desktop theme.
Same question, posted elsewhere:
Similarly, Windows could also benefit from System Tray "template" support: https://stackoverflow.com/questions/60837862
Steps to reproduce
Expected vs. Actual results
Since this is a new OS behavior, the expected results are the actual results, however it can be "expected" that the TrayIcon has an option to be treated as a template image to handle this common scenario.
Triaging info
Java version:
Your operating system and platform:
The text was updated successfully, but these errors were encountered: