#!/bin/sh

# for some reason this still kills all xwinwrap processes
kill -9 `pgrep xwinwrap | head -1`

# pick out the music video we want to play in the background
pape_name=`ls "${HOME}/Videos/Papes/" | dmenu -i -l 10 -p 'Pick a papes :^)'`

mpv="mpv -wid WID --no-config --keepaspect=no --loop \
    --no-border --vd-lavc-fast --x11-bypass-compositor=no \
    --gapless-audio=yes --vo=x11 --hwdec=auto --input-ipc-server=/tmp/mpv-bg-socket \
    --x11-name=mpvbg"


# The magic here happens with xwinwrap the flags given to mpv don't really matter
# unless you have an mpv config the flags below are pretty much the only flags you 
# need to get this working
xwinwrap -g 1920x1080+0 -ov -b -un -sh rectangle -fdt -ni -- \
	$mpv "$HOME/Videos/Papes/$pape_name" & 

# welcome to the rice fields