FelixKratz / dotfiles

My personal macOS configuration
GNU General Public License v3.0
929 stars 92 forks source link

fix extra space in yabai plugin #27

Closed samchugit closed 1 year ago

samchugit commented 1 year ago

The original dotfile of sketchybar will create extra space even if there is no window in a space. Like this:

image

I believe this is a bug, since no window means no need rendering the label. I fixed this bug, and now the bar looks like this:

image

I think it's much better. But if this is meant to be designed in the original way, just ignore my pull request.

Much appreciate for the great job!

FelixKratz commented 1 year ago

Hey, thanks for the PR!

At this point I have gotten used to the "extra" space so much that I think I will keep it.

I have noticed an edge case not handled by your PR, when a space had an app on it and you close the last window, it will not update the icons properly. You could instead use this code:

      if [ "$apps" != "" ]; then
        while IFS= read -r app; do
          icon_strip+=" $($CONFIG_DIR/plugins/icon_map.sh "$app")"
        done <<< "$apps"
        args+=(--set space.$space label="$icon_strip" label.drawing=on)
      else
        args+=(--set space.$space label.drawing=off)
      fi
samchugit commented 1 year ago

Thanks for the rapid reply! I respect your choice, and I'll close this PR.

Appreciation for addressing the edge case that I didn't considered. This may help the other guy who wants to eliminate the extra space.