Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x11/wayland: always try the portal for appearance
Right now the initial x11 appearance retrieval uses the specific connection interface, which completely circumvents the already existing more complete implementation in x_and_wayland.rs. The latter implementation is strictly better, because it first attempts getting the appearance from the XDG desktop portal and then falls back to the X11 interface. Before this patch there was a very weird issue for folks using the OS system dark mode with the following config snippet: ``` color_scheme = scheme_for_appearance(wezterm.gui.get_appearance()) ``` The color_scheme on startup would be correct, but there would be a very weird problem where sometimes wezterm ignores the first time that the portal notifies about an appearance update. The source of the bug was an inconsistent retrieval of the appearance setting: - The Lua API used the XDG desktop portal - The internal appearance used the X11 specific connection at startup For example due to this, the internal appearance variable could have stored "Dark" from the X11 connection, but the actual appearance from the XDG desktop portal was "Light". If then the XDG desktop portal changes to "Dark", the appearance_changed() method would dismiss the update because self.appearance was already "Dark". It is only after that, that the internal inconsistency would have been solved and following appearance changes would succeed and update the colorscheme correctly. To fix this problem, we now use the portal directly in both the x11 and wayland connections, which is consistent with the Lua wezterm.gui.get_appearance() API. refs: wez#2258
- Loading branch information