PolyMeilex / sctk-adwaita

Adwaita-like SCTK Frame
MIT License
27 stars 19 forks source link

Handle xdg-desktop-portal-wlr color-scheme error gracefully #33

Closed ghost closed 3 months ago

ghost commented 1 year ago

Would it be possible to gracefully handle portal on wlroots compositors not finding color-scheme with a warning or info message instead of error? From what I read, this isn't planned (https://github.com/emersion/xdg-desktop-portal-wlr/issues/173) to be implemented in xdg-desktop-portal-wlr.

PolyMeilex commented 1 year ago

Sorry I don't full understand the request, you mean just lowering the log level for the message? Or is the library behaving in an unexpected way when it can't find the color-scheme value?

ghost commented 1 year ago

Sorry, I was testing latest wgpu and saw the error. Since it's only logged (in config.rs) without changing behavior, lowering the level to debug is sufficient. You may want to turn it into a warning or info, which I can understand. But at the moment wlroots compositors will always fail to respond here, and the log message will be visible in daily use, without a way to fix it. Therefore I vote for debug level, if you're okay with that.

PolyMeilex commented 1 year ago

without a way to fix it

Well, settings portals are compositor agnostic, you could run one even in raw TTY, so you can simply run one like GTK portal (do not confuse with gnome portal) alongside wlr one, and as far as I remember that's the recommended way to get settings portal as well as system file dialogs support in sway.

But that's unrelated to the issue, will probably lower the log level anyway.

kchibisov commented 1 year ago

You've likely haven't exported environment to the portals running. it's a bit racy on sway for example.

ghost commented 1 year ago

You've likely haven't exported environment to the portals running. it's a bit racy on sway for example.

I thought I was doing what's necessary by running the official sway package and making sure to source /etc/sway/config.d/* as the last line of sway's config. Anything I'm missing?

kchibisov commented 1 year ago

You need this exec --no-startup-id dbus-update-activation-environment --all as the first line in the config iirc. it's in the sway wiki.

ghost commented 1 year ago

Thanks for the directions, putting this at the start of sway's config works:

exec systemctl --user import-environment WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP

Line 1 is probably unnecessary, but it's what the Arch package has in /etc/sway/config.d/50-systemd-user.conf.

I also wrote a wrapper script to launch sway with greetd, as that's the right way to import the shared systemd user environment variables.

kchibisov commented 1 year ago

Yet, your issue has nothing to do with this issue. I'd suggest to continue it on #sway channel.