aboutsummaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-16 09:21:22 +0200
committerDanilo M. <danix@danix.xyz>2026-09-16 09:21:22 +0200
commit6bb645eef6078bf8b8cb8f3b807e97e4b227c68c (patch)
tree0a9334a1231ad830b9b9532a80ce2a396ce8cec4 /install.sh
parentbe2e44994179ee7b64fead51b6c2bc0abdb7ea6f (diff)
downloadunified-desktop-theme-6bb645eef6078bf8b8cb8f3b807e97e4b227c68c.tar.gz
unified-desktop-theme-6bb645eef6078bf8b8cb8f3b807e97e4b227c68c.zip
feat(install): install the generated GTK theme as ~/.themes/udt
One fixed name for every scheme, like Kvantum: the name is referenced by gsettings and by the GTK4 symlink, so a per-scheme name would mean rewriting both on every switch and leaving stale themes behind. Only the two GTK directories are installed. The upstream theme this derives from also ships cinnamon, gnome-shell, metacity, xfwm4 and plank directories, none of which anything here reads. gtk-dark.css is written alongside gtk.css because apps request one or the other depending on the prefer-dark setting; upstream ships them identical. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/install.sh b/install.sh
index 0fe2575..b2b1576 100755
--- a/install.sh
+++ b/install.sh
@@ -121,6 +121,39 @@ install -Dm644 "$repo/templates/kvantum/theme.kvconfig" "$kv/udt.kvconfig"
install -Dm644 "$repo/templates/kvantum/theme.svg" "$kv/udt.svg"
printf '[General]\ntheme=udt\n' > "$HOME/.config/Kvantum/kvantum.kvconfig"
+# GTK3 and GTK4. Installed under one fixed name for every scheme, like Kvantum:
+# the theme name is set in gsettings and in a symlink, so a per-scheme name
+# would mean rewriting both on every switch and leaving stale themes behind.
+#
+# Only the two GTK directories are installed. The upstream theme this is
+# derived from also ships cinnamon, gnome-shell, metacity, xfwm4 and plank
+# directories, none of which anything on this desktop reads.
+gtk_theme="$HOME/.themes/udt"
+install -Dm644 "$repo/templates/gtk/index.theme" "$gtk_theme/index.theme"
+for v in 3.0 4.0; do
+ src="gtk3.css"
+ [ "$v" = "4.0" ] && src="gtk4.css"
+ install -Dm644 "$repo/templates/gtk/$src" "$gtk_theme/gtk-$v/gtk.css"
+ # gtk-dark.css is byte-identical to gtk.css upstream; apps ask for one or
+ # the other depending on the prefer-dark setting, so both must exist.
+ install -Dm644 "$repo/templates/gtk/$src" "$gtk_theme/gtk-$v/gtk-dark.css"
+ rm -rf "$gtk_theme/gtk-$v/assets"
+ mkdir -p "$gtk_theme/gtk-$v/assets"
+ cp "$repo"/templates/gtk/assets/*.svg "$gtk_theme/gtk-$v/assets/"
+done
+
+# GTK3 reads the theme name from gsettings on Wayland, not settings.ini: the
+# file is written too, but gsettings is what actually wins. It was once pinned
+# to Breeze, silently overriding the file.
+sed -i 's/^gtk-theme-name=.*/gtk-theme-name=udt/' "$HOME/.config/gtk-3.0/settings.ini"
+if command -v gsettings >/dev/null 2>&1; then
+ gsettings set org.gnome.desktop.interface gtk-theme 'udt' 2>/dev/null || true
+fi
+
+# GTK4 ignores gtk-theme-name entirely; its stylesheet is imported by
+# ~/.config/gtk-4.0/gtk.css through this symlink.
+ln -sfn "$gtk_theme/gtk-4.0" "$HOME/.config/gtk-4.0/theme"
+
# Obsidian and Typora need more than a copy: the Obsidian snippet has to be
# enabled in each vault's appearance.json without disturbing the snippets
# already listed there. Skipped silently when neither app is installed.