38 lines
915 B
Bash
Executable File
38 lines
915 B
Bash
Executable File
#!/bin/bash
|
|
|
|
PIDFILE="/var/run/user/$UID/bg.pid"
|
|
|
|
# Declare PIDs array
|
|
declare -a PIDs
|
|
|
|
_screen() {
|
|
# g specify geometry heightxwidth+xcoord+ycoord
|
|
# ni Ignore Input
|
|
# ov For Desktop background
|
|
# fs fullscreen
|
|
# vo=gpu gpu accelerated video output
|
|
# hwdec=vdpau use vdpau for gpu acceleration
|
|
xwinwrap -ov -ni -g "$1" -- mpv -fs\
|
|
--no-stop-screensaver\
|
|
--vo=gpu --hwdec=vaapi\
|
|
--loop-file --no-audio --no-osc --no-osd-bar\
|
|
-wid WID --no-input-default-bindings\
|
|
"$2" &
|
|
# Needs more testing not in fullscreen mode
|
|
#xwinwrap -ov -ni -g "$1" -- sxiv "$2" -f -b -a -e WID &
|
|
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
|