-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·130 lines (108 loc) · 3.62 KB
/
install.sh
File metadata and controls
executable file
·130 lines (108 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# SDDM Material 3 Theme Installer
if [ "$EUID" -ne 0 ]; then
echo "Please run this installer as root (with sudo)."
exit 1
fi
THEME_NAME="sddm-material"
THEME_DIR="/usr/share/sddm/themes/$THEME_NAME"
FONT_DIR="/usr/share/fonts/TTF"
VIDEO_EXTS="mp4 webm avi mkv"
is_video() {
local ext="${1##*.}"
ext=$(echo "$ext" | tr '[:upper:]' '[:lower:]')
for v in $VIDEO_EXTS; do
[ "$ext" = "$v" ] && return 0
done
return 1
}
# Dependency check
if ! command -v python3 &> /dev/null; then
echo "❌ Error: python3 is not installed. Please install it to extract colors."
exit 1
fi
# 1. Ask for wallpaper
echo -e "\n🎨 Welcome to the SDDM Material Installation."
if [ -n "$1" ]; then
WALLPAPER_PATH="$1"
echo "Using provided background path: $WALLPAPER_PATH"
else
read -p "Enter the absolute path to your wallpaper image or video (e.g. /home/user/Pictures/wall.jpg or wall.mp4): " WALLPAPER_PATH
fi
if [ ! -f "$WALLPAPER_PATH" ]; then
echo "❌ Error: File not found at $WALLPAPER_PATH"
exit 1
fi
# Check Pillow for images, ffmpeg for videos
if is_video "$WALLPAPER_PATH"; then
if ! command -v ffmpeg &> /dev/null; then
echo "⚠️ Warning: ffmpeg is not installed. Color extraction from video will be skipped."
fi
else
if ! python3 -c "import PIL" &> /dev/null; then
echo "❌ Error: python3-pillow is not installed. Please install it (e.g., sudo apt install python3-pillow or pip install Pillow)."
exit 1
fi
fi
# 1.5 Ask for profile picture
if [ -n "$2" ]; then
PFP_PATH="$2"
echo "Using provided profile picture path: $PFP_PATH"
else
read -p "Enter the absolute path to your profile picture (optional, press Enter to skip): " PFP_PATH
fi
if [ -n "$PFP_PATH" ] && [ -f "$PFP_PATH" ]; then
TARGET_USER="${SUDO_USER:-$USER}"
if [ "$TARGET_USER" == "root" ]; then
read -p "Enter the username this profile picture is for: " TARGET_USER
fi
echo "⏳ Installing profile picture for $TARGET_USER..."
mkdir -p "/usr/share/sddm/faces"
cp "$PFP_PATH" "/usr/share/sddm/faces/$TARGET_USER.face.icon"
chmod 644 "/usr/share/sddm/faces/$TARGET_USER.face.icon"
elif [ -n "$PFP_PATH" ]; then
echo "⚠️ Warning: Profile picture file not found at $PFP_PATH. Skipping."
fi
# 2. Extract Colors & Process Background
echo "⏳ Processing background and extracting Material 3 colors..."
# Ensure Python dependencies are available for root if run via sudo
if [ -n "$SUDO_USER" ]; then
sudo -u "$SUDO_USER" python3 update_theme_colors.py "$WALLPAPER_PATH"
else
python3 update_theme_colors.py "$WALLPAPER_PATH"
fi
if [ $? -ne 0 ]; then
echo "❌ Error: Color extraction failed."
exit 1
fi
# 3. Install Fonts
echo "⏳ Installing 'Unique' fonts globally for SDDM..."
mkdir -p "$FONT_DIR"
cp -r fonts/Unique_*.otf "$FONT_DIR/"
fc-cache -f "$FONT_DIR"
# 4. Install Theme
echo "⏳ Copying theme files to $THEME_DIR..."
mkdir -p "$THEME_DIR"
# Define the explicit list of files and directories to copy
FILES_TO_COPY=(
"Main.qml"
"metadata.desktop"
"theme.conf"
"backgrounds"
"components"
"fonts"
)
for item in "${FILES_TO_COPY[@]}"; do
if [ -e "$item" ]; then
cp -r "$item" "$THEME_DIR/"
fi
done
# Make sure permissions are correct
chmod -R 755 "$THEME_DIR"
# 5. Apply Theme to SDDM configuration
SDDM_CONF_DIR="/etc/sddm.conf.d"
mkdir -p "$SDDM_CONF_DIR"
echo -e "[Theme]\nCurrent=$THEME_NAME" > "$SDDM_CONF_DIR/99-material.conf"
echo -e "\n✅ Installation Complete!"
echo "Your new Material 3 SDDM theme is active."
echo "You can test it by running: sddm-greeter --test-mode --theme $THEME_DIR"