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

Enhancement: Use xdg-screensaver for broad desktop environment support #30

Open
refola opened this issue Apr 28, 2019 · 1 comment
Open

Comments

@refola
Copy link

refola commented Apr 28, 2019

Reason: An xdg-utils package should be present in all Linux/BSD distributions updated in the past decade. This package is a standardized way for apps to have cross-desktop-environment compatibility/integration. In particular, it supports screensaver management via xdg-screensaver. They also encourage bundling whichever xdg tools you use for a stronger compatibility guarantee; the license looks BSD-like.

If I'm right about xdg-screensaver working on all distros that people want to run this on, then you can simultaneously fix issues #6 and #19 (and prevent future issues of that sort until desktop environments stop supporting xdg-utils) by removing lines 55-68 (screensaver detection) and replacing lines 191-212 with delayScreensaver() { xdg-screensaver reset; }

To test if this would work on a given system, run xdg-screensaver status. It should print enabled if you're on a modern-ish system with a screensaver. If you want to test with a video, here's a Bash/Zsh/sh one-liner: while true; do xdg-screensaver reset; sleep 50; done

In theory, media-playing apps like VLC and browsers should be running xdg-screensaver suspend WindowID with the ID of whichever window is playing media. In practice, they're not all doing that properly or lightsOn.sh wouldn't exist. ;-)

.

(Personal xdg-screensaver and lightsOn.sh experience, incidental advert for my code, and long run-on sentence: This is essentially what I do in my own lights-on.sh script that was originally copy-paste-forked from lightsOn.sh, minimized and fixed for just KDE4, split into a pair of scripts for enabling/disabling "keep screen on" mode, deleted out of frustration when updates way later broke it again, and rewritten from scratch just a few hours ago.)

@LinuxOnTheDesktop
Copy link

For information: on Linux Mint 19.2 Cinnamon - where I am having a hard time working out how to programmatically inhibit the screensaver - xdg-screensaver status returns disabled.

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

No branches or pull requests

2 participants