Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inhibit interface can silently fail #465

Open
randomdude999 opened this issue Jan 4, 2024 · 4 comments
Open

Inhibit interface can silently fail #465

randomdude999 opened this issue Jan 4, 2024 · 4 comments
Labels

Comments

@randomdude999
Copy link

First of all, I'm not sure if this is a bug in the gtk portal or rather a design issue with the XDG portal API itself.

Currently, the Inhibit provider in src/inhibit.c tries to use org.gnome.SessionManager and, if that fails, org.freedesktop.ScreenSaver. However, if the latter too fails, the provider will throw a warning, do nothing, and pretend to have succeeded (at least that's how it looks like in dbus-monitor). This gives no indication to application code that the inhibition didn't actually work, and prevents them from attempting fallback methods.

I don't know enough about DBus or XDG desktop portals to know whether it's even possible to report errors from this interface. If it isn't, that's not too bad, as this can be worked around in other places (i.e. by adding org.freedesktop.impl.portal.Inhibit=none to portals.conf). But if it was possible to handle in x-d-p-gtk, that would be great.

@TingPing TingPing added the bug label Jan 4, 2024
@YaLTeR
Copy link

YaLTeR commented Feb 11, 2024

Particularly, Firefox fails to inhibit idle in this fashion. It never reaches its Wayland inhibit-idle protocol fallback because the portal indicates success, even if there's no backend.

Moreover, if a backend exists and returns an error from Inhibit(), that too seems to be silently ignored.

whether it's even possible to report errors from this interface

I think it's possible to return an error from any DBus call.

this can be worked around in other places (i.e. by adding org.freedesktop.impl.portal.Inhibit=none to portals.conf)

...which is currently also broken: flatpak/xdg-desktop-portal#1254

@YaLTeR
Copy link

YaLTeR commented Feb 11, 2024

Actually, it appears that there's currently no way at all to have xdg-desktop-portal to return an error from an Inhibit() call. I've tried things like configuring an invalid impl for Inhibit, or even making my own impl for Inhibit and returning an error, the application always receives success from the Inhibit call. So fixing this issue in -gtk seems like it won't help at the moment.

@TingPing
Copy link
Member

TingPing commented Feb 14, 2024

Inhibit has a Request object and can set the results to failed there.

I looked into this and the code was just not structured to keep the Request around to set a result later, but I think it would work fine.

@YellowOnion
Copy link

Is there some way to get this prioritized, this bug is such a PITA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants