aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/scripts/mpvbg
blob: 5afba5c9fc76c594b289fa6f44e08844e8e80a65 (plain)
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
#!/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