Skip to content

Commit

Permalink
Merge pull request #6 from BuddhiLW/master
Browse files Browse the repository at this point in the history
Added option to output wallpaper to specific monitor
  • Loading branch information
FabricatorZayac authored Jan 20, 2022
2 parents 89f235c + b5c07de commit 1d307fe
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions lazywal-cli
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ _help()
echo " -r - Restore last wallpaper"
echo " -k - Kill wallpaper"
echo " -d - Debug"
echo " -D - Display with specification (e.g., 1980x1080+0)"
}

xwinwrap_func()
{
if [ "$display" = "" ];then
# https://superuser.com/questions/196532/how-do-i-find-out-my-screen-resolution-from-a-shell-script
display=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
xwinwrap_args="-g $display -ni -b -st -un -o 1.0 -ov -debug"
fi

xwinwrap_args="-g $display -ni -b -st -un -o 1.0 -ov -debug"
}

_set_display()
{
display=$1
}

_kill()
Expand All @@ -21,7 +38,7 @@ _use_wal()
{
_kill
file_path=$1
xwinwrap_args="-fs -ni -b -nf -un -o 1.0 -ov -debug"
xwinwrap_func
mpv_args="-wid WID --loop --no-audio --no-resume-playback --panscan=1.0"

if [ "$debug" = "true" ];
Expand All @@ -45,7 +62,7 @@ then
exit 1
fi

while getopts "hdrk" option; do
while getopts "hdrkD:" option; do
case $option in
h) # display Help
_help
Expand All @@ -60,13 +77,17 @@ while getopts "hdrk" option; do
r) # restore wal
_restore
exit;;
D) # display on specification (use this for external monitors)
_set_display ${OPTARG}
_restore
exit;;
*) # Illegal option
_help
exit;;
esac
done

for i in $*; do
for i in "$@"; do
if [ -e $i ]
then
file_path=$(realpath $i)
Expand Down

0 comments on commit 1d307fe

Please sign in to comment.