33 lines
749 B
Bash
Executable File
33 lines
749 B
Bash
Executable File
#!/bin/bash
|
|
|
|
PIDFILE="/var/run/user/$UID/bg.pid"
|
|
|
|
# Declare PIDs array
|
|
declare -a PIDs
|
|
|
|
_screen() {
|
|
# TODO Replace with -wid=WID somehow
|
|
xwinwrap -ov -ni -g "$1" -- mpv --fullscreen\
|
|
--no-stop-screensaver\
|
|
--vo=gpu --hwdec=yuv420p\
|
|
--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
|