Files
arthur-os/bin/omarchy-theme-set
T
6b4109faba Background selector (#4519)
* UPDATE: select background method

* ADD: migration file for background selector

* Add symlink for background selector in walker-elephant.sh

Forgot about this file. Should be added to make sure the background selector feature available in the fresh install

* clean up the code a bit

Updated omarchy background selector to hide from provider list and removed subtext from entries.

* Make the background selector the default

* Fix migration

* FIX: typo on background symlink target

* UPDATE: add ~/.config/omarchy/backgrounds/theme.name

* UPDATE: Cache = false

* Fix escaping for all extensions

* Extract omarchy-theme-bg-set

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
2026-02-18 22:24:43 +01:00

62 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
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 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
omarchy-theme-bg-next
# Restart components to apply new theme
if pgrep -x waybar >/dev/null; then
omarchy-restart-waybar
fi
omarchy-restart-swayosd
omarchy-restart-terminal
omarchy-restart-hyprctl
omarchy-restart-btop
omarchy-restart-opencode
omarchy-restart-mako
omarchy-restart-walker
# Change app-specific themes
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"