weisJ / auto-dark-mode

IDEA plugin to automatically apply system theme settings on macOS and Windows.
https://plugins.jetbrains.com/plugin/14076-auto-dark-mode
MIT License
53 stars 14 forks source link

IDEA 2020.3.1 on Gnome: Theme doesn't update automatically while running #27

Closed swsnr closed 3 years ago

swsnr commented 3 years ago

With IntelliJ 2020.3.1 on Gnome the plugin only changes the theme on startup or after restart, but while IDE is running. Is this intended?

weisJ commented 3 years ago

This certainly isn't supposed to be happening. I will have a look at what might be causing this.

swsnr commented 3 years ago

Can I do anything to debug it?

weisJ commented 3 years ago

It would be very helpful if you could install this version and provide the logs for when changing the gnome theme.

Edit: The linked version is currently broken. Just use the currently installed version for the log.

swsnr commented 3 years ago

Where do I find the logs? Sorry if that's a stupid question, but I have never debugged am Idea plugin before.

weisJ commented 3 years ago

Not a stupid question at all. You can find the logs under Help->Show logs

swsnr commented 3 years ago

There's an idea.log file but it shows no message if I tail -f it and change the theme via gsettings set. The only messages related to this plugin I can see are:

[…] INFO - tform.linux.gnome.GnomeLibrary - Loaded libauto-dark-mode-linux-gnome.so. 
[…] INFO - .platform.AbstractThemeMonitor - Started theme monitoring. 

Haven't noticed any exception :shrug:

swsnr commented 3 years ago

PS: As an additional data point, the theme updates also if I toggle the "Change editor/IDE theme" check boxes in the settings dialog of this plugin and press "Apply"…

It looks as if it perfectly picks up the current theme, but fails to get an event if the theme's changed.

weisJ commented 3 years ago

Yes it seems like the gnome settings hook doesn't fire when the settings change. Strangely enough it seems to be working when using the runIde gradle task. Are you using version 2020.3.1 or 2020.3? There might have been some changes in 2020.3.1 relating to how native libraries are handles in the jetbrains runtime (Which I hope is not the case).

swsnr commented 3 years ago

2020.3.1

weisJ commented 3 years ago

Indeed the signal, that the theme has been changed, doesn't notify the registered callback. It seems like this behaviour can't be replicated using the runIde task (there the theme detection works as expected). This makes it very difficult to debug the issue as this probably is related to how the plugin classes/libraries are loaded in the Jetbrains runtime (This is just speculation. The runIde task also used the Jetbrains runtime, so this probably isn't the full picture). I have submitted a bug report to Jetbrains, to get some clarification.

weisJ commented 3 years ago

This has been fixed in #34. A new version including the fix has been uploaded and should be available in at most 2-3 days.

swsnr commented 3 years ago

@weisJ Yeah, indeed :heart_eyes: Many many thanks for digging into this and fixing it :hugs: