arch-waybar/scripts/switch-style.sh

31 lines
846 B
Bash
Executable File

#!/bin/bash
# Quick waybar style/theme switcher
waybar_styles="$HOME/.config/waybar/style"
waybar_css="$HOME/.config/waybar/style.css"
# Get all available styles
styles=($(ls "$waybar_styles"/*.css 2>/dev/null | xargs -n1 basename | sort))
# If wofi is available, use it for selection
if command -v wofi &> /dev/null; then
choice=$(printf '%s\n' "${styles[@]}" | wofi --dmenu -i -p "Waybar Style")
else
# Otherwise use a simple CLI menu
echo "Available Waybar Styles:"
for i in "${!styles[@]}"; do
echo "$((i+1)). ${styles[$i]}"
done
read -p "Select style (1-${#styles[@]}): " selection
choice="${styles[$((selection-1))]}"
fi
if [[ -n "$choice" ]]; then
ln -sf "$waybar_styles/$choice" "$waybar_css"
echo "Switched to: $choice"
killall waybar
waybar &
else
echo "No selection made"
fi