weisJ / auto-dark-mode

IDEA plugin to automatically apply system theme settings on macOS and Windows.

Home Page:https://plugins.jetbrains.com/plugin/14076-auto-dark-mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong 'Editor Theme' is applied when switching to dark mode

opened this issue · comments

I have this amazing plugin on Android Studio Arctic Fox (2020.3.1) running on Ubuntu 21.04 (GNOME 3.38.5) and only one minor issue, as the title suggests the wrong editor theme is applied after auto-switching to dark mode!

I have selected "Dracula" as my night 'IDE Theme' and a customized color scheme for my 'Editor Theme' but when switching, 'Dracula' is applied as both the IDE and the Editor theme!

Thank you for reporting this issue! Does this only happen with your custom editor theme or with all themes?

Not sure about other editor themes, will test and report but I noticed that it only happens while Android Studio was running! Like if I suspend my machine before the sunset with Android Studio running in the background, and wake it up at night (by this time Ubuntu instantly switches to dark mode on login) I face this issue then!

This behavior is not observed when executing Android Studio AFTER the OS has switched to dark mode.

I’ll try to replicate the issue but anything related to waking up after sleep mode is notoriously difficult for me to debug as I am using a VM for Gnome development.

I am guessing everything works as expected if you change your settings and hit apply?

I confirmed and reapplied the settings a few times, actually it's my only option when the wrong theme is applied!

I take back my previous statement, it also happens in new launches not only during sleep. And when I check the plugin settings, the wrong themes are also selected, and I have to select the customized themes again and click Apply.

I'll attach the idea.log, hope it helps. If you need anything else I'd be more than glad to help.
idea.log

I'm not sure what's the cause of this issue but I have a suggestion maybe if it will help: How about we introduce some delay (like 1 sec) after applying the IDE theme and then apply the Editor theme over?
Because it seems like whatever IDE theme is chosen takes precedence over Editor themes!

Honestly this feels like a rather hackish solution. If there are problems due to timing adding artificial delays will only make the issue more difficult to reproduce. Would you mind sharing the editor scheme you are using?

Not at all, here you go:
Color-Schemes.zip
The IntelliJ Light Customized is used for day time, and the One Dark Customized for the night time.

The reason I suggested the above workaround is that I notice a delay like a second or two when changing my IDE themes and it seems like a heavy operation on my machine, I thought maybe this takes a long time and by the time the plugin has changed the the editor theme, our IDE theme just finished applying and hence overriding the editor theme (since IntelliJ always applies the embedded color scheme too for any IDE theme)!

If this is really the case, are there any time-aware APIs for changing themes? Like a callback to make sure the IDE theme is completely applied now, and we can safely proceed to apply the editor color scheme over?

Thank you for your attention!

I made some changes in #43 which should in theory fix the issue you are experiencing. Are you comfortable with building the plugin locally to try it out? If not I can provide a build for you.

I made some changes in #43 which should in theory fix the issue you are experiencing. Are you comfortable with building the plugin locally to try it out? If not I can provide a build for you.

That's great thank you, I'd appreciate a build if it's okay.

Okay, I tried building the PR you mentioned and I get the following error after ./gradlew :auto-dark-mode:buildPlugin :

FAILURE: Build failed with an exception.

* What went wrong:
Project 'auto-dark-mode' is ambiguous in root project 'auto-dark-mode'. Candidates are: 'auto-dark-mode-base', 'auto-dark-mode-linux', 'auto-dark-mode-linux-gnome', 'auto-dark-mode-macos', 'auto-dark-mode-plugin', 'auto-dark-mode-windows'.

What am I doing wrong?

Sorry for not getting back to you sooner. You don't need to specify the name of the root-project with gradle gradlew build should work fine. Anyhow I have attached a build for you:
auto-dark-mode-plugin-1.6.2-2021.2-patch-1.zip (Just drag&drop into the plugins tab in the settings).

It's okay, thank you for the build but when I try installing it, I face this error:

Plugin 'Auto Dark Mode' (version '1.6.2-2021.2-patch-1') is not compatible with the current version of the IDE, because it requires build 212 or newer but the current build is AI-203.7717.56

I'm on the latest stable version of Android Studio Arctic Fox.

This version should be compatible with the IDEA version used by Android Studio:
auto-dark-mode-plugin-1.5.4-2020.3-patch-1.zip

Thanks for the new build, installed it and manually changed my OS theme from light to dark and vice versa many times to test the plugin, it seems like only the Light Editor theme is correctly applied and for dark mode the default Dracula IDE theme is applied both as the IDE theme and the Editor theme, while I have selected the above mentioned One Dark Customized!

I even changed the settings once and re-selected my themes and re-applied but to no avail.

Any progress on this?

I have recorded a screen cast depicting the issue I described earlier (the dark editor theme being broken), I hope it helps.

Thank you again for you time!

Peek.2021-11-17.17-16.mp4

I’m sorry that I couldn’t invest much time into this issue. Other things currently take a lot of my time and I didn’t got to spend as much time on my projects as I would like. This is still on my todo list so please be patient. Hopefully I’ll get around to work on this at the weekend :)

No worries! ;)
Take your time, wish you good luck with whatever has been keeping you busy. :)

After testing the latest version 1.6.2 on Fedora 36, I can confirm this is fixed but there's another issue with the new libadwaita migration on GNOME 42 which I'll create a new issue for that promptly!

Thank you for all the hard work put into this amazing plugin!