mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 12:19:24 +00:00
47 lines
1.3 KiB
Plaintext
47 lines
1.3 KiB
Plaintext
![]() |
#!/bin/bash
|
||
|
|
||
|
# omarchy-theme-set: Set a theme, specified by its name.
|
||
|
# Usage: omarchy-theme-set <theme-name>
|
||
|
|
||
|
THEMES_DIR="$HOME/.config/omarchy/themes/"
|
||
|
CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme"
|
||
|
|
||
|
if [[ -z "$1" ]]; then
|
||
|
echo "Usage: omarchy-theme-set <theme-name>" >&2
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
THEME_NAME="$1"
|
||
|
THEME_PATH="$THEMES_DIR/$THEME_NAME"
|
||
|
BACKGROUND_PATH="$HOME/.config/omarchy/backgrounds/$THEME_NAME"
|
||
|
|
||
|
# Check if the theme entered exists
|
||
|
if [[ ! -d "$THEME_PATH" ]]; then
|
||
|
echo "Theme '$THEME_NAME' does not exist in $THEMES_DIR" >&2
|
||
|
exit 2
|
||
|
fi
|
||
|
|
||
|
# Update theme symlinks
|
||
|
ln -nsf "$BACKGROUND_PATH" "$HOME/.config/omarchy/current/backgrounds"
|
||
|
ln -nsf "$THEME_PATH" "$CURRENT_THEME_DIR"
|
||
|
|
||
|
# Trigger alacritty config reload
|
||
|
touch "$HOME/.config/alacritty/alacritty.toml"
|
||
|
|
||
|
# Restart components to apply new theme
|
||
|
pkill -SIGUSR2 waybar
|
||
|
makoctl reload
|
||
|
hyprctl reload
|
||
|
|
||
|
# Set new background
|
||
|
first_bg=$(find "$HOME/.config/omarchy/current/backgrounds/" -type f | head -n 1)
|
||
|
if [[ -n "$first_bg" ]]; then
|
||
|
ln -nsf "$first_bg" "$HOME/.config/omarchy/current/background"
|
||
|
pkill -x swaybg
|
||
|
setsid swaybg -i "$HOME/.config/omarchy/current/background" -m fill &
|
||
|
else
|
||
|
# Background does not exist for this theme - fallback to solid black.
|
||
|
rm -f "$HOME/.config/omarchy/current/background"
|
||
|
pkill -x swaybg
|
||
|
setsid swaybg -c '#000000' &
|
||
|
fi
|