Files
arthur-os/bin/omarchy-theme-set
T
Ryan Hughes 2ca15dc767 Remove waybar; relocate bar helper scripts into the shell tree
omarchy-shell's bar plugin replaces waybar on every default path, so the
waybar package, configs, indicator scripts, and toggle/restart/refresh
binaries all go away in this commit.

The four small helper scripts that Bar.qml shells out to (weather.sh and
indicators/*.sh) move with the shell rather than disappear \u2014 they live
at default/quickshell/omarchy-shell/scripts/ now, alongside the rest of
the shell code.

Companion script changes:
  - omarchy-shell-ipc gains --if-running so fire-and-forget refresh
    callers (toggle-idle, toggle-notification-silencing,
    update-available-reset, capture-screenrecording) don't accidentally
    spawn the shell when it isn't already up.
  - omarchy-theme-set, omarchy-tz-select, omarchy-voxtype-{install,model},
    omarchy-toggle-nightlight, omarchy-voxtype-config drop their waybar
    branches and comments.
  - omarchy-voxtype-status's summary stops claiming it's a Waybar helper.
  - omarchy-base.packages drops waybar; install/packaging/fonts.sh's
    comment points at the new bar consumer.
  - SKILL.md / AGENTS.md / omarchy-menu.jsonc lose their waybar entries.
  - test/omarchy-cli-test.sh substitutes a remaining toggle command.
2026-05-14 16:33:20 -04:00

73 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Apply an Omarchy theme
# omarchy:args=<theme-name>
# omarchy:examples=omarchy theme list | omarchy theme set "Tokyo Night"
if [[ -z $1 ]]; then
echo "Usage: omarchy-theme-set <theme-name>"
exit 1
fi
CURRENT_THEME_PATH="$HOME/.config/omarchy/current/theme"
NEXT_THEME_PATH="$HOME/.config/omarchy/current/next-theme"
USER_THEMES_PATH="$HOME/.config/omarchy/themes"
OMARCHY_THEMES_PATH="$OMARCHY_PATH/themes"
THEME_NAME=$(echo "$1" | sed -E 's/<[^>]+>//g' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
if [[ ! -d $OMARCHY_THEMES_PATH/$THEME_NAME ]] && [[ ! -d $USER_THEMES_PATH/$THEME_NAME ]]; then
echo "Theme '$THEME_NAME' does not exist"
exit 1
fi
# Setup clean next theme directory (for atomic theme config swapping)
rm -rf "$NEXT_THEME_PATH"
mkdir -p "$NEXT_THEME_PATH"
# Copy official theme first, then overlay user customizations on top
cp -r "$OMARCHY_THEMES_PATH/$THEME_NAME/"* "$NEXT_THEME_PATH/" 2>/dev/null
cp -r "$USER_THEMES_PATH/$THEME_NAME/"* "$NEXT_THEME_PATH/" 2>/dev/null
# Generate colors.toml from alacritty.toml if theme is missing colors.toml
if [[ ! -f $NEXT_THEME_PATH/colors.toml && -f $NEXT_THEME_PATH/alacritty.toml ]]; then
omarchy-theme-colors-from-alacritty "$NEXT_THEME_PATH"
fi
# Generate dynamic configs
omarchy-theme-set-templates
# Swap next theme in as current
rm -rf "$CURRENT_THEME_PATH"
mv "$NEXT_THEME_PATH" "$CURRENT_THEME_PATH"
# Store theme name for reference
echo "$THEME_NAME" >"$HOME/.config/omarchy/current/theme.name"
# Change background with theme
if [[ $OMARCHY_THEME_SKIP_BACKGROUND != "1" ]]; then
omarchy-theme-bg-next
fi
# Restart components to apply new theme
omarchy-restart-swayosd
omarchy-restart-terminal
omarchy-restart-hyprctl
omarchy-restart-btop
omarchy-restart-opencode
omarchy-restart-helix
# Change app-specific themes
omarchy-theme-set-foot
omarchy-theme-set-gnome
omarchy-theme-set-browser
omarchy-theme-set-vscode
omarchy-theme-set-obsidian
omarchy-theme-set-keyboard
# Call hook on theme set
omarchy-hook theme-set "$THEME_NAME" >/dev/null
# Warm the background selector cache after the theme is applied, off the critical path.
omarchy-theme-bg-cache >/dev/null 2>&1 &