Script to move Wonderwall wallpapers
Bear in mind that I'm new to Puppies, new to EasyOS, new to scripting, etc.
Anyway I installed 'Wonderwall' (A wallpaper downloader/setter) as a flatpak in EasyOS and for the life of me couldn't get the thing to set a wallpaper of my choice.
If anyone knows how to work around the 'backend choices', don't be shy, elucidate me.
So what I did.
I did some research on scripting basics and YAD basics to come up with a script that offers a choice to move the wallpapers, if any, from the wonderwall download folder into the system backgrounds folder upon closing 'Wonderwall.' After which the user can open the standard background changer via the menu and change the wallpaper. I'm sure it could be more streamlined, but as I said, I'm new to all this.
Code: Select all
#!/bin/sh
# Define two string variables
_wonderfolder='/root/.var/app/com.ktechpit.wonderwall/data/ktechpit/WonderWall/download/'
_backgrounds='/usr/share/backgrounds'
# Fake return code to force yes/no choice
_ret=252
# Look to see if there are any files in _wonderfolder
_numlines=$(ls $_wonderfolder | wc -l)
# If there are any files in _wonderfolder open a yes/no dialog
# If there are no files the script exits
# This check takes place each time you exit Wonderwall
# You can choose to move the files (if any) to the system
# backgrounds folder or not. Your choice.
if [[ $_numlines -gt 0 ]]
then
# Append wildcard to _wonderfolder string
_wonderfolder=$_wonderfolder'*.*'
# Loop until a yes/no choice hase been made
while [ $_ret -eq 252 ]
do
# Open dialog
yad --width=200 \
--center \
--image="dialog-question" \
--title="Wallpaper Mover" \
--text="Move wallpapers?" \
--button="YES:0" \
--button="NO:1" \
_ret=$?
# When yes/no choice is made finish loop
done
[[ $_ret -eq 1 ]] && exit
[[ $_ret -eq 0 ]] && mv $_wonderfolder $_backgrounds
fi
exit
Here's an early version of the script and shows how I chained it to 'Wonderwall.'