From f762f9ae497749560dcb68f24110acc256661c06 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 5 Jan 2026 21:56:50 -0500 Subject: [PATCH] theme: fix gtk apply button on empty file fixes #1280 --- quickshell/scripts/gtk.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/quickshell/scripts/gtk.sh b/quickshell/scripts/gtk.sh index 397e9a32..454b0f23 100755 --- a/quickshell/scripts/gtk.sh +++ b/quickshell/scripts/gtk.sh @@ -45,8 +45,12 @@ apply_gtk4_colors() { exit 1 fi - if [ -f "$gtk_css" ]; then - sed -i '/^@import url.*dank-colors\.css.*);$/d' "$gtk_css" + if [ -f "$gtk_css" ] && grep -q '^@import url.*dank-colors\.css.*);$' "$gtk_css"; then + echo "GTK4 import already exists" + return + fi + + if [ -f "$gtk_css" ] && [ -s "$gtk_css" ]; then sed -i "1i\\$gtk4_import" "$gtk_css" else echo "$gtk4_import" >"$gtk_css"