hyprland-dotfiles/.install/wallpaper.sh

54 lines
1.8 KiB
Bash
Raw Normal View History

2023-11-10 21:12:15 +00:00
# ------------------------------------------------------
# Install wallpapers
# ------------------------------------------------------
2023-11-17 12:48:02 +00:00
echo -e "${GREEN}"
2023-12-21 20:57:44 +00:00
figlet "Wallpapers"
2023-11-17 12:48:02 +00:00
echo -e "${NONE}"
if [ ! -d ~/wallpaper ]; then
2023-11-20 21:24:53 +00:00
echo "Do you want to download the wallpapers from repository https://gitlab.com/stephan-raabe/wallpaper/ ?"
echo "If not, the script will install 3 default wallpapers in ~/wallpaper/"
echo ""
if gum confirm "Do you want to download the repository?" ;then
wget -P ~/Downloads/ https://gitlab.com/stephan-raabe/wallpaper/-/archive/main/wallpaper-main.zip
unzip -o ~/Downloads/wallpaper-main.zip -d ~/Downloads/
if [ ! -d ~/wallpaper/ ]; then
mkdir ~/wallpaper
fi
cp ~/Downloads/wallpaper-main/* ~/wallpaper/
2023-12-10 12:37:48 +00:00
echo "Wallpapers from the repository installed successfully."
2023-11-21 20:19:51 +00:00
elif [ $? -eq 130 ]; then
exit 130
2023-11-20 21:24:53 +00:00
else
if [ -d ~/wallpaper/ ]; then
echo "wallpaper folder already exists."
else
mkdir ~/wallpaper
fi
cp wallpapers/* ~/wallpaper
echo "Default wallpapers installed successfully."
fi
2023-11-17 12:48:02 +00:00
else
echo "~/wallpaper folder already exsits."
fi
2023-11-10 21:12:15 +00:00
echo ""
# ------------------------------------------------------
2023-12-21 21:10:14 +00:00
# Copy default wallpaper files to .cache
2023-11-10 21:12:15 +00:00
# ------------------------------------------------------
2023-12-21 21:10:14 +00:00
# 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"
2023-11-17 12:48:02 +00:00
fi