wallpaper image file support
This commit is contained in:
@@ -9,12 +9,30 @@
|
||||
# by Stephan Raabe (2023)
|
||||
# -----------------------------------------------------
|
||||
|
||||
# Cache file for holding the current wallpaper
|
||||
cache_file="$HOME/.cache/current_wallpaper"
|
||||
rasi_file="$HOME/.cache/current_wallpaper.rasi"
|
||||
|
||||
# Create cache file if not exists
|
||||
if [ ! -f $cache_file ] ;then
|
||||
touch $cache_file
|
||||
echo "$HOME/wallpaper/default.jpg" > "$cache_file"
|
||||
fi
|
||||
|
||||
# Create rasi file if not exists
|
||||
if [ ! -f $rasi_file ] ;then
|
||||
touch $rasi_file
|
||||
echo "* { current-image: url(\"$HOME/wallpaper/default.jpg\", height); }" > "$rasi_file"
|
||||
fi
|
||||
|
||||
current_wallpaper=$(cat "$cache_file")
|
||||
|
||||
case $1 in
|
||||
|
||||
# Load wallpaper from .cache of last session
|
||||
"init")
|
||||
if [ -f ~/.cache/current_wallpaper.jpg ]; then
|
||||
wal -q -c -i ~/.cache/current_wallpaper.jpg
|
||||
if [ -f $cache_file ]; then
|
||||
wal -q -i $current_wallpaper
|
||||
else
|
||||
wal -q -i ~/wallpaper/
|
||||
fi
|
||||
@@ -48,9 +66,10 @@ source "$HOME/.cache/wal/colors.sh"
|
||||
echo "Wallpaper: $wallpaper"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Copy selected wallpaper into .cache folder
|
||||
# Write selected wallpaper into .cache files
|
||||
# -----------------------------------------------------
|
||||
cp $wallpaper ~/.cache/current_wallpaper.jpg
|
||||
echo "$wallpaper" > "$cache_file"
|
||||
echo "* { current-image: url(\"$wallpaper\", height); }" > "$rasi_file"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# get wallpaper image name
|
||||
|
||||
Reference in New Issue
Block a user