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

INFO: Jetbrains Runtime 21 has now an API to detect the OS theme #85

Open
bric3 opened this issue May 21, 2024 · 2 comments
Open

INFO: Jetbrains Runtime 21 has now an API to detect the OS theme #85

bric3 opened this issue May 21, 2024 · 2 comments

Comments

@bric3
Copy link

bric3 commented May 21, 2024

So this is not an issue report but more of a discussion or information.

It seems the latest JBR 21 build, has now an API to detect whether the OS is dark, that said, at this time the implementation seems to only support Linux.

            String[] themesOrder = {DARK_THEME_NAME, LIGHT_THEME_NAME, DARK_THEME_NAME};
            Toolkit.getDefaultToolkit().addPropertyChangeListener("awt.os.theme.isDark", evt -> {
                currentTheme = currentTheme();
            });

https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr-release-21.0.3b453.2
JetBrains/JetBrainsRuntime@16150a0
https://youtrack.jetbrains.com/issue/JBR-6376

This is needed for Linux in the first place, but if the API can be made generic, some stuff from IDEA on macOS/Windows can be moved there as well.
See IJPL-54591 for the discussion and suggestions. There are plugins that implement this, for example, here: https://github.com/weisJ/auto-dark-mode/blob/master/linux/gtk/src/main/java/com/github/weisj/darkmode/platform/linux/gtk/GtkThemeMonitorService.kt

@weisJ
Copy link
Owner

weisJ commented May 21, 2024

Great to hear. Maybe there is a future where this plugin isn’t needed after all 👍🏼

@bric3
Copy link
Author

bric3 commented May 22, 2024

Ideally this should be something in the the JDK upstream.

Like other window decorations like macos vibrancy, windows acrylic, etc. One can dream :)

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

No branches or pull requests

2 participants