fix: theme-Auswahl + SDDM-Theme-Correctness
Drei Probleme gefixt:
1. Theme-Auswahl waehrend Install
- apply-theme.sh zeigt jetzt alle .theme-Files via tui_choose
- Benutzer waehlt interaktiv (gum/whiptail/basic)
- Bei nur einem Theme: auto-select
2. SDDM wendet falsches Theme an
- sddm.sh erzeugt /var/lib/pascal-sddm-theme/ mit user chown
- Liest current-theme.conf + hyprpaper.conf fuer aktuelle Farben
- Schreibt theme.conf in /usr/share/sddm/themes/pascal-hypr/
- Config heisst jetzt 90-pascal-hypr.conf (hoehere Priority)
- apply-theme.sh erzeugt state dir VOR theme-menu.sh --apply
3. tui_choose basic mode fix
- ${!choice} funktioniert nicht fuer numerische Indices
- labels+=("$@") + ${labels[$choice]} statt Positional-Params
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
module_description() {
|
||||
printf "Apply Theme - set default Hyprland theme and restart services\n"
|
||||
printf "Apply Theme - select and apply a Hyprland theme\n"
|
||||
}
|
||||
|
||||
module_required() { return 1; }
|
||||
@@ -22,36 +22,69 @@ module_main() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
local default_theme="${OMERON_DEFAULT_THEME:-forest-neon}"
|
||||
local theme_files=()
|
||||
mapfile -t theme_files < <(find "$themes_dir" -name '*.theme' -type f | sort 2>/dev/null)
|
||||
|
||||
local theme_file=""
|
||||
if [[ -f "$themes_dir/$default_theme.theme" ]]; then
|
||||
theme_file="$themes_dir/$default_theme.theme"
|
||||
elif [[ -f "$themes_dir/forest-neon.theme" ]]; then
|
||||
theme_file="$themes_dir/forest-neon.theme"
|
||||
elif [[ -f "$themes_dir/rose-night.theme" ]]; then
|
||||
theme_file="$themes_dir/rose-night.theme"
|
||||
else
|
||||
local available
|
||||
available="$(find "$themes_dir" -name '*.theme' -type f | head -1)"
|
||||
if [[ -n "$available" ]]; then
|
||||
theme_file="$available"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$theme_file" ]]; then
|
||||
if ((${#theme_files[@]} == 0)); then
|
||||
log_warn "No theme files found in $themes_dir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if tui_confirm "Apply theme: $(basename "$theme_file" .theme).theme?"; then
|
||||
log_info "Applying theme: $(basename "$theme_file")"
|
||||
tui_spin "Applying theme..." bash "$theme_script" --apply "$theme_file"
|
||||
local theme_names=()
|
||||
local file
|
||||
for file in "${theme_files[@]}"; do
|
||||
theme_names+=("$(basename "$file" .theme)")
|
||||
done
|
||||
|
||||
if have notify-send; then
|
||||
notify-send "Omeron" "Theme applied: $(basename "$theme_file" .theme)" >/dev/null 2>&1 || true
|
||||
tui_bold "Available themes:"
|
||||
local i
|
||||
for i in "${!theme_names[@]}"; do
|
||||
tui_info "[$i] ${theme_names[$i]}"
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
local choice
|
||||
if ((${#theme_files[@]} == 1)); then
|
||||
tui_info "Only one theme available, auto-selecting: ${theme_names[0]}"
|
||||
choice="${theme_files[0]}"
|
||||
else
|
||||
choice="$(
|
||||
local labels=()
|
||||
for name in "${theme_names[@]}"; do
|
||||
labels+=("$name")
|
||||
done
|
||||
tui_choose "Select a theme" "${labels[@]}"
|
||||
)"
|
||||
if [[ -z "$choice" ]]; then
|
||||
log_info "No theme selected, skipping"
|
||||
return 0
|
||||
fi
|
||||
|
||||
log_success "Theme applied: $(basename "$theme_file" .theme)"
|
||||
local idx
|
||||
for idx in "${!theme_names[@]}"; do
|
||||
if [[ "$choice" == "${theme_names[$idx]}" ]]; then
|
||||
choice="${theme_files[$idx]}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z "$choice" || ! -f "$choice" ]]; then
|
||||
log_warn "Invalid theme selection"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_info "Selected theme: $(basename "$choice" .theme)"
|
||||
|
||||
if ! tui_confirm "Apply theme: $(basename "$choice" .theme)?"; then
|
||||
log_info "Theme application skipped"
|
||||
return 0
|
||||
fi
|
||||
|
||||
sudo_run mkdir -p /var/lib/pascal-sddm-theme 2>/dev/null || true
|
||||
sudo_run chown "$(id -u):$(id -g)" /var/lib/pascal-sddm-theme 2>/dev/null || true
|
||||
|
||||
log_info "Applying theme..."
|
||||
tui_spin "Applying theme..." bash "$theme_script" --apply "$choice"
|
||||
|
||||
log_success "Theme applied: $(basename "$choice" .theme)"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user