diff options
Diffstat (limited to 'dotfiles/scripts/mpvbg')
-rwxr-xr-x | dotfiles/scripts/mpvbg | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/dotfiles/scripts/mpvbg b/dotfiles/scripts/mpvbg new file mode 100755 index 0000000..5afba5c --- /dev/null +++ b/dotfiles/scripts/mpvbg @@ -0,0 +1,27 @@ +#!/bin/bash +# +# http://github.com/mitchweaver/bin +# +# play a video on the root window +# +# Multi screen mode by neodarz + +[ -f "$1" ] || exit 1 + +pkill -9 xwinwrap + +readarray -t screen_connected < <(xrandr | grep " connected") +nb_screen_connected=${#screen_connected[@]} +for (( num_screen=0; num_screen<$nb_screen_connected; num_screen++)); do + screen_geo=$(echo ${screen_connected[num_screen]} | awk '{ print $3 }') + + xwin="xwinwrap -ni -fdt -sh rectangle -un -b -nf -ov -g $screen_geo -- " + + mpv="mpv --wid WID --no-config --keepaspect=no --loop \ + --no-border --vd-lavc-fast --x11-bypass-compositor=no \ + --gapless-audio=yes --vo=xv --hwdec=auto --really-quiet \ + --name=mpvbg" + + $xwin $mpv "$1" > /dev/null 2>&1 & + echo -n $! > ${HOME}/.cache/mpvbg-$num_screen.pid +done |