From 2fa5c52963f7c6e10172d839dffad2e543e1084c Mon Sep 17 00:00:00 2001 From: Nicholai Date: Mon, 24 Nov 2025 04:18:45 -0700 Subject: [PATCH] Fix critical bug in switcher scripts array building 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. --- config | 2 +- scripts/switch-layout.sh | 4 ++-- scripts/switch-style.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config b/config index 4ad445d..e1ad835 120000 --- a/config +++ b/config @@ -1 +1 @@ -configs/[TOP] Custom Minimal \ No newline at end of file +/home/nicholai/.config/waybar/configs/[TOP] Custom Minimal \ No newline at end of file diff --git a/scripts/switch-layout.sh b/scripts/switch-layout.sh index 22cdfbf..97b5cfd 100755 --- a/scripts/switch-layout.sh +++ b/scripts/switch-layout.sh @@ -4,8 +4,8 @@ waybar_layouts="$HOME/.config/waybar/configs" waybar_config="$HOME/.config/waybar/config" -# Get all available layouts -layouts=($(ls "$waybar_layouts" | sort)) +# Get all available layouts (using mapfile to preserve filenames with spaces) +mapfile -t layouts < <(ls "$waybar_layouts" | sort) # If wofi is available, use it for selection if command -v wofi &> /dev/null; then diff --git a/scripts/switch-style.sh b/scripts/switch-style.sh index a9c3640..0cae66d 100755 --- a/scripts/switch-style.sh +++ b/scripts/switch-style.sh @@ -4,8 +4,8 @@ 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)) +# 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