Reuse the new omarchy-theme-set in omarchy-theme-next

This commit is contained in:
David Heinemeier Hansson
2025-07-14 21:36:15 -07:00
parent bfc8d73300
commit b3338c84b6
2 changed files with 6 additions and 27 deletions

View File

@ -30,22 +30,5 @@ NEXT_INDEX=$(((INDEX + 1) % TOTAL))
NEW_THEME=${THEMES[$NEXT_INDEX]}
NEW_THEME_NAME=$(basename "$NEW_THEME")
# Set current theme
ln -nsf "$HOME/.config/omarchy/backgrounds/$NEW_THEME_NAME" "$HOME/.config/omarchy/current/backgrounds"
ln -nsf "$NEW_THEME" "$HOME/.config/omarchy/current/theme"
# Touch alacritty config to pickup the changed theme
touch "$HOME/.config/alacritty/alacritty.toml"
# Restart for new theme
pkill -SIGUSR2 waybar
makoctl reload
hyprctl reload
# Set new background
ln -nsf $(find "$HOME/.config/omarchy/current/backgrounds/" -type f | head -n 1) "$HOME/.config/omarchy/current/background"
pkill -x swaybg
setsid swaybg -i "$HOME/.config/omarchy/current/background" -m fill &
# Notify of the new theme
omarchy-theme-set $NEW_THEME_NAME
notify-send "Theme changed to $NEW_THEME_NAME" -t 2000

View File

@ -3,14 +3,14 @@
# 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
THEMES_DIR="$HOME/.config/omarchy/themes/"
CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme"
THEME_NAME="$1"
THEME_PATH="$THEMES_DIR/$THEME_NAME"
BACKGROUND_PATH="$HOME/.config/omarchy/backgrounds/$THEME_NAME"
@ -39,9 +39,5 @@ 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
fi