FelixKratz / dotfiles

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

Update resets number of spaces. #23

Closed justinDeu closed 1 year ago

justinDeu commented 1 year ago

I have been trying to edit my config to have additional spaces, but sketchybar --update is called at the end of the file, the number of spaces displayed is reset to 4. Upon starting sketchybar, there will be 10 displayed prior to the update being made. I have verified the update is causing the issue by commenting it out at the end of my configuration and manually calling it.

Below is a minimal configuration that I am running based off the example provided in the repo (a copy & paste):

SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")

for i in "${!SPACE_ICONS[@]}"
do
  sid=$(($i+1))
  echo "Space Icon: ${sid}"
  sketchybar --add space space.$sid left                                 \
             --set space.$sid associated_space=$sid                      \
                              icon=${SPACE_ICONS[i]}                     \
                              background.color=0x44ffffff                \
                              background.corner_radius=5                 \
                              background.height=20                       \
                              background.drawing=off                     \
                              label.drawing=off                          \
                              click_script="yabai -m space --focus $sid"
done

sketchybar --update

Querying sketchybar, all 10 spaces appear in the list of items:

{                                    
        "position": "top",
        "topmost": "off",
        "sticky": "off",   
        "shadow": "off",   
        "font_smoothing": "off",
        "blur_radius": 0,
        "margin": 0,     
        "drawing": "off",
        "color": "0x44000000",
        "border_color": "0xffff0000",
        "border_width": 0,
        "height": 25,
        "corner_radius": 0,
        "padding_left": 20,
        "padding_right": 20,
        "y_offset": 0,
        "clip": 0.000000,
        "image": {
                "value": "(null)",
                "drawing": "off",
                "scale": 1.000000
        },
        "items": [
                 "space.1",
                 "space.2",
                 "space.3",
                 "space.4",
                 "space.5",
                 "space.6",
                 "space.7",
                 "space.8",
                 "space.9",
                 "space.10"
        ]
}

I am running the latest v2.15.1. I have tried with and without yabai which doesn't seem to make a difference. Yabai is unable to identify a space to switch to through key binds or terminal commands for any of the numbers not displayed. When querying yabai, only the 4 spaces appear. Both with and without yabai running, sketchybar reports there are 10 spaces.

Interestingly, when I have less 4 spaces, they are displayed properly. I have tried completely uninstalling but that made no difference.

FelixKratz commented 1 year ago

How many actual mission control spaces do you have? You can check with expose.

This is a feature, only spaces that are actually available and exist as proper mission control workspaces are displayed, the others are hidden automatically

justinDeu commented 1 year ago

That was exactly the issue, thank you so much! I have been trying to figure this out for days! It may be worth while mentioning that in the documentation somewhere. It could already be there, and I completely missed it.

Also, sorry for making this an issue under your dotfiles. I was switching back and forth thinking I was missing something. I thought I was under the sketchybar repo when I made the issue.