diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-07-22 02:56:37 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:40:35 -0700 |
| commit | 23e3dd59fb2b7f384c7e29619391268e0b0b6122 (patch) | |
| tree | 7647330e8d8d336a99118378ffb6866dfccc69cf /config/hypr/scripts | |
| parent | ea5df3d629dbeb5bb6da964e1eb8ed4981db7a12 (diff) | |
Fixed theme selector for kitty and ghostty
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/UserConfigs/kitty.conf
modified: config/hypr/scripts/Ghostty_themes.sh
modified: config/hypr/scripts/Kitty_themes.sh
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/Ghostty_themes.sh | 10 | ||||
| -rwxr-xr-x | config/hypr/scripts/Kitty_themes.sh | 29 |
2 files changed, 35 insertions, 4 deletions
diff --git a/config/hypr/scripts/Ghostty_themes.sh b/config/hypr/scripts/Ghostty_themes.sh index cc9158a6..f39be65a 100755 --- a/config/hypr/scripts/Ghostty_themes.sh +++ b/config/hypr/scripts/Ghostty_themes.sh @@ -52,12 +52,19 @@ ensure_managed_ghostty_config() { config_file="$fallback_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 + fi +} ensure_managed_ghostty_config 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 rofi_config_args=() if [[ -f "$rofi_theme_primary" ]]; then @@ -155,6 +162,7 @@ END { } ' "$config_file" > "$tmp_file" mv "$tmp_file" "$config_file" + sync_runtime_ghostty_config refresh_wallpaper_theme notify_user "$iDIR/ja.png" "Ghostty Theme Applied" "$wallust_option_label" exit 0 @@ -187,6 +195,7 @@ END { } ' "$config_file" > "$tmp_file" mv "$tmp_file" "$config_file" + sync_runtime_ghostty_config pkill -SIGUSR2 ghostty >/dev/null 2>&1 || true notify_user "$iDIR/ja.png" "Ghostty Theme Applied" "$default_option_label" @@ -242,6 +251,7 @@ END { }' "$config_file" > "$tmp_file" mv "$tmp_file" "$config_file" +sync_runtime_ghostty_config 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 c1f1512f..15274376 100755 --- a/config/hypr/scripts/Kitty_themes.sh +++ b/config/hypr/scripts/Kitty_themes.sh @@ -35,6 +35,13 @@ ensure_managed_kitty_config() { kitty_config="$fallback_kitty_config" } +sync_runtime_kitty_config() { + if [ "$kitty_config" != "$fallback_kitty_config" ] && [ -r "$kitty_config" ]; then + mkdir -p "$(dirname "$fallback_kitty_config")" 2>/dev/null || true + cp -f "$kitty_config" "$fallback_kitty_config" 2>/dev/null || true + fi +} + # --- Helper Functions --- notify_user() { notify-send -u low -i "$1" "$2" "$3" @@ -98,10 +105,10 @@ apply_kitty_theme_to_config() { cp "$kitty_config" "$temp_kitty_config_file" local include_target - include_target="include ./kitty-themes/$(basename "$theme_file_path_to_apply")" + include_target="include ${XDG_CONFIG_HOME:-$HOME/.config}/kitty/kitty-themes/$(basename "$theme_file_path_to_apply")" - if grep -q -E '^[#[:space:]]*include\s+\./kitty-themes/.*\.conf' "$temp_kitty_config_file"; then - sed -i -E "s|^([#[:space:]]*include\s+\./kitty-themes/).*\.conf|$include_target|g" "$temp_kitty_config_file" + if grep -q -E '^[#[:space:]]*include[[:space:]]+.*kitty-themes/.*\.conf' "$temp_kitty_config_file"; then + sed -i -E "s|^[#[:space:]]*include[[:space:]]+.*kitty-themes/.*\.conf|$include_target|g" "$temp_kitty_config_file" else if [ -s "$temp_kitty_config_file" ] && [ "$(tail -c1 "$temp_kitty_config_file")" != "" ]; then echo >>"$temp_kitty_config_file" @@ -111,6 +118,7 @@ apply_kitty_theme_to_config() { cp "$temp_kitty_config_file" "$kitty_config" rm "$temp_kitty_config_file" + sync_runtime_kitty_config local trigger_wallust_refresh=0 if [ "$theme_name_to_apply" = "Set by wallpaper" ] && [ -x "$wallust_refresh_script" ]; then trigger_wallust_refresh=1 @@ -151,6 +159,7 @@ if [ ! -f "$kitty_config" ] || [ ! -r "$kitty_config" ]; then notify_user "$iDIR/error.png" "E-R-R-O-R" "Kitty config not found: $kitty_config" exit 1 fi +sync_runtime_kitty_config original_kitty_config_content_backup=$(cat "$kitty_config") @@ -163,7 +172,19 @@ if [ ${#available_theme_names[@]} -eq 0 ]; then fi current_selection_index=0 -current_active_theme_name=$(awk -F'include ./kitty-themes/|\\.conf' '/^[[:space:]]*include \\.\/kitty-themes\/.*\\.conf/{print $2; exit}' "$kitty_config") +current_active_theme_name=$( + awk ' + /^[[:space:]]*include[[:space:]]+.*kitty-themes\/.*\.conf/ { + line=$0 + sub(/^[[:space:]]*include[[:space:]]+/, "", line) + gsub(/^"|"$/, "", line) + gsub(/^.*\//, "", line) + sub(/\.conf$/, "", line) + print line + exit + } + ' "$kitty_config" +) if [ "$current_active_theme_name" = "01-Wallust" ]; then current_active_theme_name="Set by wallpaper" elif [ "$current_active_theme_name" = "00-Default" ]; then |
