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 # 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 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) ![Preview](preview.png)
## Requirements ## 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 ## Install
``` ```
@ -44,6 +44,9 @@ $ ./styli.sh -b bg-scale -r widescreen-wallpaper
# To add custom feh flags # To add custom feh flags
$ ./styli.sh -c <flags> $ ./styli.sh -c <flags>
$ ./styli.sh -c --no-xinerama -r widescreen-wallpaper $ ./styli.sh -c --no-xinerama -r widescreen-wallpaper
# To automatically set the terminal colors
$ ./styli.sh -p
``` ```
## Tips And Tricks ## Tips And Tricks
To set a new background every time you reboot your computer add the following to your ```i3/config``` file 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 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 do
case "${flag}" in case "${flag}" in
b) bgtype=${OPTARG};; b) bgtype=${OPTARG};;
@ -50,11 +51,11 @@ do
l) link=${OPTARG};; l) link=${OPTARG};;
r) sub=${OPTARG};; r) sub=${OPTARG};;
c) custom=${OPTARG};; c) custom=${OPTARG};;
p) pywal=1;;
esac esac
done done
feh=(feh) feh=(feh)
if [ ! -z $bgtype ]; then if [ ! -z $bgtype ]; then
if [ $bgtype == 'bg-center' ]; then if [ $bgtype == 'bg-center' ]; then
feh+=(--bg-center) feh+=(--bg-center)
@ -82,6 +83,10 @@ then
reddit "$sub" reddit "$sub"
feh+=(wallpaper.jpg) feh+=(wallpaper.jpg)
"${feh[@]}" "${feh[@]}"
if [ pywal==1 ]; then
wal -c
wal -i wallpaper.jpg -n
fi
else else
if [ ! -z $height ] || [ ! -z $width ]; then if [ ! -z $height ] || [ ! -z $width ]; then
link="${link}${width}x${height}"; link="${link}${width}x${height}";
@ -95,5 +100,9 @@ else
wget -q -O wallpaper $link wget -q -O wallpaper $link
feh+=(wallpaper) feh+=(wallpaper)
"${feh[@]}" "${feh[@]}"
if [ pywal==1 ]; then
wal -c
wal -i wallpaper -n
fi
fi fi