Closed kuznecc closed 4 years ago
I’ll need some information from you:
Is this the first time you installed the plugin for the specific IntelliJ installation? If yes you will have to restart IntelliJ at least once. In the meantime you could switch your dark/light settings to accommodate the issue.
Do you experience the same issue if you change to dark/light mode in the official macOS settings?
Idea : 2020.2 MacOs : 10.15.6 I using your amazing plugin for a long time. The problem appears after the latest update, that I've made yesterday. To record the video I restarted the IDEA a bunch of times. Actually the bug can be reproduced right after the IDE startup. During a startup, the plugin sets the correct theme, but after I starting to switch them it doesn't do anything for the first 'change' and for all consequent changes starts to work but vise versa.
I tried to switch the macOS theme all the times with 'NightOwl' app. And seems this is a culprit. When I switch the OS theme with the OS system properties the plugin is working flawlessly. It's strange, bcz previously I didn't notice any issues. Sorry for bothering :(
Then I think I might know what is causing the issue. I’ll have to do some research on how NightOwl does it’s theme switching and see whether I can do something to support it.
The same issue with another approach, using hammerspoon. Maybe it will be easier to understand what is going on. https://github.com/dobrovolsky/dotfiles/blob/master/config/.hammerspoon/darkmode.lua#L45
The same issue with another approach, using hammerspoon. Maybe it will be easier to understand what is going on. https://github.com/dobrovolsky/dotfiles/blob/master/config/.hammerspoon/darkmode.lua#L45
This is just calling some javascript, so sadly not really helpful. I have already gotten an answer by the developer of NightOwl and from what he told me and based of your code snippet they both seem to use the same mechanic for changing the OS theme. Now I'll just have to figure out when I can reliably read the settings.
@dobrovolsky @kuznecc If you change to "Auto" mode in the settings and then toggle to dark/light mode using NightOwl do the settings also get switched to dark/light or do they stay in "Auto" mode?
@weisJ The setting in the macOS properties remains unmodified by toggling the NightOwl, but the theme is changing. And it's no matter which setting is set up in the macOS properties. The appearance is changing, but the macOS setting isn't.
@weisJ The setting in the macOS properties remains unmodified by toggling the NightOwl, but the theme is changing. And it's no matter which setting is set up in the macOS properties. The appearance is changing, but the macOS setting isn't. It's changed. Try to change theme, close settings and open again.
@weisJ Same behaviour for auto mode, themes are swapped. It works fine only when you change theme manually from settings. Will logs be useful for you?
@weisJ Same behaviour for auto mode, themes are swapped. It works fine only when you change theme manually from settings.
Do you mean Auto mode selected and the switching through NightOwl or Auto mode selected and waiting until the theme switches on it's own?
Will logs be useful for you?
At the moment I don't log any relevant information on the native side (primarily because of the overhead involved with dispatching the log message to IntelliJ from the native layer). I'm currently working on a debug build with more detailed logging.
What you could do for now though is run the following commands through the console after switching using NightOwnl
defaults read -g AppleInterfaceStyle
defaults read org.jetbrains.intellij NSRequiresAquaSystemAppearance
(I'm not sure if org.jetbrains.intellij
is the correct identifier. You can find out the correct one using osascript -e 'id of app "IntelliJ"'
)
Also please set your theme to light and then run the following:
osascript -e 'tell application "System Events"' -e 'tell appearance preferences' -e 'set dark mode to not dark mode' -e 'end tell' -e 'end tell'
defaults read -g AppleInterfaceStyle
Selecting auto mode and switching through NightOwl. It is really strange case sometimes themes change correctly, sometimes doesn't change or change in opposite way.
❯ defaults read -g AppleInterfaceStyle
2020-08-14 17:51:29.866 defaults[99208:844080]
The domain/default pair of (kCFPreferencesAnyApplication, AppleInterfaceStyle) does not exist
~
❯ defaults read com.jetbrains.pycharm NSRequiresAquaSystemAppearance
0
~
❯ osascript -e 'tell application "System Events"' -e 'tell appearance preferences' -e 'set dark mode to not dark mode' -e 'end tell' -e 'end tell'
~
❯ defaults read -g AppleInterfaceStyle
Dark
@weisJ thanks for a workaround but honestly it's easier to switch the macOS theme with the OS system preferences instead of the NightOwl than to execute some console commands in advance to it.
The command isn’t meant to be a workaround but for me to see what the output is.
@weisJ Sorry, I miss understood
-- > before NightOwl
~ % defaults read -g AppleInterfaceStyle
Dark
~ % defaults read com.jetbrains.intellij NSRequiresAquaSystemAppearance
0
--> after nightOwl
~ % defaults read -g AppleInterfaceStyle
2020-08-14 22:01:33.167 defaults[24656:4031128]
The domain/default pair of (kCFPreferencesAnyApplication, AppleInterfaceStyle) does not exist
~ % defaults read com.jetbrains.intellij NSRequiresAquaSystemAppearance
0
Switched OS to the Light theme
--> before nightOwl
~ % defaults read -g AppleInterfaceStyle
2020-08-14 22:06:07.982 defaults[24879:4035748]
The domain/default pair of (kCFPreferencesAnyApplication, AppleInterfaceStyle) does not exist
~ % defaults read com.jetbrains.intellij NSRequiresAquaSystemAppearance
0
~ % -- after nightOwl
~ % defaults read -g AppleInterfaceStyle
Dark
~ % defaults read com.jetbrains.intellij NSRequiresAquaSystemAppearance
0
~ % osascript -e 'tell application "System Events"' -e 'tell appearance preferences' -e 'set dark mode to not dark mode' -e 'end tell' -e 'end tell'
defaults read -g AppleInterfaceStyle
Dark
@weisJ thanks for a workaround [...]
Does this mean using the command actually switches the IDE theme correctly?
I have made some changes to how dark mode is detected which should make it more stable. @kuznecc @dobrovolsky could you please install the following version and check whether it works for you (Install from disk can be found by pressing the gear icon in the plugins tab)? Please uninstall any previous versions of the plugin and restart beforehand.
It's impossible to add the custom plugin version. The mac and base version fails to install, the auto-dark-mode-plugin-1.5.0-2020.2-night-owl-support.jar hangs my IDE and it's impossible to restart the IDE or start it after 'Force Quit'.
(previously I uninstalled the old version and restarted the IDE)
You have to install the whole .zip
file.
@weisJ Thanks. Successfully installed and this time the automatic theme switching works correctly. You did an amazing job!
@weisJ Works great. Thank you!
Great. I’ll release a new version with the changes as soon as possible.
Edit: New version should be up within the next two days.
The fix is now available with version 1.5.1
After the last update, I noticed the strange behaviour of a plugin. It looks like the plugin sets the IDE theme vice versa to the OS theme. Here is a video below.
Here are the plugin settings