mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 12:19:24 +00:00
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
THEMES_DIR="$HOME/.config/omarchy/themes/"
|
|
CURRENT_THEME_LINK="$HOME/.config/omarchy/current-theme"
|
|
|
|
THEMES=($(find "$THEMES_DIR" -mindepth 1 | sort))
|
|
TOTAL=${#THEMES[@]}
|
|
|
|
# Get current theme from symlink
|
|
if [[ -L "$CURRENT_THEME_LINK" ]]; then
|
|
CURRENT_THEME=$(readlink "$CURRENT_THEME_LINK")
|
|
else
|
|
# Default to first theme if no symlink exists
|
|
CURRENT_THEME=${THEMES[0]}
|
|
fi
|
|
|
|
# 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]}
|
|
NEW_THEME_NAME=$(basename "$NEW_THEME")
|
|
|
|
# Install theme backgrounds
|
|
source ~/.config/omarchy/current-theme/backgrounds.sh
|
|
ln -nsf ~/.config/omarchy/backgrounds/$NEW_THEME_NAME ~/.config/omarchy/current-backgrounds
|
|
|
|
# Set new theme
|
|
ln -nsf $NEW_THEME ~/.config/omarchy/current-theme
|
|
|
|
# Touch alacritty config to pickup the changed theme
|
|
touch ~/.config/alacritty/alacritty.toml
|
|
|
|
# Restart apps for new theme
|
|
pkill waybar
|
|
setsid waybar &
|
|
swaybg-next
|