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

Use org.freedesktop.ScreenSaver interface instead of gnome's one #34

Merged
merged 2 commits into from
Jul 29, 2022

Conversation

pa-sowa
Copy link
Contributor

@pa-sowa pa-sowa commented Jul 28, 2022

Now it should work on most Linux desktop environments and not only on Gnome. Tested on KDE.

@W-Floyd
Copy link
Owner

W-Floyd commented Jul 28, 2022

This doesn't seem to be implemented under GNOME (ugh). Perhaps we should detect if we're running under GNOME, and use the old method if so, but otherwise use the proposed call? XDG_CURRENT_DESKTOP should be the required variable - I can work on this, or let you add that if you want.

Edit: Quickly tested this

    case "${XDG_CURRENT_DESKTOP}" in
    "GNOME")
        dbus-send --print-reply --session --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.GetActive | tail -n 1 | grep -Eo '[^ ]*$'
        ;;
    *)
        dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.GetActive | tail -n 1 | grep -Eo '[^ ]*$'
        ;;

    esac

If that works for you, you can commit it and I'll merge. Thanks for taking the time to look at this!

@pa-sowa
Copy link
Contributor Author

pa-sowa commented Jul 29, 2022

After some research, I found out that this isn't part of the official freedesktop specification. It was introduced by KDE but unfortunately Gnome didn't follow (https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/632).
For that reason, I think it's better to make it explicit in code which DEs are supported.

@W-Floyd
Copy link
Owner

W-Floyd commented Jul 29, 2022

Good catch. I'm fine with DE specific code, but I do want a fallthrough for all other DEs, even if it's just an error stating "unknown DE, sorry". I'll go ahead and merge for now though, thanks!

@W-Floyd W-Floyd merged commit 11ae587 into W-Floyd:main Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants