Hyprland-dotfiles/.install/wallpaper.sh

55 lines
1.9 KiB
Bash

# ------------------------------------------------------
# Install wallpapers
# ------------------------------------------------------
echo -e "${GREEN}"
figlet "Wallpapers"
echo -e "${NONE}"
if [ ! -d ~/wallpaper ]; then
echo "Do you want to download the wallpapers from repository https://gitea.phywyj.dynv6.net/wyj/wallpaper.git ?"
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/
git clone https://gitea.phywyj.dynv6.net/wyj/wallpaper.git ~/wallpaper
echo "Wallpapers from the repository installed successfully."
elif [ $? -eq 130 ]; then
exit 130
else
if [ -d ~/wallpaper/ ]; then
echo "wallpaper folder already exists."
else
mkdir ~/wallpaper
fi
cp wallpapers/* ~/wallpaper
echo "Default wallpapers installed successfully."
fi
else
echo ":: ~/wallpaper folder already exists."
fi
echo ""
# ------------------------------------------------------
# Copy default wallpaper files to .cache
# ------------------------------------------------------
# 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