-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimatebg
executable file
·36 lines (31 loc) · 925 Bytes
/
animatebg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
vidfile=$1
pidfile=$HOME/.cache/animatebg.pid
killvid() {
if [ -e "$pidfile" ]; then
for l in $(cat $pidfile)
do
pkill -P $l
kill -s TERM $l
done
rm $pidfile
fi
}
if [ -z "$vidfile" ]; then
echo "No video/GIF file provided."
exit 1
elif [ ! "$vidfile" = "kill" ]; then
killvid
if [ "${vidfile: -4}" == ".gif" ]; then
/usr/bin/xwinwrap -g "$(xrandr --nograb --current | awk '/\*/ {printf $1; exit}')+0+0" -ni -s -nf -b -un -argb -fdt -- \
/usr/bin/gifview -a -w WID $vidfile &
else
/usr/bin/xwinwrap -b -argb -un -s -g "$(xrandr --nograb --current | awk '/\*/ {printf $1; exit}')+0+0" -ni -nf -fdt -- \
/usr/bin/mpv -wid WID --no-config --keepaspect=no --loop \
--no-border --vd-lavc-fast --x11-bypass-compositor=no \
--aid=no --vo=xv --hwdec=auto --really-quiet "$vidfile" &
fi
echo $! > $pidfile
else
killvid
fi