added pywal flag

This commit is contained in:
thevinter 2021-06-03 18:36:45 +02:00
parent 1fcea99dbf
commit 9682296aa6
2 changed files with 16 additions and 4 deletions

View File

@ -1,12 +1,12 @@
# Styli.sh - Wallpaper switching on i3 made easy
Stily.sh is a Bash script that aims to automate the tedious process of finding new wallpapers, downloading and switching them via the i3 config. **Styly.sh** can search for specific wallpapers from unsplash or download
a random image from the specified subreddits.
a random image from the specified subreddits. If you have pywal it also can set automatically your terminal colors.
![Preview](preview.png)
## Requirements
This script is made to work with ```feh``` so having it installed is a requirement. Currently it does not support Desktop Environments.
This script is made to work with ```feh``` so having it installed is a requirement. Currently it does not support Desktop Environments. If you want to use the -p flag you will have to have ```pywal``` installed.
## Install
```
@ -44,6 +44,9 @@ $ ./styli.sh -b bg-scale -r widescreen-wallpaper
# To add custom feh flags
$ ./styli.sh -c <flags>
$ ./styli.sh -c --no-xinerama -r widescreen-wallpaper
# To automatically set the terminal colors
$ ./styli.sh -p
```
## Tips And Tricks
To set a new background every time you reboot your computer add the following to your ```i3/config``` file

View File

@ -40,7 +40,8 @@ reddit(){
wget -T $timeout -U "$useragent" --no-check-certificate -q -P down -O "wallpaper.jpg" $target_url &>/dev/null
}
while getopts h:w:s:l:b:r:c: flag
pywal=0
while getopts h:w:s:l:b:r:c:p flag
do
case "${flag}" in
b) bgtype=${OPTARG};;
@ -50,11 +51,11 @@ do
l) link=${OPTARG};;
r) sub=${OPTARG};;
c) custom=${OPTARG};;
p) pywal=1;;
esac
done
feh=(feh)
if [ ! -z $bgtype ]; then
if [ $bgtype == 'bg-center' ]; then
feh+=(--bg-center)
@ -82,6 +83,10 @@ then
reddit "$sub"
feh+=(wallpaper.jpg)
"${feh[@]}"
if [ pywal==1 ]; then
wal -c
wal -i wallpaper.jpg -n
fi
else
if [ ! -z $height ] || [ ! -z $width ]; then
link="${link}${width}x${height}";
@ -95,5 +100,9 @@ else
wget -q -O wallpaper $link
feh+=(wallpaper)
"${feh[@]}"
if [ pywal==1 ]; then
wal -c
wal -i wallpaper -n
fi
fi