Play a movie as screensaver in KDE
Thursday, 3 March 2016
Did you ever want to play a video as screensaver? With KDE this is pretty easy.
- First, you need a video player. I choosed mpv, but mplayer will also do.
- Second, you need a video. Store it in a public readable place, for example in /opt/cats.mp4. This is not exactly required in a single-user environment, but since your screensaver will be available to all users it is a nice idea. Of course you could also place it in another directory like /etc/screensaver and/or symlink to the real file. This will make it easier to replace the actual video file.
- Third, create a custom screensaver service file for KDE:
/usr/share/kde4/services/ScreenSavers/kcats.desktop
[Desktop Entry] Exec=mpv --loop=inf -ao=null /opt/cats.mp4 Icon=kscreensaver Type=Service X-KDE-ServiceTypes=ScreenSaver Actions=Setup;InWindow;Root; Name=Custom Video [Desktop Action InWindow] Exec=mpv --loop=inf -ao=null --no-keepaspect --wid=%w /opt/cats.mp4 Name=Display in Specified Window NoDisplay=true [Desktop Action Root] Exec=mpv --loop=inf -ao=null --no-keepaspect --wid=0 /opt/cats.mp4 Name=Display in Root Window NoDisplay=true On an Intel NUC I had also to append '-vo=x11' to the option's list.
The exact location of the ScreenSavers directory may depend on your distribution. If unsure, try to locate it with:
$ find /usr -type d -name ScreenSavers
- Finally, open the Lock Screen menu from KDE's settings and select your custom screensaver.