Files
omarchy/bin/omarchy-theme-next

45 lines
1.1 KiB
Plaintext
Raw Normal View History

2025-06-18 21:17:59 +02:00
#!/bin/bash
THEMES_DIR="$HOME/.config/omarchy/themes/"
2025-06-18 21:56:22 +02:00
CURRENT_THEME_LINK="$HOME/.config/omarchy/current-theme"
2025-06-18 21:17:59 +02:00
THEMES=($(find "$THEMES_DIR" -mindepth 1 | sort))
TOTAL=${#THEMES[@]}
2025-06-18 21:56:22 +02:00
# Get current theme from symlink
if [[ -L "$CURRENT_THEME_LINK" ]]; then
CURRENT_THEME=$(readlink "$CURRENT_THEME_LINK")
2025-06-18 21:17:59 +02:00
else
2025-06-18 21:56:22 +02:00
# Default to first theme if no symlink exists
CURRENT_THEME=${THEMES[0]}
2025-06-18 21:17:59 +02:00
fi
2025-06-18 21:56:22 +02:00
# Find current theme index
INDEX=0
for i in "${!THEMES[@]}"; do
if [[ "${THEMES[$i]}" == "$CURRENT_THEME" ]]; then
INDEX=$i
break
fi
done
# Get next theme (wrap around)
NEXT_INDEX=$(((INDEX + 1) % TOTAL))
NEW_THEME=${THEMES[$NEXT_INDEX]}
2025-06-19 02:39:57 +02:00
NEW_THEME_NAME=$(basename "$NEW_THEME")
2025-06-18 21:56:22 +02:00
2025-06-18 21:17:59 +02:00
# Install theme backgrounds
source ~/.config/omarchy/current-theme/backgrounds.sh
2025-06-19 02:39:57 +02:00
ln -nsf ~/.config/omarchy/backgrounds/$NEW_THEME_NAME ~/.config/omarchy/current-backgrounds
2025-06-18 21:45:27 +02:00
# Set new theme
ln -nsf $NEW_THEME ~/.config/omarchy/current-theme
2025-06-18 21:45:27 +02:00
# Touch alacritty config to pickup the changed theme
touch ~/.config/alacritty/alacritty.toml
2025-06-18 21:17:59 +02:00
# Restart apps for new theme
2025-06-19 02:42:56 +02:00
pkill waybar
setsid waybar &
2025-06-18 21:17:59 +02:00
swaybg-next