#!/bin/sh # Theme switcher for Hyprland desktop # Usage: set-theme # set-theme --toggle # set-theme --current # Available themes: dupre, hudson THEME_DIR="$HOME/.config/themes" CURRENT_FILE="$HOME/.config/current-theme" # Get current theme get_current() { if [ -f "$CURRENT_FILE" ]; then cat "$CURRENT_FILE" else echo "hudson" # default fi } # List available themes list_themes() { for dir in "$THEME_DIR"/*/; do basename "$dir" done } # Apply a theme apply_theme() { theme="$1" if [ ! -d "$THEME_DIR/$theme" ]; then echo "Error: Theme '$theme' not found in $THEME_DIR" echo "Available themes: $(list_themes | tr '\n' ' ')" exit 1 fi echo "Applying theme: $theme" # Copy configs that don't support sourcing cp "$THEME_DIR/$theme/foot.ini" "$HOME/.config/foot/foot.ini" cp "$THEME_DIR/$theme/fuzzel.ini" "$HOME/.config/fuzzel/fuzzel.ini" cp "$THEME_DIR/$theme/waybar.css" "$HOME/.config/waybar/style.css" cp "$THEME_DIR/$theme/dunstrc" "$HOME/.config/dunst/dunstrc" cp "$THEME_DIR/$theme/hyprlock.conf" "$HOME/.config/hypr/hyprlock.conf" cp "$THEME_DIR/$theme/Xresources" "$HOME/.Xresources" # Apply Xresources (for X11 apps and Emacs) xrdb -merge "$HOME/.Xresources" 2>/dev/null # Apply Hyprland colors directly via hyprctl case "$theme" in dupre) # Window borders hyprctl keyword general:col.active_border "rgba(d7af5fff)" hyprctl keyword general:col.inactive_border "rgba(474544ff)" # hy3 tab bar (monocle mode) hyprctl keyword plugin:hy3:tabs:col.active "rgba(474544ff)" hyprctl keyword plugin:hy3:tabs:col.active.text "rgba(969385ff)" hyprctl keyword plugin:hy3:tabs:col.inactive "rgba(d0cbc0ff)" hyprctl keyword plugin:hy3:tabs:col.inactive.text "rgba(d0cbc0ff)" hyprctl keyword plugin:hy3:tabs:col.urgent "rgba(d47c59ff)" hyprctl keyword plugin:hy3:tabs:col.locked "rgba(8a9496ff)" ;; hudson) # Window borders hyprctl keyword general:col.active_border "rgba(daa520ff)" hyprctl keyword general:col.inactive_border "rgba(444444ff)" # hy3 tab bar (monocle mode) hyprctl keyword plugin:hy3:tabs:col.active "rgba(444444ff)" hyprctl keyword plugin:hy3:tabs:col.active.text "rgba(bbbbbbff)" hyprctl keyword plugin:hy3:tabs:col.inactive "rgba(c5c8c6ff)" hyprctl keyword plugin:hy3:tabs:col.inactive.text "rgba(c5c8c6ff)" hyprctl keyword plugin:hy3:tabs:col.urgent "rgba(cc6666ff)" hyprctl keyword plugin:hy3:tabs:col.locked "rgba(8abeb7ff)" ;; esac # Save current theme echo "$theme" > "$CURRENT_FILE" # Set default wallpaper swww img ~/pictures/wallpaper/trondheim-norway.jpg 2>/dev/null # Reload applications killall -SIGUSR2 waybar 2>/dev/null pkill dunst && dunst & # Notify user notify-send "Theme" "Switched to $theme" -t 2000 echo "Theme '$theme' applied. Open new terminals to see changes." } # Toggle between themes toggle_theme() { current=$(get_current) case "$current" in dupre) apply_theme "hudson" ;; hudson) apply_theme "dupre" ;; *) apply_theme "dupre" ;; esac } # Show picker with fuzzel pick_theme() { themes=$(list_themes) current=$(get_current) selected=$(echo "$themes" | fuzzel --dmenu --prompt "Theme (current: $current): ") if [ -n "$selected" ]; then apply_theme "$selected" fi } # Main case "$1" in --toggle|-t) toggle_theme ;; --current|-c) get_current ;; --list|-l) list_themes ;; --pick|-p) pick_theme ;; --help|-h) echo "Usage: set-theme " echo " set-theme --toggle Toggle between themes" echo " set-theme --current Show current theme" echo " set-theme --list List available themes" echo " set-theme --pick Pick theme with fuzzel" echo "" echo "Available themes: $(list_themes | tr '\n' ' ')" ;; "") pick_theme ;; *) apply_theme "$1" ;; esac