aboutsummaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-15 11:16:09 +0200
committerDanilo M. <danix@danix.xyz>2026-09-15 11:16:09 +0200
commita9f3e65355b64577044467ca70ca16d00fba016b (patch)
treee23ba75ade9be67f194a6535d351f6a8fd9909ae /install.sh
parentc90c72ed7d5bb5337319a053bf89d73fcb16c604 (diff)
downloadunified-desktop-theme-a9f3e65355b64577044467ca70ca16d00fba016b.tar.gz
unified-desktop-theme-a9f3e65355b64577044467ca70ca16d00fba016b.zip
feat(palette): add Sublime Text as a consumer
Two outputs, not one. The colour scheme themes the editor pane and tracks the wallpaper accent; the theme themes the UI chrome and sits on the scheme's fixed accent, because Sublime reads a theme once per window and a moving accent would leave open windows disagreeing with new ones. The colour scheme costs no new roles. Its scopes map onto the sixteen ANSI slots every scheme already declares, so all nine satisfy it and the identical-role-set selftest passes untouched. The theme is an override layered over Material Behave rather than a theme of its own: that theme hardcodes 419 rules of [r,g,b] literals with no variables, so the chrome surfaces are restated and its geometry, icons and animations are inherited. It installs under the name of the theme it overrides, because Sublime merges .sublime-theme files by filename with Packages/User last; under its own name it would never apply. It also has to follow Material Behave's material_theme_contrast_mode block and carry no settings gate, or contrast mode wins. The accent is replaced by matching the variable's current value rather than a placeholder: install.sh copies the file out of the repo, so after the first wallpaper change there is no placeholder left to substitute. udt-accent --selftest now covers that it stays idempotent. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/install.sh b/install.sh
index 2083292..cdcdc99 100755
--- a/install.sh
+++ b/install.sh
@@ -61,6 +61,33 @@ fi
install -Dm644 "$repo/templates/terminal/kitty-theme.conf" \
"$HOME/.config/kitty/current-theme.conf"
+# Sublime Text. Copied into Packages/User, which Sublime watches, so writing it
+# reaches a running editor. The file still carries @ACCENT@, which udt-accent
+# substitutes below; selecting it is a separate step because color_scheme lives
+# in Preferences.sublime-settings alongside settings that are none of our
+# business, so only that one key is rewritten, and only if it is not ours yet.
+subl="$HOME/.config/sublime-text/Packages/User"
+if [ -d "$subl" ]; then
+ install -Dm644 "$repo/templates/sublime/udt.sublime-color-scheme" \
+ "$subl/udt.sublime-color-scheme"
+ # The UI chrome is an override, and Sublime merges .sublime-theme files by
+ # FILENAME across packages with User last. So it has to be installed under
+ # the name of the theme it layers over, not under a name of its own: called
+ # udt.sublime-theme it would be an unselected theme that never applies.
+ # Renaming it here rather than in the repo keeps the source name obvious.
+ behave="$subl/Material Behave.sublime-theme"
+ if [ -f "$behave" ] && ! grep -q 'Generated by udt-palette' "$behave"; then
+ cp "$behave" "$behave.pre-udt"
+ echo "sublime: kept your theme override as $(basename "$behave").pre-udt"
+ fi
+ install -Dm644 "$repo/templates/sublime/udt.sublime-theme" "$behave"
+ prefs="$subl/Preferences.sublime-settings"
+ if [ -f "$prefs" ] && ! grep -q '"color_scheme".*udt\.sublime-color-scheme' "$prefs"; then
+ sed -i 's|"color_scheme":[[:space:]]*"[^"]*"|"color_scheme": "Packages/User/udt.sublime-color-scheme"|' "$prefs"
+ echo "sublime: color_scheme switched to udt"
+ fi
+fi
+
# Kvantum wants a directory per theme, named after itself, and qt5ct/qt6ct
# reach Qt apps through it. The theme is installed under one fixed name rather
# than one per scheme: Kvantum caches by name, so reusing it means a switch