From 377311fc997c3bcabd5d386843a41785798ca6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 9 Aug 2026 01:21:01 +0300 Subject: [PATCH] fix(theming): make the GTK2 include self-installing and $HOME-relative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The include line that makes GTK2 read our generated ~/.gtkrc-2.0.mine was hardcoded to /home/tahinli, so it never matched under a different username, and the whole block was skipped unless ~/.gtkrc-2.0 already contained that exact line. That file is written by nwg-look, which is not installed here and is absent on a fresh machine — GTK2 theming silently did nothing there. Derive the path from $HOME and create the rc (with gtk-theme-name) when it is missing instead of bailing out. Rewriting it stays idempotent: the include is filtered out and re-appended last on every run. --- .config/scripts/shared/theme_colors.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.config/scripts/shared/theme_colors.sh b/.config/scripts/shared/theme_colors.sh index 851f99c..bf44c08 100755 --- a/.config/scripts/shared/theme_colors.sh +++ b/.config/scripts/shared/theme_colors.sh @@ -6,13 +6,17 @@ # Configure ~/.gtkrc-2.0: # - Force gtk-theme-name to Raleigh (minimal, no pixmap engine, lets our colors through) # - Ensure our include is parsed LAST so our styles win +# +# nwg-look owns this file when it is installed, but GTK2 will not read our +# generated .mine without the include, and on a fresh machine (or without +# nwg-look) the file does not exist at all — so create it instead of bailing out. GTKRC="$HOME/.gtkrc-2.0" -MINE_INC='include "/home/tahinli/.gtkrc-2.0.mine"' -if [ -f "$GTKRC" ] && grep -qF "$MINE_INC" "$GTKRC"; then - grep -vF "$MINE_INC" "$GTKRC" | sed 's/^gtk-theme-name=.*/gtk-theme-name="Raleigh"/' > "$GTKRC.tmp" - echo "$MINE_INC" >> "$GTKRC.tmp" - mv "$GTKRC.tmp" "$GTKRC" -fi +MINE_INC="include \"$HOME/.gtkrc-2.0.mine\"" +[ -f "$GTKRC" ] || : > "$GTKRC" +grep -q '^gtk-theme-name=' "$GTKRC" || echo 'gtk-theme-name="Raleigh"' >> "$GTKRC" +grep -vF "$MINE_INC" "$GTKRC" | sed 's/^gtk-theme-name=.*/gtk-theme-name="Raleigh"/' > "$GTKRC.tmp" +echo "$MINE_INC" >> "$GTKRC.tmp" +mv "$GTKRC.tmp" "$GTKRC" # Convert hex colors to KDE's R,G,B integer format in kdeglobals KDEGLOBALS="$HOME/.config/kdeglobals"