Files
NexusOS/assets/themes/install-theme.sh
T
janvanwan 42eaed647a feat: sync with upstream — v1.2.0, in-app updates, Projects, modules
Brings the public tree back in line with the development repo after several
weeks of drift caused by a stale publish include list.

New:
- In-app update path: GET /update/check compares the checkout against
  origin/main and POST /update/apply runs `ncp upgrade` detached (pull,
  rebuild, restart). The sidebar shows the version, checks on click, and
  offers an "update available" pill.
- Projects: a project workspace groups chats and RAG documents, with
  per-project instructions and document retrieval scoped to the active
  project. Replaces the standalone Documents page.
- modules/: auto-discovered feature plugins (mail, network) with their
  frontend counterparts and tests.
- Memory curation runs in-process (synapse/memory/curator.py) on the chat
  model when a conversation goes idle. The separate memory service on :8001
  is gone, along with the launcher lines that started it.

Also: the KDE theme, panel and Promethean terminal assets, the full test
suite, and VERSION 1.2.0.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-08-25 09:13:55 -05:00

142 lines
5.9 KiB
Bash

#!/usr/bin/env bash
# install-theme.sh — restore the NexusOS desktop theme wiring.
#
# The theme *assets* live in this repo (assets/themes/).
# This script recreates everything OUTSIDE the repo that makes the desktop
# actually use them: symlinks, xfconf (xsettings + xfwm4), and the canonical
# lines in the GTK 3/4 settings.ini files.
#
# Idempotent and safe: re-running only fixes drift; any real file it would
# replace with a symlink is backed up to <file>.bak-YYYYMMDD first.
#
# Usage: ./assets/themes/install-theme.sh (apply + reload)
# ./assets/themes/install-theme.sh --no-reload
set -euo pipefail
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
RELOAD=1
[[ "${1:-}" == "--no-reload" ]] && RELOAD=0
STAMP="$(date +%Y%m%d)"
# Canonical values — keep in sync with assets/themes/NexusOS/index.theme
GTK_THEME="NexusOS"
ICON_THEME="NexusOS"
CURSOR_THEME="DMZ-White"
CURSOR_SIZE="24"
FONT_NAME="Ubuntu 10"
say() { printf ' %s\n' "$*"; }
# link <target> <linkname> : make linkname a symlink to target, backing up
# any pre-existing real file/dir that isn't already the correct link.
link() {
local target="$1" linkname="$2"
mkdir -p "$(dirname "$linkname")"
if [[ -L "$linkname" && "$(readlink -f "$linkname")" == "$(readlink -f "$target")" ]]; then
say "ok $linkname"
return
fi
if [[ -e "$linkname" || -L "$linkname" ]]; then
mv "$linkname" "$linkname.bak-$STAMP"
say "backup $linkname -> $linkname.bak-$STAMP"
fi
ln -sfn "$target" "$linkname"
say "link $linkname -> $target"
}
# set_ini <file> <key> <value> : ensure key=value under [Settings],
# creating the file/section/key as needed, replacing in place otherwise.
set_ini() {
local file="$1" key="$2" value="$3"
if [[ ! -f "$file" ]]; then
mkdir -p "$(dirname "$file")"
printf '[Settings]\n%s=%s\n' "$key" "$value" > "$file"
say "create $file ($key)"
return
fi
if grep -qE "^${key}=" "$file"; then
sed -i "s|^${key}=.*|${key}=${value}|" "$file"
else
sed -i "0,/^\[Settings\]/s//[Settings]\n${key}=${value}/" "$file"
fi
say "ini $file : $key=$value"
}
xset() { # xfconf set, creating the prop with the right type if absent
local channel="$1" prop="$2" type="$3" val="$4"
command -v xfconf-query >/dev/null || return 0
xfconf-query -c "$channel" -p "$prop" -n -t "$type" -s "$val" 2>/dev/null \
|| xfconf-query -c "$channel" -p "$prop" -s "$val" 2>/dev/null || true
say "xfconf $channel$prop = $val"
}
echo "NexusOS theme — restoring wiring from $REPO"
echo "[1/4] Symlinks"
link "$REPO/assets/themes/NexusOS" "$HOME/.themes/NexusOS"
# Icons go in BOTH places on purpose. ~/.icons is the GTK/XFCE legacy path and
# is all this used to install; Qt/KF5 searches XDG data dirs only, so under
# Plasma the theme was never found and every icon silently fell back to Breeze
# (`kiconfinder5 nexusos-logo` returned nothing at all).
link "$REPO/assets/themes/NexusOS-icons" "$HOME/.icons/NexusOS"
link "$REPO/assets/themes/NexusOS-icons" "$HOME/.local/share/icons/NexusOS"
link "$REPO/assets/themes/gtk3-user-overrides.css" "$HOME/.config/gtk-3.0/gtk.css"
echo "[2/4] xfconf (xsettings + xfwm4)"
xset xsettings /Net/ThemeName string "$GTK_THEME"
xset xsettings /Net/IconThemeName string "$ICON_THEME"
xset xsettings /Gtk/CursorThemeName string "$CURSOR_THEME"
xset xsettings /Gtk/CursorThemeSize int "$CURSOR_SIZE"
xset xsettings /Gtk/FontName string "$FONT_NAME"
xset xfwm4 /general/theme string "$GTK_THEME"
echo "[3/4] GTK 3 / GTK 4 settings.ini"
for f in "$HOME/.config/gtk-3.0/settings.ini" "$HOME/.config/gtk-4.0/settings.ini"; do
set_ini "$f" gtk-theme-name "$GTK_THEME"
set_ini "$f" gtk-icon-theme-name "$ICON_THEME"
set_ini "$f" gtk-cursor-theme-name "$CURSOR_THEME"
set_ini "$f" gtk-cursor-theme-size "$CURSOR_SIZE"
set_ini "$f" gtk-font-name "$FONT_NAME"
done
echo "[4/4] Icon caches"
gtk-update-icon-cache -f -t "$HOME/.icons/NexusOS" 2>/dev/null \
&& say "ok NexusOS icon cache rebuilt" \
|| say "WARN NexusOS icon cache rebuild failed"
# Inherits is a comma-separated list, so check the first (primary) parent
# rather than the whole string — treating "breeze-dark,hicolor" as one theme
# name found no such directory and warned about a fallback that is installed.
INH="$(grep -i '^Inherits=' "$REPO/assets/themes/NexusOS-icons/index.theme" 2>/dev/null | cut -d= -f2 | cut -d, -f1)"
if [[ -n "$INH" ]]; then
INH_OK=0
for dir in /usr/share/icons ~/.icons ~/.local/share/icons; do
[[ -d "$dir/$INH" ]] && { INH_OK=1; INH_DIR="$dir/$INH"; break; }
done
if [[ "$INH_OK" == 1 ]]; then
say "ok icon fallback '$INH' found"
if sudo -n gtk-update-icon-cache -f -t "$INH_DIR" 2>/dev/null; then
say "ok $INH icon cache rebuilt"
else
say "note $INH cache skipped (no passwordless sudo — run manually if needed)"
fi
else
say "WARN icon fallback '$INH' not installed — icons may be missing"
fi
fi
echo "[5/5] Sanity"
for dir in /usr/share/icons ~/.icons ~/.local/share/icons; do
[[ -d "$dir/$CURSOR_THEME" ]] && { say "ok cursor '$CURSOR_THEME' found"; CUR_OK=1; break; }
done
[[ "${CUR_OK:-0}" == 1 ]] || say "WARN cursor theme '$CURSOR_THEME' not installed — will fall back"
if [[ "$RELOAD" == 1 ]] && command -v xfconf-query >/dev/null && [[ -n "${DISPLAY:-}" ]]; then
xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita" 2>/dev/null || true
xfconf-query -c xsettings -p /Net/ThemeName -s "$GTK_THEME" 2>/dev/null || true
command -v xfdesktop >/dev/null && (xfdesktop --reload >/dev/null 2>&1 &) || true
command -v xfce4-panel >/dev/null && (xfce4-panel -r >/dev/null 2>&1 &) || true
echo "Reloaded. (some already-running apps may need a restart)"
else
echo "Done. Skipped live reload (no X session or --no-reload)."
fi