Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-01-02 20:38:55

wbraswell
Member
Registered: 2024-01-02
Posts: 2

Make any program into a screensaver?

Why does `xscreensaver` support this, but `xfce4-screensaver` doesn't?

https://gitlab.xfce.org/apps/xfce4-scre … issues/141

"XScreensaver can run any command as screensaver and will put its locker over it (if password-locking is enabled)."
https://indigo.re/posts/2020-01-05-xscr … r-mpv.html

"Play any video as a screensaver with mpv and xscreensaver trick/hack"
https://www.linuxquestions.org/question … 175615234/

"I want to make my video to be a screensaver."
https://askubuntu.com/questions/21608/u … creensaver

Offline

#2 2024-01-03 10:38:30

Tamaranch
Member
Registered: 2020-12-31
Posts: 273

Re: Make any program into a screensaver?

wbraswell wrote:

"XScreensaver can run any command as screensaver and will put its locker over it (if password-locking is enabled)."
https://indigo.re/posts/2020-01-05-xscr … r-mpv.html

This is not true. As you can see in the link you quote, the contents of the XSCREENSAVER_WINDOW environment variable is passed to mpv, which must know what to do with it. So it's not xscreensaver that can execute any command as a screensaver, but the command in question that must be able to redirect its graphics output to the X11 window whose identifier xscreensaver passes to it (i.e. $XSCREENSAVER_WINDOW).

Now xfce4-screensaver also supports this mode of operation, which is why themes compatible with xscreensaver are also compatible with xfce4-screensaver.

Here's how it's done:

* Put this in /usr/libexec/xfce4-screensaver/mpv.sh

#!/bin/sh
exec mpv --no-audio --fs --loop=inf --no-stop-screensaver --wid=$XSCREENSAVER_WINDOW /foo/bar/some_video.mkv

* Put this in ~/.local/share/applications/screensavers/xfce-mpv-screensaver.desktop

[Desktop Entry]
Type=Application
Name=MPV
Exec=/usr/libexec/xfce4-screensaver/mpv.sh
TryExec=/usr/libexec/xfce4-screensaver/mpv.sh
Categories=Screensaver;

Don't forget to make the script executable.

NB: the use of exec in the script is to ensure that mpv is killed when the screensaver is disabled, otherwise only the script is killed and mpv is reparented.

Last edited by Tamaranch (2024-01-03 10:49:52)

Offline

#3 2024-01-04 03:58:28

wbraswell
Member
Registered: 2024-01-02
Posts: 2

Re: Make any program into a screensaver?

Yes, adding the `--wid=$XSCREENSAVER_WINDOW` parameter worked, thank you so much!
Tamaranch++

Offline

Board footer

Powered by FluxBB