This commit is contained in:
Stephan Raabe 2024-05-15 11:12:53 +02:00
parent 16f0558315
commit c3ac8c64a8
3 changed files with 17 additions and 8 deletions

View File

@ -0,0 +1,2 @@
# Enter the path to the folder that includes your wallpapers
wallpaper_folder=$HOME/wallpaper

View File

@ -3,6 +3,7 @@ https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9
-------------------------------------------------------- --------------------------------------------------------
- Hyprpaper is the default wallpaper engine. swww will not be installed by the installer anymore. You can still switch to swww in the Dotfiles Settings App (System tab) but you need to install swww manually with yay -S swww - Hyprpaper is the default wallpaper engine. swww will not be installed by the installer anymore. You can still switch to swww in the Dotfiles Settings App (System tab) but you need to install swww manually with yay -S swww
- pfetch has been replaced with fastfetch (requires an update of the .bashrc) - pfetch has been replaced with fastfetch (requires an update of the .bashrc)
- Directory for wallpapers can be customized with new .settings/wallpaper-folder.sh
Version 2.9 Version 2.9
https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9 https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.9

View File

@ -10,6 +10,12 @@
# ----------------------------------------------------- # -----------------------------------------------------
# Cache file for holding the current wallpaper # Cache file for holding the current wallpaper
wallpaper_folder="$HOME/wallpaper"
if [ -f ~/dotfiles/.settings/wallpaper-folder.sh ] ;then
source ~/dotfiles/.settings/wallpaper-folder.sh
fi
echo $wallpaper_folder
cache_file="$HOME/.cache/current_wallpaper" cache_file="$HOME/.cache/current_wallpaper"
blurred="$HOME/.cache/blurred_wallpaper.png" blurred="$HOME/.cache/blurred_wallpaper.png"
square="$HOME/.cache/square_wallpaper.png" square="$HOME/.cache/square_wallpaper.png"
@ -22,13 +28,13 @@ blur=$(cat $blur_file)
# Create cache file if not exists # Create cache file if not exists
if [ ! -f $cache_file ] ;then if [ ! -f $cache_file ] ;then
touch $cache_file touch $cache_file
echo "$HOME/wallpaper/default.jpg" > "$cache_file" echo "$wallpaper_folder/default.jpg" > "$cache_file"
fi fi
# Create rasi file if not exists # Create rasi file if not exists
if [ ! -f $rasi_file ] ;then if [ ! -f $rasi_file ] ;then
touch $rasi_file touch $rasi_file
echo "* { current-image: url(\"$HOME/wallpaper/default.jpg\", height); }" > "$rasi_file" echo "* { current-image: url(\"$wallpaper_folder/default.jpg\", height); }" > "$rasi_file"
fi fi
current_wallpaper=$(cat "$cache_file") current_wallpaper=$(cat "$cache_file")
@ -41,27 +47,27 @@ case $1 in
if [ -f $cache_file ]; then if [ -f $cache_file ]; then
wal -q -i $current_wallpaper wal -q -i $current_wallpaper
else else
wal -q -i ~/wallpaper/ wal -q -i $wallpaper_folder/
fi fi
;; ;;
# Select wallpaper with rofi # Select wallpaper with rofi
"select") "select")
sleep 0.2 sleep 0.2
selected=$( find "$HOME/wallpaper" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -exec basename {} \; | sort -R | while read rfile selected=$( find "$wallpaper_folder" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) -exec basename {} \; | sort -R | while read rfile
do do
echo -en "$rfile\x00icon\x1f$HOME/wallpaper/${rfile}\n" echo -en "$rfile\x00icon\x1f$wallpaper_folder/${rfile}\n"
done | rofi -dmenu -i -replace -config ~/dotfiles/rofi/config-wallpaper.rasi) done | rofi -dmenu -i -replace -config ~/dotfiles/rofi/config-wallpaper.rasi)
if [ ! "$selected" ]; then if [ ! "$selected" ]; then
echo "No wallpaper selected" echo "No wallpaper selected"
exit exit
fi fi
wal -q -i ~/wallpaper/$selected wal -q -i $wallpaper_folder/$selected
;; ;;
# Randomly select wallpaper # Randomly select wallpaper
*) *)
wal -q -i ~/wallpaper/ wal -q -i $wallpaper_folder/
;; ;;
esac esac
@ -75,7 +81,7 @@ echo ":: Wallpaper: $wallpaper"
# ----------------------------------------------------- # -----------------------------------------------------
# get wallpaper image name # get wallpaper image name
# ----------------------------------------------------- # -----------------------------------------------------
newwall=$(echo $wallpaper | sed "s|$HOME/wallpaper/||g") newwall=$(echo $wallpaper | sed "s|$wallpaper_folder/||g")
# ----------------------------------------------------- # -----------------------------------------------------
# Reload waybar with new colors # Reload waybar with new colors