FelixKratz / SketchyBar

A highly customizable macOS status bar replacement
https://felixkratz.github.io/SketchyBar/
GNU General Public License v3.0
6.25k stars 94 forks source link

Spaces don't render on the correct display when using 3 monitors #607

Open bavo opened 2 months ago

bavo commented 2 months ago

I started using sketchybar with aerospace recently but i noticed the spaces on the bar don't show on the correct display when using 3 screens. The builtin mac screen + 2 external monitors

The workspace from the left display are shown on the center display. The workspaces from the center display are shown on the right display. And the workspaces from the right display are shown on the left.

When removing either one of the 3 screens the bar behaves correctly!

Minimal config to reproduce:

sketchybarrc

#!/usr/bin/env bash

ITEM_DIR="$CONFIG_DIR/items"

############## BAR ##############
sketchybar --bar height=42 \
                 y_offset=5 \
                 blur_radius=0 \
                 position=top \
                 padding_left=4 \
                 padding_right=2 \
                 margin=10 \
                 corner_radius=12 \
                 color=0xff1e1d2e \
                 shadow=on

############## GLOBAL DEFAULTS ##############
sketchybar --default updates=when_shown \
                     icon.font="Hack Nerd Font:Bold:16.0" \
                     icon.color=0xffECEFF4 \
                     icon.highlight_color=0xffE48FA8 \
                     label.font="Hack Nerd Font:Bold:16.0" \
                     label.color=$WHITE \
                     background.corner_radius=5 \
                     background.height=30

source "$ITEM_DIR/spaces.sh"
sketchybar --update
echo "sketchybar configuration loaded..."

items/spaces.sh

#!/usr/bin/env bash
sketchybar --add event aerospace_workspace_change

for m in $(aerospace list-monitors | awk '{print $1}')
do
    for i in $(aerospace list-workspaces --monitor $m)
    do
        sid=$i
        sketchybar --add space space.$sid left \
            --subscribe space.$sid aerospace_workspace_change \
            --set space.$sid space="$sid" \
            icon=$sid \
            icon.highlight_color=$RED \
            icon.padding_left=10 \
            icon.padding_right=10 \
            display=$m \
            padding_left=2 \
            padding_right=2 \
            label.padding_right=20 \
            label.color=$WHITE \
            label.highlight_color=$WHITE \
            label.font="sketchybar-app-font:Regular:16.0" \
            label.y_offset=-1 \
            background.color=$GREY \
            background.drawing=on \
            click_script="aerospace workspace $sid"
    done
done
bavo commented 2 months ago

Looks like it's cause by the display arrangement force by Aerospace: https://nikitabobko.github.io/AeroSpace/guide#proper-monitor-arrangement

This works correctly: image

This does not work: image

update: Looks like it is also dependent on which monitor is the main monitor 🤔