From 0d081f3aa56a0a137b1f00c83b1e7cb6dea79500 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Wed, 22 Jul 2026 02:44:02 -0400 Subject: Moved default config kitty/ghostty to UserConfigs Updated scripts and set eclusion in lua mgiration script to preseve them Signed-off-by: Don Williams On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: CHANGELOG.md modified: config/hypr/scripts/DarkLight.sh modified: config/hypr/scripts/Ghostty_themes.sh modified: config/hypr/scripts/Kitty_themes.sh modified: scripts/migrate-hypr-to-lua.sh --- CHANGELOG.md | 2 ++ config/hypr/scripts/DarkLight.sh | 39 ++++++++++++++++++++++++++++------- config/hypr/scripts/Ghostty_themes.sh | 24 +++++++++++++++++++-- config/hypr/scripts/Kitty_themes.sh | 27 +++++++++++++++++++++++- scripts/migrate-hypr-to-lua.sh | 27 ++++++++++++++++++++++-- 5 files changed, 107 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f35ec319..ff287207 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ## Added: +- `kitty.conf` and `ghostty/config` are now saved to `UserConfigs` directory + - If file is gone or can't be read it will fall back to defaults - `qs-hyprview` an alternative to quickshell `overview` - `CTRL-TAB` to activate - Has search filter diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index 16f1a4ef..e8e69910 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -25,7 +25,9 @@ theme_state_dir="${XDG_STATE_HOME:-$HOME/.local/state}/hypr" theme_state_file="$theme_state_dir/theme_mode" legacy_theme_state_file="$HOME/.cache/.theme_mode" -kitty_conf="${XDG_CONFIG_HOME:-$HOME/.config}/kitty/kitty.conf" +user_kitty_conf="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserConfigs/kitty.conf" +fallback_kitty_conf="${XDG_CONFIG_HOME:-$HOME/.config}/kitty/kitty.conf" +kitty_conf="$user_kitty_conf" wallust_config="${XDG_CONFIG_HOME:-$HOME/.config}/wallust/wallust.toml" pallete_dark="dark16" @@ -39,6 +41,24 @@ notify_enabled=1 preserve_wallpaper=0 forced_mode="" +ensure_managed_kitty_conf() { + if [[ -f "$user_kitty_conf" && -r "$user_kitty_conf" ]]; then + kitty_conf="$user_kitty_conf" + return 0 + fi + + if [[ -r "$fallback_kitty_conf" ]]; then + mkdir -p "$(dirname "$user_kitty_conf")" 2>/dev/null || true + cp -f "$fallback_kitty_conf" "$user_kitty_conf" 2>/dev/null || true + if [[ -f "$user_kitty_conf" && -r "$user_kitty_conf" ]]; then + kitty_conf="$user_kitty_conf" + return 0 + fi + fi + + kitty_conf="$fallback_kitty_conf" +} + normalize_mode() { case "$1" in Dark|Light) printf '%s' "$1" ;; @@ -185,14 +205,19 @@ if command -v ags >/dev/null 2>&1; then fi # kitty background color change +ensure_managed_kitty_conf if [ "$next_mode" = "Dark" ]; then - sed -i '/^foreground /s/^foreground .*/foreground #dddddd/' "${kitty_conf}" - sed -i '/^background /s/^background .*/background #000000/' "${kitty_conf}" - sed -i '/^cursor /s/^cursor .*/cursor #dddddd/' "${kitty_conf}" + if [[ -w "$kitty_conf" ]]; then + sed -i '/^foreground /s/^foreground .*/foreground #dddddd/' "${kitty_conf}" + sed -i '/^background /s/^background .*/background #000000/' "${kitty_conf}" + sed -i '/^cursor /s/^cursor .*/cursor #dddddd/' "${kitty_conf}" + fi else - sed -i '/^foreground /s/^foreground .*/foreground #000000/' "${kitty_conf}" - sed -i '/^background /s/^background .*/background #dddddd/' "${kitty_conf}" - sed -i '/^cursor /s/^cursor .*/cursor #000000/' "${kitty_conf}" + if [[ -w "$kitty_conf" ]]; then + sed -i '/^foreground /s/^foreground .*/foreground #000000/' "${kitty_conf}" + sed -i '/^background /s/^background .*/background #dddddd/' "${kitty_conf}" + sed -i '/^cursor /s/^cursor .*/cursor #000000/' "${kitty_conf}" + fi fi for pid_kitty in $(pidof kitty); do diff --git a/config/hypr/scripts/Ghostty_themes.sh b/config/hypr/scripts/Ghostty_themes.sh index 1b0e1f9e..cc9158a6 100755 --- a/config/hypr/scripts/Ghostty_themes.sh +++ b/config/hypr/scripts/Ghostty_themes.sh @@ -7,7 +7,9 @@ # ================================================== # Ghostty theme selector -config_file="${XDG_CONFIG_HOME:-$HOME/.config}/ghostty/config" +user_ghostty_config="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserConfigs/ghostty.conf" +fallback_ghostty_config="${XDG_CONFIG_HOME:-$HOME/.config}/ghostty/config" +config_file="$user_ghostty_config" iDIR="${XDG_CONFIG_HOME:-$HOME/.config}/swaync/images" rofi_theme_primary="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/config-ghostty-theme.rasi" rofi_theme_fallback="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/config-edit.rasi" @@ -33,8 +35,26 @@ refresh_wallpaper_theme() { fi pkill -SIGUSR2 ghostty >/dev/null 2>&1 || true } +ensure_managed_ghostty_config() { + if [[ -f "$user_ghostty_config" && -r "$user_ghostty_config" ]]; then + config_file="$user_ghostty_config" + return 0 + fi + + if [[ -r "$fallback_ghostty_config" ]]; then + mkdir -p "$(dirname "$user_ghostty_config")" 2>/dev/null || true + cp -f "$fallback_ghostty_config" "$user_ghostty_config" 2>/dev/null || true + if [[ -f "$user_ghostty_config" && -r "$user_ghostty_config" ]]; then + config_file="$user_ghostty_config" + return 0 + fi + fi + + config_file="$fallback_ghostty_config" +} -if [[ ! -f "$config_file" ]]; then +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 diff --git a/config/hypr/scripts/Kitty_themes.sh b/config/hypr/scripts/Kitty_themes.sh index 5d6445e9..c1f1512f 100755 --- a/config/hypr/scripts/Kitty_themes.sh +++ b/config/hypr/scripts/Kitty_themes.sh @@ -9,12 +9,32 @@ # Define directories and variables kitty_themes_DiR="${XDG_CONFIG_HOME:-$HOME/.config}/kitty/kitty-themes" # Kitty Themes Directory -kitty_config="${XDG_CONFIG_HOME:-$HOME/.config}/kitty/kitty.conf" +user_kitty_config="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserConfigs/kitty.conf" +fallback_kitty_config="${XDG_CONFIG_HOME:-$HOME/.config}/kitty/kitty.conf" +kitty_config="$user_kitty_config" iDIR="${XDG_CONFIG_HOME:-$HOME/.config}/swaync/images" # For notifications rofi_theme_for_this_script="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/config-kitty-theme.rasi" wallust_refresh_script="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts/WallustSwww.sh" debug_log="${XDG_CACHE_HOME:-$HOME/.cache}/kooldots-kitty-themes.log" +ensure_managed_kitty_config() { + if [ -f "$user_kitty_config" ] && [ -r "$user_kitty_config" ]; then + kitty_config="$user_kitty_config" + return 0 + fi + + if [ -r "$fallback_kitty_config" ]; then + mkdir -p "$(dirname "$user_kitty_config")" 2>/dev/null || true + cp -f "$fallback_kitty_config" "$user_kitty_config" 2>/dev/null || true + if [ -f "$user_kitty_config" ] && [ -r "$user_kitty_config" ]; then + kitty_config="$user_kitty_config" + return 0 + fi + fi + + kitty_config="$fallback_kitty_config" +} + # --- Helper Functions --- notify_user() { notify-send -u low -i "$1" "$2" "$3" @@ -126,6 +146,11 @@ if [ ! -f "$rofi_theme_for_this_script" ]; then notify_user "$iDIR/error.png" "Rofi Config Missing" "Rofi theme for Kitty selector not found at: $rofi_theme_for_this_script." exit 1 fi +ensure_managed_kitty_config +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 original_kitty_config_content_backup=$(cat "$kitty_config") diff --git a/scripts/migrate-hypr-to-lua.sh b/scripts/migrate-hypr-to-lua.sh index a3e4c78c..0a127688 100755 --- a/scripts/migrate-hypr-to-lua.sh +++ b/scripts/migrate-hypr-to-lua.sh @@ -53,6 +53,13 @@ SRC_USER_LUA_TEMPLATES_DIR="$SRC_HYPR_DIR/UserConfigs" DEST_LUA_ENTRY="$DEST_HYPR_DIR/hyprland.lua" DEST_LUA_ENTRY_DISABLED="$DEST_HYPR_DIR/hyprland.lua.disable" SOURCE_LUA_ENTRY="" +USER_CONFIGS_PRESERVED_CONFS=( + "kitty.conf" + "ghostty.conf" + "hyprview-layout.conf" + "LaptopDisplay.conf" + "WorkSpaceRules.conf" +) usage() { cat <