Video live wallpaper for GNOME, Xfce or bspwm desktop

This article explains how to use live streaming as desktop wallpaper on GNOME, Xfce or bspwm with X11 (not for Wayland). The live video stream can be any stream you like (for example, a live city camera or ISS live feed), as long as Streamlink supports it.
It is important to note that using this live wallpaper will lose the desktop icon functionality. This is because the desktop icon will appear behind the live video wallpaper. This is the case with Xfce and the GNOME desktop where Nautilus draws the desktop, and the Desktop Icons GNOME Shell extension. This is not a problem if you use multiple monitors, as you can place the desktop icons on a different monitor than the live streaming video wallpaper.
You might think this would consume a lot of CPU. On my Ubuntu 19.04 desktop, set the mpv to use hardware-accelerated video decoding. According to htop, the 1080p real-time video source used as my desktop wallpaper uses only about 2-3% of the CPU (hence the single-core 2- 3%), so it is basically negligible. However, if there is no hardware video decoding, according to htop, mpv usage is between 30% and 35%, so yes, this is a bit too much. Therefore, make sure to use mpv with hardware acceleration for this purpose.
This is short video Show live wallpapers on my Ubuntu 19.04 (GNOME) desktop using live video display in New York: you need:

  • Using GNOME, Xfce or bspwm with X11 (other desktops may work, but in my attempts, it did not work as I did on KDE Plasma or MATE; I have not tried others)
  • Real-time video streaming, such as YouTube video real-time streaming, ISS real-time feed, real-time webcam in some cities, etc.
  • Stream link Extract stream and play with mpv
  • mpv 0.29.1 or higher to play live video (it may be compatible with some older versions, but the window border did not disappear when tested with mpv 0.27.2, so you may need to update if you encounter this issue mpv version)
  • Xwinwrap fork (The link points to the Xwinwrap branch with some enhancements, other versions may not work properly.) Pasting mpv to the desktop background requires

Here are some live video feed examples that you can use as a GNOME or bspwm desktop wallpaper:

Related: Using GLava to Embed Audio Visualizers on a Linux Desktop Background (PPA Installation and Configuration Guide)

Install the programs needed to use a live video feed as your desktop wallpaper

1. Install mpv
Debian buster & sid / Ubuntu 19.04, 19.10, or 20.04 (due to the need for the latest mpv; for Ubuntu 18.04’s PPA, see below):

                        sudo apt install mpv

If not already enabled, enable the RPMFusion repository:

                        sudo dnf install$(rpm -E %fedora).noarch.rpm

sudo dnf install$(rpm -E %fedora).noarch.rpm

And install mpv:

                        sudo dnf install mpv jack-audio-connection-kit

I added jack-audio-connection-kit To the mpv installation command, because mpv does not depend on this package in Fedora 30, but it cannot be started without it (display error: mpv: error while loading shared libraries: cannot open shared object file: No such file or directory ).
-Arch Linux:

                        sudo pacman -S mpv

Like I mentioned at the top of the article, you will most likely need mpv 0.29.1 or higher. It may work for some older versions, but when testing with mpv 0.27.2, the window border did not disappear, so if you encounter this issue, you may need a newer mpv version. Ubuntu 19.04 has mpv 0.29.1, which works for older Ubuntu versions, such as Ubuntu 18.04. You can use PPA .2. Install Xwinwrap
-Ubuntu / Debian: You can find step-by-step installation instructions on the Xwinwrap branch (from source) GitHub Project Home . There is also a DEB package Here (It works on newer Ubuntu versions, including Ubuntu 18.04 and 19.04, 19.10, or 20.04).
-Arch Linux: There is one AUR package Xwinwrap (fork) If you use other Linux distributions, you need to find out which dependencies need to be installed from the package names listed on Debian / Ubuntu. Xwinwrap GitHub project page, then follow the instructions there to compile 3. Install Streamlink
-Debian / Ubuntu:

                        sudo apt install streamlink


                        sudo dnf install python3-streamlink

-Arch Linux:

                        sudo pacman -S streamlink

On other Linux distributions, see Streamlink installation page On Ubuntu 18.04 (and later) Streamlink may be too old to play some streams. For example, on my Ubuntu 18.04 laptop, it cannot play YouTube streams. In this case, you can download the newer Streamlink from Ubuntu 19.04, which will run in older Ubuntu versions (at least available in Ubuntu 18.04). You need to download and install 2 packages (click on any mirror on this page to download the DEB):

