Fixed broken array building that was splitting filenames with spaces/brackets: - Changed from: layouts=$(($command)) which splits on whitespace - Changed to: mapfile -t which preserves full filenames This fixes: - Wofi showing 69 broken fragments instead of 25 layouts - Wofi showing 83 broken fragments instead of 30 styles - Symlinks pointing to non-existent fragmented paths - Layouts not actually changing when selected Also repaired broken config symlink that pointed to non-existent /home/nicholai/.config/waybar/configs/BOT] back to working Custom Minimal layout.
33 lines
1021 B
Bash
Executable File
33 lines
1021 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 (using mapfile to preserve filenames with spaces)
|
|
mapfile -t styles < <(find "$waybar_styles" -maxdepth 1 -type f -name "*.css" -exec 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" --parse-search false)
|
|
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
|
|
# Use absolute path for the symlink target
|
|
ln -sf "$(realpath "$waybar_styles/$choice")" "$waybar_css"
|
|
echo "Switched to: $choice"
|
|
killall waybar
|
|
sleep 0.5
|
|
waybar &
|
|
else
|
|
echo "No selection made"
|
|
fi
|