initial commit
This commit is contained in:
Executable
+83
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stage 50 — apply the Catppuccin Macchiato theme to everything that needs
|
||||
# a runtime nudge rather than a config file.
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||
|
||||
log "Theming"
|
||||
|
||||
require_not_root
|
||||
|
||||
GTK_THEME_NAME="catppuccin-macchiato-mauve-standard+default"
|
||||
ICON_THEME="Papirus-Dark"
|
||||
CURSOR_THEME="catppuccin-macchiato-dark-cursors"
|
||||
|
||||
# --- verify the themes actually landed ------------------------------------
|
||||
theme_exists() {
|
||||
local name="$1" kind="$2" # kind: themes | icons
|
||||
[[ -d "/usr/share/$kind/$name" || -d "$HOME/.local/share/$kind/$name" || -d "$HOME/.$kind/$name" ]]
|
||||
}
|
||||
|
||||
if theme_exists "$GTK_THEME_NAME" themes; then
|
||||
ok "GTK theme found: $GTK_THEME_NAME"
|
||||
else
|
||||
warn "GTK theme '$GTK_THEME_NAME' not installed"
|
||||
# The AUR package name for the accent may differ; fall back to whatever
|
||||
# catppuccin-macchiato theme is present so apps are not left on Adwaita.
|
||||
found="$(find /usr/share/themes "$HOME/.local/share/themes" -maxdepth 1 \
|
||||
-iname 'catppuccin-macchiato*' -printf '%f\n' 2>/dev/null | sort | head -n1 || true)"
|
||||
if [[ -n "$found" ]]; then
|
||||
warn "using '$found' instead — updating the GTK settings files"
|
||||
GTK_THEME_NAME="$found"
|
||||
if [[ "$DRY_RUN" != "1" ]]; then
|
||||
sed -i "s/^gtk-theme-name=.*/gtk-theme-name=$GTK_THEME_NAME/" \
|
||||
"$HOME/.config/gtk-3.0/settings.ini" "$HOME/.config/gtk-4.0/settings.ini" 2>/dev/null || true
|
||||
sed -i "s/^gtk-theme-name=.*/gtk-theme-name=\"$GTK_THEME_NAME\"/" \
|
||||
"$HOME/.gtkrc-2.0" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
theme_exists "$ICON_THEME" icons || warn "icon theme '$ICON_THEME' not installed"
|
||||
theme_exists "$CURSOR_THEME" icons || warn "cursor theme '$CURSOR_THEME' not installed"
|
||||
|
||||
# --- Papirus folders in Catppuccin colours --------------------------------
|
||||
if have papirus-folders; then
|
||||
step "recolouring Papirus folders (mauve)"
|
||||
run sudo papirus-folders -C cat-macchiato-mauve --theme Papirus-Dark >/dev/null 2>&1 \
|
||||
|| warn "papirus-folders failed; folders keep the stock colour"
|
||||
fi
|
||||
|
||||
# --- default cursor theme (used by the root window and non-GTK apps) ------
|
||||
step "setting the default X cursor theme"
|
||||
if [[ "$DRY_RUN" != "1" ]]; then
|
||||
mkdir -p "$HOME/.icons/default"
|
||||
cat > "$HOME/.icons/default/index.theme" <<INI
|
||||
[Icon Theme]
|
||||
Name=Default
|
||||
Comment=Default cursor theme
|
||||
Inherits=$CURSOR_THEME
|
||||
INI
|
||||
fi
|
||||
ok "cursor theme set to $CURSOR_THEME"
|
||||
|
||||
# --- dconf/gsettings, for the handful of apps that ignore settings.ini ----
|
||||
if have gsettings; then
|
||||
step "applying gsettings desktop preferences"
|
||||
run gsettings set org.gnome.desktop.interface gtk-theme "$GTK_THEME_NAME" 2>/dev/null || true
|
||||
run gsettings set org.gnome.desktop.interface icon-theme "$ICON_THEME" 2>/dev/null || true
|
||||
run gsettings set org.gnome.desktop.interface cursor-theme "$CURSOR_THEME" 2>/dev/null || true
|
||||
run gsettings set org.gnome.desktop.interface font-name "Inconsolata Nerd Font 11" 2>/dev/null || true
|
||||
run gsettings set org.gnome.desktop.interface monospace-font-name "Inconsolata Nerd Font 11" 2>/dev/null || true
|
||||
run gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# --- reload anything already running --------------------------------------
|
||||
if [[ -n "${DISPLAY:-}" && "$DRY_RUN" != "1" ]]; then
|
||||
step "reloading the live session"
|
||||
xrdb -merge "$HOME/.Xresources" 2>/dev/null || true
|
||||
have i3-msg && i3-msg reload >/dev/null 2>&1 || true
|
||||
have dunstctl && dunstctl reload >/dev/null 2>&1 || true
|
||||
[[ -x "$HOME/.config/polybar/launch.sh" ]] && "$HOME/.config/polybar/launch.sh" || true
|
||||
fi
|
||||
|
||||
ok "theming applied"
|
||||
Reference in New Issue
Block a user