Files
omarchy/bin/omarchy-theme-next

35 lines
876 B
Plaintext
Raw Normal View History

2025-06-18 21:17:59 +02:00
#!/bin/bash
THEMES_DIR="$HOME/.config/omarchy/themes/"
2025-06-19 08:10:36 -04:00
CURRENT_THEME_LINK="$HOME/.config/omarchy/current/theme"
2025-06-18 21:17:59 +02:00
THEMES=($(find "$THEMES_DIR" -mindepth 1 -maxdepth 1 | sort))
2025-06-18 21:17:59 +02:00
TOTAL=${#THEMES[@]}
2025-06-18 21:56:22 +02:00
# Get current theme from symlink
if [[ -L "$CURRENT_THEME_LINK" ]]; then
CURRENT_THEME=$(realpath "$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=$(realpath "${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
THEMES[$i]=$(realpath "${THEMES[$i]}")
2025-06-18 21:56:22 +02:00
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-07-17 16:56:13 -07:00
"$HOME/.local/share/omarchy/bin/omarchy-theme-set" $NEW_THEME_NAME
2025-06-22 20:48:38 -04:00
notify-send "Theme changed to $NEW_THEME_NAME" -t 2000