new sddm theme

This commit is contained in:
JaKooLit
2025-06-09 05:31:01 +09:00
parent b5f342f62c
commit e433e89754

View File

@@ -2,8 +2,8 @@
# 💫 https://github.com/JaKooLit 💫 # # 💫 https://github.com/JaKooLit 💫 #
# SDDM themes # # SDDM themes #
source_theme="https://codeberg.org/JaKooLit/sddm-sequoia" source_theme="https://github.com/JaKooLit/simple-sddm-2.git"
theme_name="sequoia_2" theme_name="simple_sddm_2"
## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ##
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -54,50 +54,41 @@ if git clone --depth=1 "$source_theme" "$theme_name"; then
# setting up SDDM theme # setting up SDDM theme
sddm_conf_dir="/etc/sddm.conf.d" sddm_conf="/etc/sddm.conf"
BACKUP_SUFFIX=".bak" BACKUP_SUFFIX=".bak"
echo -e "${NOTE} Setting up the login screen." | tee -a "$LOG" echo -e "${NOTE} Setting up the login screen." | tee -a "$LOG"
if [ -d "$sddm_conf_dir" ]; then # Backup the sddm.conf file if it exists
echo "Backing up files in $sddm_conf_dir" | tee -a "$LOG" if [ -f "$sddm_conf" ]; then
for file in "$sddm_conf_dir"/*; do echo "Backing up $sddm_conf" | tee -a "$LOG"
if [ -f "$file" ]; then sudo cp "$sddm_conf" "$sddm_conf$BACKUP_SUFFIX" 2>&1 | tee -a "$LOG"
if [[ "$file" == *$BACKUP_SUFFIX ]]; then
echo "Skipping backup file: $file" | tee -a "$LOG"
continue
fi
# Backup each original file
sudo cp "$file" "$file$BACKUP_SUFFIX" 2>&1 | tee -a "$LOG"
echo "Backup created for $file" | tee -a "$LOG"
# Edit existing "Current="
if grep -q '^[[:space:]]*Current=' "$file"; then
sudo sed -i "s/^[[:space:]]*Current=.*/Current=$theme_name/" "$file" 2>&1 | tee -a "$LOG"
echo "Updated theme in $file" | tee -a "$LOG"
fi
fi
done
else else
echo "$CAT - $sddm_conf_dir not found, creating..." | tee -a "$LOG" echo "$sddm_conf does not exist, creating a new one." | tee -a "$LOG"
sudo mkdir -p "$sddm_conf_dir" 2>&1 | tee -a "$LOG" sudo touch "$sddm_conf" 2>&1 | tee -a "$LOG"
fi fi
if [ ! -f "$sddm_conf_dir/theme.conf.user" ]; then # Check if the [Theme] section exists
echo -e "[Theme]\nCurrent = $theme_name" | sudo tee "$sddm_conf_dir/theme.conf.user" > /dev/null if grep -q '^\[Theme\]' "$sddm_conf"; then
# Update the Current= line under [Theme]
sudo sed -i "/^\[Theme\]/,/^\[/{s/^\s*Current=.*/Current=$theme_name/}" "$sddm_conf" 2>&1 | tee -a "$LOG"
if [ -f "$sddm_conf_dir/theme.conf.user" ]; then # If no Current= line was found and replaced, append it after the [Theme] section
echo "Created and configured $sddm_conf_dir/theme.conf.user with theme $theme_name" | tee -a "$LOG" if ! grep -q '^\s*Current=' "$sddm_conf"; then
sudo sed -i "/^\[Theme\]/a Current=$theme_name" "$sddm_conf" 2>&1 | tee -a "$LOG"
echo "Appended Current=$theme_name under [Theme] in $sddm_conf" | tee -a "$LOG"
else else
echo "Failed to create $sddm_conf_dir/theme.conf.user" | tee -a "$LOG" echo "Updated Current=$theme_name in $sddm_conf" | tee -a "$LOG"
fi fi
else else
echo "$sddm_conf_dir/theme.conf.user already exists, skipping creation." | tee -a "$LOG" # Append the [Theme] section at the end if it doesn't exist
echo -e "\n[Theme]\nCurrent=$theme_name" | sudo tee -a "$sddm_conf" > /dev/null
echo "Added [Theme] section with Current=$theme_name in $sddm_conf" | tee -a "$LOG"
fi fi
# Replace current background from assets # 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 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" 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" echo "${OK} - ${MAGENTA}Additional SDDM Theme${RESET} successfully installed." | tee -a "$LOG"