aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'config/hypr/scripts')
-rwxr-xr-xconfig/hypr/scripts/DarkLight.sh39
-rwxr-xr-xconfig/hypr/scripts/Ghostty_themes.sh24
-rwxr-xr-xconfig/hypr/scripts/Kitty_themes.sh27
3 files changed, 80 insertions, 10 deletions
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")
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage