- Add home/wallpapers/default.nix with per-wallpaper scaling options - Add 5 new Metroid-themed wallpapers to the rotation - Update i3+sway and plasma-manager to use wallpaper module - Add scripts/rotate-wallpaper.sh to cycle through wallpapers - Add scripts/upgrade.sh to chain: flake update, doom, claude-code, wallpaper - Add flake apps: rotate-wallpaper, update-claude-code, upgrade - Fix claude-code update.sh to use REPO_ROOT for flake app compatibility Run `nix run .#upgrade` for full system update with wallpaper rotation.
42 lines
1.3 KiB
Bash
42 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Configuration
|
|
REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
|
WALLPAPER_FILE="$REPO_ROOT/home/wallpapers/default.nix"
|
|
|
|
echo -e "${GREEN}Rotating wallpaper...${NC}"
|
|
|
|
# Check if file exists
|
|
if [[ ! -f "$WALLPAPER_FILE" ]]; then
|
|
echo -e "${RED}Error: $WALLPAPER_FILE not found${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Get current index
|
|
CURRENT_INDEX=$(grep -oP 'currentIndex = \K\d+' "$WALLPAPER_FILE")
|
|
echo -e "Current index: ${YELLOW}$CURRENT_INDEX${NC}"
|
|
|
|
# Count wallpapers (count occurrences of "name = " in the wallpapers list)
|
|
WALLPAPER_COUNT=$(grep -c 'name = "' "$WALLPAPER_FILE")
|
|
echo -e "Total wallpapers: ${YELLOW}$WALLPAPER_COUNT${NC}"
|
|
|
|
# Calculate next index (wrap around)
|
|
NEXT_INDEX=$(( (CURRENT_INDEX + 1) % WALLPAPER_COUNT ))
|
|
echo -e "Next index: ${YELLOW}$NEXT_INDEX${NC}"
|
|
|
|
# Update the currentIndex
|
|
sed -i "s/currentIndex = $CURRENT_INDEX;/currentIndex = $NEXT_INDEX;/" "$WALLPAPER_FILE"
|
|
|
|
echo -e "${GREEN}Successfully rotated wallpaper!${NC}"
|
|
echo -e " Old index: ${YELLOW}$CURRENT_INDEX${NC}"
|
|
echo -e " New index: ${YELLOW}$NEXT_INDEX${NC}"
|
|
echo ""
|
|
echo "Rebuild your system to apply the new wallpaper."
|