Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x11: get initial appearance from generic connection
Right now the initial appearance retrieval uses the x11 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, whereas right now we are only using 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 a colorscheme change. All following colorscheme change notifications would be processed correctly. 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. To fix this problem, we now read the appearance setting from the generic connection which is consistent with the Lua wezterm.gui.get_appearance() API. refs: wez#2258
- Loading branch information