Cleaning up newbga so its readable and hopefully helps those lost trying to do this animated background thing
This commit is contained in:
parent
9f914614a9
commit
0d0f48e44f
54
newbga
54
newbga
@ -1,47 +1,33 @@
|
||||
#!/bin/sh
|
||||
# Shoutout to mitchweaver on gitgub for the script as a useful base for this one
|
||||
# Link to exact script: https://github.com/mitchweaver/bin/blob/master/mpv/mpvbg
|
||||
# Link to exact script: https://github.com/mitchweaver/bin/blob/41f3d5c6cbc92173be232e48fd24213c91a16db1/mpv/mpvbg
|
||||
# Original version of the script that I used to find this script
|
||||
# There's lots of good scripts in that repository so check them all out
|
||||
|
||||
pkill -9 xwinwrap
|
||||
cacheFile="${HOME}/.cache/mpvbg.pid"
|
||||
base="/home/shockrah/Pictures/VPapes"
|
||||
#
|
||||
#cacheFile="${HOME}/.cache/mpvbg.pid" # used in case we want a second proc but honestly kill + pgrep works
|
||||
base="/home/shockrah/Videos/Papes"
|
||||
|
||||
# Pic two random video papes
|
||||
pape1=`ls "${HOME}/Pictures/VPapes" | shuf | head -n 1`
|
||||
pape2=`ls "${HOME}/Pictures/VPapes" | shuf | head -n 1`
|
||||
echo
|
||||
while [ "$pape1" = "$pape2" ]
|
||||
do
|
||||
pape2=`ls "${HOME}/Pictures/VPapes" | shuf | head -n 1`
|
||||
done
|
||||
# picking out the video to use here
|
||||
pape=`ls ${HOME}/Videos/Papes/ | shuf | dmenu -i -l 10 -p 'Pick a pape :^)'`
|
||||
if [ -z "$pape" ];then
|
||||
exit
|
||||
fi
|
||||
|
||||
mpv="mpv --wid WID --no-config --keepaspect=no --loop \
|
||||
|
||||
#xwinwrap -g 1920x1080 -ov -- mpv -wid WID ~/.wallpapers/water.mp4
|
||||
# WARNING: this mpv command is super outdated(like 2 years) but it might still be useful
|
||||
# to someone out there
|
||||
_unused_mpv="mpv --wid=0 --no-config --keepaspect=no --loop \
|
||||
--no-border --vd-lavc-fast --x11-bypass-compositor=no \
|
||||
--gapless-audio=yes --vo=x11 --hwdec=auto \
|
||||
--x11-name=mpvbg"
|
||||
|
||||
# store our pid here so we can avoid killing our background later
|
||||
# Example: $ kill $(pgrep mpv | grep -v $(pgrep -P $(cat ${HOME}/.cache/mpvbg.pid)))
|
||||
# --- Here we are killing "all mpvs, except with THIS PID"
|
||||
# --- This lets us kill a video we're watching, without stopping our desktop background!
|
||||
|
||||
# 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 -ov -b -un -sh rectangle -fdt -ni -- \
|
||||
mpv -wid WID --no-border --vo=x11 $base/"$pape" &
|
||||
|
||||
# First monitor
|
||||
xwinwrap -g 1920x1080 -ni -fdt -sh rectangle -un -b -nf -ov -- $mpv "$base/$pape1" & > /dev/null 2>&1 &
|
||||
#echo $! > ${HOME}/.cache/mpvbg.pid
|
||||
#echo "$pape1" > $HOME/.cache/newbga_img
|
||||
|
||||
# Quick check if we even have a second monitor at all
|
||||
c=`xrandr | grep ' connected' | wc -l`
|
||||
if [ $c = "1" ]
|
||||
then
|
||||
exit
|
||||
else
|
||||
echo second monitor;
|
||||
exit
|
||||
# Second monitor
|
||||
xwinwrap -g 1920x1080+1920+0 -ni -fdt -sh rectangle -un -b -nf -ov -- $mpv "$base/$pape2" & > /dev/null 2>&1 &
|
||||
echo $! >> ${HOME}/.cache/mpvbg.pid
|
||||
echo "$pape1" >> $HOME/.cache/newbga_img
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user