If using the GUI to install the DEB package, please start with python3-streamlink before installing the streamlink DEB package. Related to wallpapers: how to set a different background for each monitor on Gnome

Create 2 scripts needed to use live broadcast as wallpaper

As a reminder, Xorg is required to use this feature. For example, Fedora uses Wayland by default, so if you want to use it on Fedora, log out and select from the login screen Gnome on Xorg , Then log in to 1. Create 2 scripts that will be used to get the live broadcast and set it as the desktop background.
To use the live stream of your choice as your desktop background, you need to create 2 scripts. Create 2 files named with In a named scripts In your home directory (so the script path is ~/scripts/ with ~/scripts/ ). You can use other paths and script names, but you need to replace all the scripts mentioned in my instructions with custom names and paths! Related: How to Embed Google Calendar Widget on Linux Desktop Background Script, save file:

                        #!/usr/bin/env sh
xwinwrap -fs -fdt -ni -b -nf -- ~/scripts/ WID

This is what each Xwinwrap option used in this code means:

  • -fs : full screen
  • -fdt : Use WID window as desktop type window
  • -ni : Ignore input (so player controls do not appear on mouseover, etc.)
  • -b : Bottom (hence the live window is displayed below the other windows)
  • -nf : No emphasis

Those who want to specify the resolution, delete -fs (Full screen) and add -g WxH For example, change to (W = width, H = height) -g 1920x1080 . If you use two monitors, you need to specify the complete geometry: -fs versus -g WxH+X+Y (W = width, H = height, X = x coordinate, Y = y coordinate). For example, if you have two monitors, both using a screen resolution of 1920×1080, and you want to display live wallpapers on a second monitor (the one on the right), use: -g 1920x1080+1920+0 . Another example: If the monitor on the left uses a screen resolution of 2560×1080 and the monitor on the right uses 1920×1080, and you want the live wallpaper to appear on the monitor on the right, use -g 1920x1080+2560+0 .
These options are enough to get a live background on my Ubuntu 19.04 Gnome desktop, but if you run into problems, there are more options available and you can Xwinwrap page . inside The script uses this code and saves the file:

                        #!/usr/bin/env sh
streamlink -p "mpv --no-audio --wid=$1" best

In this script, I am using the Amsterdam live video feed on YouTube, but as long as Streamlink supports it, you can use any live broadcast you need. All you have to do is replace the YouTube link in this script with the live video feed you want to use. I originally wanted to use the ISS Earth View cam as an example, but when the International Space Station is on Earth’s night, it is black, so you might think that if you test it in black, it won’t work properly.
and also, best The best quality is used after the URL. You can run streamlink URL See all available qualities.
It is worth mentioning that mpv supports hardware decoding, so its CPU usage is very low. See This one with This one Information link.
For example, after installing the required packages, you can enable VA-API hardware video decoding with the following command --hwdec=vaapi --vo=vaapi (So ​​the streamlink line in the script becomes streamlink -p "mpv hwdec=vaapi --vo=vaapi --no-audio --wid=$1" best ) Or VDPAU use --hwdec=vdpau --vo=vdpau .2. Make the script executable

                        chmod +x ~/scripts/
chmod +x ~/scripts/

3. Set live broadcast as wallpaper
It’s time to set up live streaming for your wallpaper. To change the desktop background to live video, you need to run Script-open a terminal and run it:


4. (Optional) Run live wallpaper on startup
If your desktop has the option to add a script to startup (such as the “Launch Application” application in Ubuntu), use it to add sh -c "~/" (Enter this in the Command box) to run after you log in.
If you don’t have a GUI to add startup applications and scripts, you can do this by creating a file called livestream-wallpaper.desktop In ~/.config/autostart/ (If it does not already exist, create this folder), its contents are as follows:

                        [Desktop Entry]
Exec=sh -c "~/scripts/"
Name=Livestream wallpaper

Get rid of ~/.config/autostart/livestream-wallpaper.desktop File if you no longer want to launch the live wallpaper automatically when you log in.
Idea and two scripts pass Reddit (R / unixporn- special thanks to u / lukedoomer and u / Invayder)


Related Posts