apply_theme() rief hyprctl (keyword + hyprpaper) und restart_waybar ohne zu prüfen ob Hyprland läuft → hyprctl hing bis Timeout im TTY. Fix: pgrep -x Hyprland guard vor allen hyprctl/waybar-Aufrufen. apply_theme schreibt jetzt Config-Files (gelten beim nächsten Login), überspringt aber Display-abhängige Kommandos.
58 lines
1.6 KiB
Bash
Executable File
58 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
module_description() {
|
|
printf "Apply Theme - set default Hyprland theme and restart services\n"
|
|
}
|
|
|
|
module_required() { return 1; }
|
|
module_should_skip() { return 1; }
|
|
|
|
module_prereqs() {
|
|
return 0
|
|
}
|
|
|
|
module_main() {
|
|
log_section "Theme Application"
|
|
|
|
local theme_script="$HOME/.config/hypr/Scripts/theme-menu.sh"
|
|
local themes_dir="$HOME/.config/hypr/Themes"
|
|
|
|
if [[ ! -f "$theme_script" ]]; then
|
|
log_warn "Theme script not found (dotfiles may not be deployed yet)"
|
|
return 1
|
|
fi
|
|
|
|
local default_theme="${OMERON_DEFAULT_THEME:-forest-neon}"
|
|
|
|
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
|
|
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"
|
|
|
|
if have notify-send; then
|
|
notify-send "Omeron" "Theme applied: $(basename "$theme_file" .theme)" >/dev/null 2>&1 || true
|
|
fi
|
|
|
|
log_success "Theme applied: $(basename "$theme_file" .theme)"
|
|
fi
|
|
}
|