forge
Explore
Log in

Don't you dare go Hollow

Make the GTK2 include self-installing and $HOME-relative

Browse files at this commit

377311fc997c3bcabd5d386843a41785798ca6f8Ahmet Kaan GümüşParent: df703de
  • fix
    • make the GTK2 include self-installing and $HOME-relative
Show full message
fix(theming): make the GTK2 include self-installing and $HOME-relative

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.shmodified+10 -6
@@ -6,13 +6,17 @@
6 # Configure ~/.gtkrc-2.0:6 # Configure ~/.gtkrc-2.0:
7 # - Force gtk-theme-name to Raleigh (minimal, no pixmap engine, lets our colors through)7 # - Force gtk-theme-name to Raleigh (minimal, no pixmap engine, lets our colors through)
8 # - Ensure our include is parsed LAST so our styles win8 # - Ensure our include is parsed LAST so our styles win
9+#
10+# nwg-look owns this file when it is installed, but GTK2 will not read our
11+# generated .mine without the include, and on a fresh machine (or without
12+# nwg-look) the file does not exist at all — so create it instead of bailing out.
9 GTKRC="$HOME/.gtkrc-2.0"13 GTKRC="$HOME/.gtkrc-2.0"
10-MINE_INC='include "/home/tahinli/.gtkrc-2.0.mine"'14+MINE_INC="include \"$HOME/.gtkrc-2.0.mine\""
11-if [ -f "$GTKRC" ] && grep -qF "$MINE_INC" "$GTKRC"; then15+[ -f "$GTKRC" ] || : > "$GTKRC"
12- grep -vF "$MINE_INC" "$GTKRC" | sed 's/^gtk-theme-name=.*/gtk-theme-name="Raleigh"/' > "$GTKRC.tmp"16+grep -q '^gtk-theme-name=' "$GTKRC" || echo 'gtk-theme-name="Raleigh"' >> "$GTKRC"
13- echo "$MINE_INC" >> "$GTKRC.tmp"17+grep -vF "$MINE_INC" "$GTKRC" | sed 's/^gtk-theme-name=.*/gtk-theme-name="Raleigh"/' > "$GTKRC.tmp"
14- mv "$GTKRC.tmp" "$GTKRC"18+echo "$MINE_INC" >> "$GTKRC.tmp"
15-fi19+mv "$GTKRC.tmp" "$GTKRC"
16 20
17 # Convert hex colors to KDE's R,G,B integer format in kdeglobals21 # Convert hex colors to KDE's R,G,B integer format in kdeglobals
18 KDEGLOBALS="$HOME/.config/kdeglobals"22 KDEGLOBALS="$HOME/.config/kdeglobals"