Merge pull request #304 from rdunne2020/background-clone-fix

fix: Correctly Detect Pictures Directory and Clone Path for Background
This commit is contained in:
Chris Titus 2024-09-18 11:45:15 -05:00 committed by GitHub
commit b34f5240ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -143,27 +143,30 @@ clone_config_folders() {
}
configure_backgrounds() {
# Set the variable PIC_DIR which stores the path for images
PIC_DIR="$HOME/Pictures"
# Set the variable BG_DIR to the path where backgrounds will be stored
BG_DIR="$HOME/Pictures/backgrounds"
BG_DIR="$PIC_DIR/backgrounds"
# Check if the ~/Pictures directory exists
if [ ! -d "~/Pictures" ]; then
if [ ! -d "$PIC_DIR" ]; then
# If it doesn't exist, print an error message and return with a status of 1 (indicating failure)
echo "Pictures directory does not exist"
mkdir ~/Pictures
mkdir "$PIC_DIR"
echo "Directory was created in Home folder"
fi
# Check if the backgrounds directory (BG_DIR) exists
if [ ! -d "$BG_DIR" ]; then
# If the backgrounds directory doesn't exist, attempt to clone a repository containing backgrounds
if ! git clone https://github.com/ChrisTitusTech/nord-background.git ~/Pictures; then
if ! git clone https://github.com/ChrisTitusTech/nord-background.git "$PIC_DIR/nord-background"; then
# If the git clone command fails, print an error message and return with a status of 1
echo "Failed to clone the repository"
return 1
fi
# Rename the cloned directory to 'backgrounds'
mv ~/Pictures/nord-background ~/Pictures/backgrounds
mv "$PIC_DIR/nord-background" "$PIC_DIR/backgrounds"
# Print a success message indicating that the backgrounds have been downloaded
echo "Downloaded desktop backgrounds to $BG_DIR"
else
@ -261,9 +264,6 @@ setupDisplayManager() {
;;
esac
fi
}
install_slstatus() {