-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Linux: Use D-Bus to inhibit screensaver #13076
base: master
Are you sure you want to change the base?
Conversation
@dolphin-emu-bot rebuild |
Do you have any insight into why there is such a proliferation of different APIs? |
It doesn't? I mean, it's supposed to be a (messy) abstraction of what you are doing. It contains snippets such as: dbus-send --session \
--dest=org.freedesktop.ScreenSaver \
--type=method_call \
--print-reply \
--reply-timeout=2000 \
/ScreenSaver \
org.freedesktop.ScreenSaver.Inhibit \
string:$window_id \
string:xdg-screensaver \
| grep uint32 | cut -d ' ' -f 5 >| "$screensaver_file.cookie" \
2> /dev/null which is actually what you are doing here: 643fc02#diff-729adc8bd1360f1b27c4ff23c72fb382d0d24e9c12f5ad937257894b6187c4e6R94 |
@Tilka The idle-inhibit spec (org.freedesktop.ScreenSaver) was supposed to be a unified effort by Gnome and KDE developers to replace their own (incompatible) APIs, but it hasn't been widely adopted by other desktop environments. The MATE and Xfce ones are just (IMHO unnecessary) forks of the older org.gnome.ScreenSaver interface. Then there's the XDG Desktop Portal (org.freedesktop.portal.Desktop) interface, which was designed to support sandboxing for Flatpak and has a few extra features. But again, the inhibit feature isn't widely supported outside KDE and Gnome yet, and the KDE implementation had a bug that prevented it from working until just last month. In summary, it's just https://xkcd.com/927/. Hopefully in the future the portal API will become widely adopted and we can drop all the others. |
@randomstuff The problem with the dbus-send method is that it runs as a separate executable so it can't keep the connection to the D-Bus socket open. That results in the session manager ending the inhibition immediately, as required by the specification:
With this new change, the message is sent through the connection opened by Qt for other purposes, and kept open for the life of the application. This ensures the screensaver stays suspended for as long as necessary. |
643fc02
to
2748771
Compare
This is a fix for https://bugs.dolphin-emu.org/issues/10392, which has been a problem for at least 7 years now. I've implemented support for several D-Bus interfaces to inhibit the screensaver on Linux, which covers all the desktop environments that I could find that support it. As the xdg-screensaver method doesn't work at all any more, I've removed it completely.
As this uses Qt's D-Bus module, it requires dolphin-emu-nogui to be linked against libQt6DBus.so as well. This only happens if Dolphin is built with Qt enabled, otherwise it is simply skipped. If this isn't acceptable, I can move it into DolphinQt instead.