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
|
|
|
|
2025-07-11 08:57:55 -07: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
|
2025-07-11 08:57:55 -07:00
|
|
|
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
|
2025-07-11 08:57:55 -07:00
|
|
|
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
|
2025-07-11 08:57:55 -07:00
|
|
|
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-14 21:36:15 -07:00
|
|
|
omarchy-theme-set $NEW_THEME_NAME
|
2025-06-22 20:48:38 -04:00
|
|
|
notify-send "Theme changed to $NEW_THEME_NAME" -t 2000
|