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

macOS 10.16/11.0 Dark mode System Tray ambiguity #678

Closed
tresf opened this issue Jun 24, 2020 · 5 comments · Fixed by #745
Closed

macOS 10.16/11.0 Dark mode System Tray ambiguity #678

tresf opened this issue Jun 24, 2020 · 5 comments · Fixed by #745
Assignees
Labels
Milestone

Comments

@tresf
Copy link
Contributor

tresf commented Jun 24, 2020

macOS 10.16 "Big Sur" has a dark mode ambiguity with the system tray area. Steps to reproduce:

  1. Select a wallpaper that has a very light background in the area of the system tray
  2. Watch the QZ Tray icon show the wrong color

This bug appears to be caused by the desktop's decision to choose a light-mode tray are when a dark-mode theme has been specified.

This is very similar to a problem that Windows 10 introduced when they too split the theming capabilities between the tray and the windowing. #597

@tresf tresf added the bug label Jun 24, 2020
@tresf tresf self-assigned this Jun 24, 2020
@tresf tresf added this to the 2.1.2 milestone Jun 24, 2020
@tresf
Copy link
Contributor Author

tresf commented Jul 10, 2020

Using Java's Robot class, I can take a screenshot and look at the luminosity of the top left pixel, but this has two disadvantages:

  1. It asks for permission to record the screen when the screenshot occurs
  2. It oddly fails when using the wallpaper "Catalina Silhouette". I assume the system menu-bar transparency is influencing this.

A second attempt is to grab the raw wallpaper instead using AppleScript:

osascript -e 'tell application "System Events"
   tell current desktop  
      get picture
   end tell
end tell'

... but due to the new Dynamic Wallpaper feature, this returns /System/Library/Desktop Pictures/Catalina Silhouette.heic, which isn't very helpful either, since heic files can't easily be read from Java and even if they could, knowing the current frame is going to be tricky.

The current frame is purported to live in ~/Library/Application\ Support/Dock/desktoppicture.db, meaning the following would expose the image, but this is a whole lot of work to detect something that the OS should have a way to report.

sqlite3 -readonly ~/Library/Application\ Support/Dock/desktoppicture.db \
    'SELECT * FROM data ORDER BY rowID DESC;'

Any help is appreciated. If an API is available, the Xcode beta and Big Sur should expose it. 🤷‍♂️

@tresf tresf changed the title macOS 10.16 Dark mode abiguity macOS 10.16/11.0 Dark mode ambiguity Jul 10, 2020
@tresf
Copy link
Contributor Author

tresf commented Aug 19, 2020

OpenJDK has accepted the bug report here: https://bugs.openjdk.java.net/browse/JDK-8252015

@Vzor- is actively working on a patch. More to follow.

@tresf tresf changed the title macOS 10.16/11.0 Dark mode ambiguity macOS 10.16/11.0 Dark mode System Tray ambiguity Sep 1, 2020
@tresf
Copy link
Contributor Author

tresf commented Sep 1, 2020

@Vzor- is almost done with the changes. I've proposed the changes to the AWT mailing list here: https://mail.openjdk.java.net/pipermail/awt-dev/2020-September/016085.html

@dyorgio
Copy link

dyorgio commented Jan 22, 2021

Hi @tresf, I created a hack to replace trayIcon created by JDK by an instance with setTemplate(true).
The code was only tested on Azul Zulu JRE (1.8 and 14) and BigSur.
Take a look: https://github.com/dyorgio/macos-tray-icon-fixer

@tresf
Copy link
Contributor Author

tresf commented Jan 25, 2021

Hi @tresf, I created a hack to replace trayIcon created by JDK by an instance with setTemplate(true).
The code was only tested on Azul Zulu JRE (1.8 and 14) and BigSur.
Take a look: https://github.com/dyorgio/macos-tray-icon-fixer

This works great, thanks for sharing! Will close this issue out once #745 is merged. I've linked your project on Stack Overflow, AdoptOpenJDK and privately to our JDK support provider. It's a very nice fix, thank you!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants