- Relocate themes to assets/themes/ and update all references. - Implement custom SDDM theme and Plymouth theme enhancements. - Add themed templates for Alacritty, Hyprland, Waybar, and other apps. - Introduce Makima key remapper module and configuration. - Add Voxtype and Walker configurations. - Implement systemd power management and timeout optimizations. - Add Nautilus-python extensions for LocalSend. - Update branding assets and ASCII art integration.
58 lines
1.8 KiB
Bash
Executable File
58 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Set the system theme declaratively.
|
|
# Usage: nnomarchy-theme-set <theme-name>
|
|
|
|
THEME_NAME="$1"
|
|
|
|
if [[ -z $THEME_NAME ]]; then
|
|
echo "Usage: nnomarchy-theme-set <theme-name>"
|
|
exit 1
|
|
fi
|
|
|
|
STATE_DIR="$HOME/.config/home-manager"
|
|
STATE_FILE="$STATE_DIR/state.json"
|
|
|
|
# Resolve themes directory (Built-in from Nix store via Home Manager, or user extra)
|
|
if [ -d "$HOME/.config/nnomarchy/themes/$THEME_NAME" ]; then
|
|
THEMES_DIR="$HOME/.config/nnomarchy/themes"
|
|
else
|
|
THEMES_DIR="$HOME/.local/share/nnomarchy/themes"
|
|
fi
|
|
|
|
mkdir -p "$STATE_DIR"
|
|
[[ ! -f $STATE_FILE ]] && echo "{}" > "$STATE_FILE"
|
|
|
|
if [ ! -d "$THEMES_DIR/$THEME_NAME" ] && ! [[ "$THEME_NAME" == "nord" ]]; then
|
|
echo "Theme '$THEME_NAME' not found in $THEMES_DIR"
|
|
# Check if it exists in the palettes file
|
|
# (Assuming nnomarchy-palettes.nix is imported in Nix)
|
|
fi
|
|
|
|
TMP_JSON=$(mktemp)
|
|
jq ".theme = \"$THEME_NAME\"" "$STATE_FILE" > "$TMP_JSON" && mv "$TMP_JSON" "$STATE_FILE"
|
|
|
|
# Sync to system state if we have permissions (for system-level theming like browser policies)
|
|
SYSTEM_STATE_FILE="/etc/nixos/state.json"
|
|
if [ -w "$SYSTEM_STATE_FILE" ] || [ -w "/etc/nixos" ]; then
|
|
sudo jq ".theme = \"$THEME_NAME\"" "$SYSTEM_STATE_FILE" > /tmp/system-state.json 2>/dev/null && sudo mv /tmp/system-state.json "$SYSTEM_STATE_FILE" 2>/dev/null || true
|
|
fi
|
|
|
|
# Try to find a background for this theme
|
|
BG_DIR="$THEMES_DIR/$THEME_NAME/backgrounds"
|
|
if [ -d "$BG_DIR" ]; then
|
|
BG=$(ls "$BG_DIR" | head -n 1)
|
|
if [ -n "$BG" ]; then
|
|
TMP_JSON=$(mktemp)
|
|
jq ".wallpaper = \"$BG_DIR/$BG\"" "$STATE_FILE" > "$TMP_JSON" && mv "$TMP_JSON" "$STATE_FILE"
|
|
fi
|
|
fi
|
|
|
|
echo "Theme set to $THEME_NAME. Applying changes with env-update..."
|
|
rm -rf "$HOME/.config/nnomarchy/current/theme"
|
|
env-update
|
|
|
|
nnomarchy-theme-set-templates
|
|
|
|
nnomarchy-hook theme-set "$THEME_NAME"
|