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