winit: Bug Report: Window Fails on Wayland When `color-theme` setting is missing
When trying to create a window, I get the message ERROR sctk_adwaita::config > XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme. As it turns out, I don’t have the color-scheme setting on my system. I tested with the command dbus-send --print-reply=literal --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:org.freedesktop.appearance string:color-scheme and got the reply Error org.freedesktop.portal.Error.NotFound: Requested setting not found. I will have to mess with my own system so it’ll have the setting, but there should be a way to bypass this and fallback to the theme the developer wants if auto is not available. For example, I would fallback to dark theme if this setting failed to be found.
The only ways I’ve been able to get the window to create is if I either launch the game with WINIT_UNIX_BACKEND="x11" such as with WINIT_UNIX_BACKEND="x11" RUST_LOG="debug" cargo run or if I log out of Wayland and switch over to X11 on my system.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (8 by maintainers)
@anelosima are you testing on the master or on 0.28.6? It doesn’t have to do with running executables or anything and it’s the default across other applications, like GTK. It just on linux the way to get the theme is via the dbus, so some clients just call to dbus method to pick a theme. Winit can avoid all of that if you use the
with_themeAPI and set the theme explicitly todarkorlight.It basically means that your portals don’t have all the env, etc available to them when they were activated via dbus, I hate this very much, but that’s what folks decided to go with, because they need ways to communicate preferences to flatpaks somehow.
Usually you need something like
c --no-startup-id dbus-update-activation-environment --allwhen you start your system in a bit non-standard way, and things likeXDG_CURRENT_DESKTOPfilled.I’m not sure what is the best way forward with this, since if winit fails it means that basically any other GTK fails, but we should still run, there’s no way winit or GTK won’t start in such cases, if they do, then it’s a completely different issue.
If you read the documentation on the theming, you have all the rights to disable this behavior, by simply picking a theme yourself when building a window. It’s all documented.