diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-07-22 03:02:59 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:40:35 -0700 |
| commit | 38ecce058e64ad6391fea9b60b5183a27b1c663a (patch) | |
| tree | 6c8a37ebf710e5c7cf7fd44c07ff7cf90b611f9b /config/hypr | |
| parent | 4db27c38cc338dc28d08a6525fd6b139c9a5136a (diff) | |
Fixing kitty / ghostty theme preview / selection
Signed-off-by: Don Williams <don.e.williams@gmail.com>
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: config/hypr/scripts/Ghostty_themes.sh
modified: config/hypr/scripts/Kitty_themes.sh
Diffstat (limited to 'config/hypr')
| -rwxr-xr-x | config/hypr/scripts/Ghostty_themes.sh | 45 | ||||
| -rwxr-xr-x | config/hypr/scripts/Kitty_themes.sh | 16 |
2 files changed, 50 insertions, 11 deletions
diff --git a/config/hypr/scripts/Ghostty_themes.sh b/config/hypr/scripts/Ghostty_themes.sh index f39be65a..c9ecbe8d 100755 --- a/config/hypr/scripts/Ghostty_themes.sh +++ b/config/hypr/scripts/Ghostty_themes.sh @@ -27,6 +27,7 @@ notify_user() { else notify-send -u low "$title" "$body" fi + return 0 } refresh_wallpaper_theme() { @@ -54,9 +55,10 @@ ensure_managed_ghostty_config() { } sync_runtime_ghostty_config() { if [[ "$config_file" != "$fallback_ghostty_config" && -r "$config_file" ]]; then - mkdir -p "$(dirname "$fallback_ghostty_config")" 2>/dev/null || true - cp -f "$config_file" "$fallback_ghostty_config" 2>/dev/null || true + mkdir -p "$(dirname "$fallback_ghostty_config")" 2>/dev/null || return 1 + cp -f "$config_file" "$fallback_ghostty_config" 2>/dev/null || return 1 fi + return 0 } ensure_managed_ghostty_config @@ -64,7 +66,10 @@ if [[ ! -f "$config_file" || ! -r "$config_file" ]]; then notify_user "$iDIR/error.png" "Ghostty Theme" "Config not found: $config_file" exit 1 fi -sync_runtime_ghostty_config +if ! sync_runtime_ghostty_config; then + notify_user "$iDIR/error.png" "Ghostty Theme" "Unable to sync config to $fallback_ghostty_config" + exit 1 +fi rofi_config_args=() if [[ -f "$rofi_theme_primary" ]]; then @@ -161,8 +166,15 @@ END { } } ' "$config_file" > "$tmp_file" - mv "$tmp_file" "$config_file" - sync_runtime_ghostty_config + if ! mv "$tmp_file" "$config_file"; then + rm -f "$tmp_file" + notify_user "$iDIR/error.png" "Ghostty Theme" "Failed to update $config_file" + exit 1 + fi + if ! sync_runtime_ghostty_config; then + notify_user "$iDIR/error.png" "Ghostty Theme" "Unable to sync config to $fallback_ghostty_config" + exit 1 + fi refresh_wallpaper_theme notify_user "$iDIR/ja.png" "Ghostty Theme Applied" "$wallust_option_label" exit 0 @@ -194,8 +206,15 @@ END { } } ' "$config_file" > "$tmp_file" - mv "$tmp_file" "$config_file" - sync_runtime_ghostty_config + if ! mv "$tmp_file" "$config_file"; then + rm -f "$tmp_file" + notify_user "$iDIR/error.png" "Ghostty Theme" "Failed to update $config_file" + exit 1 + fi + if ! sync_runtime_ghostty_config; then + notify_user "$iDIR/error.png" "Ghostty Theme" "Unable to sync config to $fallback_ghostty_config" + exit 1 + fi pkill -SIGUSR2 ghostty >/dev/null 2>&1 || true notify_user "$iDIR/ja.png" "Ghostty Theme Applied" "$default_option_label" @@ -249,9 +268,15 @@ END { print "#config-file = " wallust_include_path } }' "$config_file" > "$tmp_file" - -mv "$tmp_file" "$config_file" -sync_runtime_ghostty_config +if ! mv "$tmp_file" "$config_file"; then + rm -f "$tmp_file" + notify_user "$iDIR/error.png" "Ghostty Theme" "Failed to update $config_file" + exit 1 +fi +if ! sync_runtime_ghostty_config; then + notify_user "$iDIR/error.png" "Ghostty Theme" "Unable to sync config to $fallback_ghostty_config" + exit 1 +fi pkill -SIGUSR2 ghostty >/dev/null 2>&1 || true diff --git a/config/hypr/scripts/Kitty_themes.sh b/config/hypr/scripts/Kitty_themes.sh index 15274376..7f34cbe6 100755 --- a/config/hypr/scripts/Kitty_themes.sh +++ b/config/hypr/scripts/Kitty_themes.sh @@ -128,9 +128,11 @@ apply_kitty_theme_to_config() { log_debug "wallust_refresh_background_started" fi if pidof kitty >/dev/null 2>&1; then + if command -v kitty >/dev/null 2>&1; then + kitty @ load-config >/dev/null 2>&1 || true + fi if [ "$apply_mode" = "apply" ] && [ "$is_wallpaper_mode" -eq 0 ] && command -v kitty >/dev/null 2>&1; then ( - kitty @ load-config >/dev/null 2>&1 || true kitty @ set-colors --all --configured "$theme_file_path_to_apply" >/dev/null 2>&1 || true ) & fi @@ -228,6 +230,10 @@ while true; do log_debug "resolved_enter index=$current_selection_index theme='${theme_to_preview_now}'" if ! apply_kitty_theme_to_config "$theme_to_preview_now" "preview"; then echo "$original_kitty_config_content_backup" >"$kitty_config" + sync_runtime_kitty_config + if command -v kitty >/dev/null 2>&1; then + kitty @ load-config >/dev/null 2>&1 || true + fi for pid_kitty in $(pidof kitty); do if [ -n "$pid_kitty" ]; then kill -SIGUSR1 "$pid_kitty"; fi; done notify_user "$iDIR/error.png" "Preview Error" "Failed to apply $theme_to_preview_now. Reverted." exit 1 @@ -239,6 +245,10 @@ while true; do elif [ $rofi_exit_code -eq 1 ]; then notify_user "$iDIR/note.png" "Kitty Theme" "Selection cancelled. Reverting to original theme." echo "$original_kitty_config_content_backup" >"$kitty_config" + sync_runtime_kitty_config + if command -v kitty >/dev/null 2>&1; then + kitty @ load-config >/dev/null 2>&1 || true + fi for pid_kitty in $(pidof kitty); do if [ -n "$pid_kitty" ]; then kill -SIGUSR1 "$pid_kitty"; fi; done break elif [ $rofi_exit_code -ge 10 ] && [ $rofi_exit_code -le 28 ]; then # custom keybindings @@ -250,6 +260,10 @@ while true; do else notify_user "$iDIR/error.png" "Rofi Error" "Unexpected Rofi exit ($rofi_exit_code). Reverting." echo "$original_kitty_config_content_backup" >"$kitty_config" + sync_runtime_kitty_config + if command -v kitty >/dev/null 2>&1; then + kitty @ load-config >/dev/null 2>&1 || true + fi for pid_kitty in $(pidof kitty); do if [ -n "$pid_kitty" ]; then kill -SIGUSR1 "$pid_kitty"; fi; done break fi |
