Writing a bash script to display an animated background on LXDE (Pi 4)

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

Writing a bash script to display an animated background on LXDE (Pi 4)

Post by /RaspberryPi »

Hi all,
Attempting to write a script to play a moving animated mp4 in the background of my LXDE environment has proved a bit cumbersome. I have written the below script, but it only shows the video with a mouse and removes all of the desktop icons, taskbar, etc.
Is there a way to keep these present whilst still displaying a video in the background? I've attached the script I'm using below which uses the sdl video drivers.
#!/bin/bash
PIDFILE="/var/run/user/$UID/bg.pid"
declare -a PIDs
_screen() {
`xwinwrap -a -s -fs -st -sp -nf -ov -fdt -d -g "$1" -- mpv --fullscreen --no-stop-screensaver --vo=sdl --hwdec=v412m2m-copy --loop-file --no-audio --no-osc --no-osd-bar -wid WID --no-input-default-bindings "$HOME/Videos/Wallpapers/sakurasmoke.mp4" &` `PIDs+=($!)` }
while read p; do
`[[ $(ps -p "$p" -o comm=) == "xwinwrap" ]] && kill -9 "$p";` done < $PIDFILE
sleep 0.5
for i in $( xrandr -q | grep ' connected' | grep -oP '\d+x\d+\+\d+\+\d+')
do
`_screen "$i" "$1"` done
printf "%s\n" "${PIDs[@]}" > $PIDFILE

submitted by /u/StonedEdge
[link] [comments]

More...
Post Reply

Return to “Raspberry Pi Forum”