2025-02-07 20:21:49 +09:00

67 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# 💫 https://github.com/JaKooLit 💫 #
# SDDM themes #
source_theme="https://codeberg.org/JaKooLit/sddm-sequoia"
theme_name="sequoia_2"
sddm_conf_dir="/etc/sddm.conf.d"
## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ##
# Determine the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Change the working directory to the parent directory of the script
PARENT_DIR="$SCRIPT_DIR/.."
cd "$PARENT_DIR" || exit 1
source "$(dirname "$(readlink -f "$0")")/Global_functions.sh"
# Set the name of the log file to include the current date and time
LOG="Install-Logs/install-$(date +%d-%H%M%S)_sddm_theme.log"
# SDDM-themes
printf "${INFO} Installing ${SKY_BLUE}Additional SDDM Theme${RESET}\n"
# Check if /usr/share/sddm/themes/$theme_name exists and remove if it does
if [ -d "/usr/share/sddm/themes/$theme_name" ]; then
sudo rm -rf "/usr/share/sddm/themes/$theme_name"
echo -e "\e[1A\e[K${OK} - Removed existing $theme_name directory." 2>&1 | tee -a "$LOG"
fi
# Check if $theme_name directory exists in the current directory and remove if it does
if [ -d "$theme_name" ]; then
rm -rf "$theme_name"
echo -e "\e[1A\e[K${OK} - Removed existing $theme_name directory from the current location." 2>&1 | tee -a "$LOG"
fi
# Clone the repository
if git clone --depth 1 "$source_theme" "$theme_name"; then
if [ ! -d "$theme_name" ]; then
echo "${ERROR} Failed to clone the repository." | tee -a "$LOG"
fi
# Create themes directory if it doesn't exist
if [ ! -d "/usr/share/sddm/themes" ]; then
sudo mkdir -p /usr/share/sddm/themes
echo "${OK} - Directory '/usr/share/sddm/themes' created." | tee -a "$LOG"
fi
# Move cloned theme to the themes directory
sudo mv "$theme_name" "/usr/share/sddm/themes/$theme_name" 2>&1 | tee -a "$LOG"
# Configure theme settings
echo -e "[Theme]\nCurrent=$theme_name" | sudo tee "$sddm_conf_dir/theme.conf.user" >> "$LOG"
# Replace current background from assets
sudo cp -r assets/sddm.png "/usr/share/sddm/themes/$theme_name/backgrounds/default" 2>&1 | tee -a "$LOG"
sudo sed -i 's|^wallpaper=".*"|wallpaper="backgrounds/default"|' "/usr/share/sddm/themes/$theme_name/theme.conf" 2>&1 | tee -a "$LOG"
echo "${OK} - ${MAGENTA}Additional SDDM Theme${RESET} successfully installed." | tee -a "$LOG"
else
echo "${ERROR} - Failed to clone the sddm theme repository. Please check your internet connection." | tee -a "$LOG" >&2
fi
printf "\n%.0s" {1..2}