Skip to content

Flashing/Highlighting Issue with Workspace Switching (sketchybar + aerospace) #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LukasSefcik opened this issue May 12, 2025 · 1 comment

Comments

@LukasSefcik
Copy link

I am using sketchybar with the aerospace window manager. I have a sketchybar item configured to display the current workspace. When switching workspaces (e.g., using aerospace's keybindings), I observe a flickering or multiple highlight/unhighlight cycles on both the newly active and the previously active workspace items in sketchybar.

This behavior is not consistent and sometimes results in the wrong workspace being momentarily highlighted or a visual "blink" effect on the workspace items.

Expected Behavior:

When switching workspaces, only the newly active workspace item in sketchybar should be highlighted, and the previously active workspace item should be unhighlighted, with a single, clean transition.

Environment:

  • sketchybar version: sketchybar-v2.22.1
  • aerospace version: v0.18.5-Beta
  • macOS version: 15.4.1

My spaces.sh:

#!/bin/bash

sketchybar --add event aerospace_workspace_change

for sid in $(aerospace list-workspaces --all); do
    sketchybar --add item space.$sid left \
               --subscribe space.$sid aerospace_workspace_change \
               --set space.$sid \
                     icon=$sid \
                     icon.font="SF Pro:Regular:14.0" \
                     background.border_color=0xffffa500 \
                     background.border_width=1 \
                     background.color=0x44ffffff \
                     background.corner_radius=5 \
                     background.height=22 \
                     background.drawing=off \
                     label.font="sketchybar-app-font:Regular:13.0" \
                     click_script="aerospace workspace $sid" \
                     script="$PLUGIN_DIR/space_windows.sh $sid"
done

My space_windows.sh:

#!/bin/bash

space_number=$1

windows=$(aerospace list-windows --workspace "$space_number")

icon_strip=""
label_padding_right=4

if [ -n "$windows" ]; then
    while read -r window; do
        app=$(echo "$window" | cut -d'|' -f2 | xargs)
        if [ -n "$app" ]; then
            icon="$($CONFIG_DIR/plugins/icon_map_fn.sh "$app")"
            icon_strip+=" $icon"
        fi
    done <<< "$windows"
else
    icon_strip=""
    label_padding_right=0
fi

if [ -z "$FOCUSED_WORKSPACE" ]; then
    FOCUSED_WORKSPACE=$(aerospace list-workspaces --focused)
fi

if [ "$space_number" = "$FOCUSED_WORKSPACE" ]; then
    sketchybar --set "$NAME" background.drawing=off \
                             icon.color=0xffffffff \
                             label.color=0xffffffff \
                             label="$icon_strip" \
                             label.padding_left=0 \
                             label.padding_right=$label_padding_right
else
    sketchybar --set "$NAME" background.drawing=off \
                             icon.color=0x70ffffff \
                             label.color=0x50ffffff \
                             label="$icon_strip" \
                             label.padding_left=0 \
                             label.padding_right=$label_padding_right
fi
Screen.Recording.2025-05-12.at.16.43.37.mov
@chieffancypants
Copy link

I have the same issue, though I'm thinking it's related to aerospace. If you pull sketchybar out of the equation completely and just log the exec-on-workspace-change callback, you'll see that it's called just once when switching between working spaces, but doing so between the glitchy spaces it will be called twice causing the flicker.

In my case it seems to be fairly consistently broken when switching between a spaces with Arc Browser, and Ghostty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants