Open cem-okulmus opened 2 years ago
I can't reproduce that here. Does it happen in safe mode?
The gif you see there is in safe mode (I guess it's not easy to see unless you magnify).
Hmm, I'm not sure what's causing this. So I installed Ubuntu 21.10 on a VM and installed Sublime there, and yeah, I don't get it there, the colour switching works. I tried it again on my machine (outside the VM) when disabling all Gnome extensions (that don't already ship with Ubuntu) and it's still the same. I guess given that evidence, the bug must be due to something on my current installation of Ubuntu, but not sure how anything could cause only a single program to behave like this. I don't see issues like this with any other app that supports automatic switching to dark mode.
Does it switch color schemes after restarting ST?
It does not, it always stays at whatever color scheme was chosen for light theme. What exactly does Sublime look for (which API, or setting) to determine if the current mode on Linux should be light or dark? That might give a hint as to what's causing the problem in my current install of Ubuntu.
@cem-okulmus We grab the setting gtk-theme
from org.gnome.desktop.interface
, apply the theme to a GtkStyleContext
and grab the selected background color. If the background color has all 3 components < 0.5
we switch to dark mode.
I see the same issue with ST4126 on ElementaryOS 6.1. ST ignores any change between light and dark system themes. It always uses the light variant.
So, just as a minor update to this problem. I recently reinstalled Ubuntu for the new release 22.04. At first, Sublime Text suddenly had working colour scheme switching again. I brought over my old config data, and the bug reappeared. Before doing this, I had backed up the previous contents of the .config/sublime-text folder and restored it. However, this did not fix the issue, it remained. Is there perhaps some other folder where sublime is saving some config files?
At any rate, I believe the way Sublime Text is deciding which theme to apply is outdated, at least on Gnome 42, which ships with a new dark style preference, some info on it here https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/ . It seems like a new freedesktop standard, with implementations in multiple desktop interfaces and easily accessible via DBus. Trying to guess via looking up background colours feels very ad-hoc and unreliable in comparison to that, at least to me.
At any rate, I believe the way Sublime Text is deciding which theme to apply is outdated, at least on Gnome 42, which ships with a new dark style preference, some info on it here
I mention this here too: #5350
I have the same issue on Fedora 36 with standard GNOME+Wayland. I'm using an extension Night Theme Switcher to switch my system automatically between light and dark. Other apps switch, but not Sublime Text.
"theme": "Adaptive.sublime-theme",
"light_theme": "gruvbox.sublime-theme",
"dark_theme": "ayu-mirage.sublime-theme",
"color_scheme": "auto",
"light_color_scheme": "gruvbox (Light) (Medium) NDC.sublime-color-scheme",
"dark_color_scheme": "gruvbox (Dark) (Medium).sublime-color-scheme",
This happens with theme
as adaptive or "auto"
I wonder if my commit to the xfce4-night-mode switcher may help some. See how I had to include the gtk-theme
setting for the benefit of Sublime Text...
https://github.com/bimlas/xfce4-night-mode/commit/4c6ae90598880983123fabdbe3d43236117b0bbd
Description of the bug
The "auto" setting in colour scheme allows users to define two separate colour schemes, one for light mode and one for dark mode, and have Sublime switch to them if dark mode is turned on or off. This used to work and I believe the most recent update broke this (though this regression might be from an even earlier update and I just didn't notice or update until now).
Steps to reproduce
Expected behavior
You'd expect Sublime to switch to the chosen theme for light or respectively dark mode.
Actual behavior
The colour scheme stays the same, though the title bar does change (as that's provided by the shell, I'd assume).
Here is recording of the behaviour:
Sublime Text build number
4126
Operating system & version
Ubuntu 21.10
(Linux) Desktop environment and/or window manager
Gnome 40.4.0
Additional information
No response
OpenGL context information
No response