A hidden bar on display=main reappears when a property recreates it

Author: pszypowiczCreated Sep 23, 2026Updated Sep 23, 2026

What happens

With display=main, a bar hidden through hidden=on comes back on screen when a property change recreates it. --query bar still reports "hidden": "on".

Several properties recreate the bars through bar_manager_reset, for example topmost and shadow. bar_manager_reset calls bar_manager_begin, and bar_create starts every bar with hidden = false. The display list branch of bar_manager_begin then restores the hidden state:

c
if (bar_manager->any_bar_hidden)
  bar_set_hidden(bar_manager->bars[bar_index], true);

The DISPLAY_MAIN_PATTERN branch creates its single bar without that step, so the bar loses its hidden state.

Repro

  1. Run with display=main.
  2. Run sketchybar --bar hidden=on. The bar hides.
  3. Run sketchybar --bar shadow=on.

The bar is visible again, and sketchybar --query bar still says "hidden": "on".

What I measured

Current master (5f358ec) on macOS 27.0 (26A428), one display, on a normal space. Y = -9999 is the off-screen position that bar_resize uses for a hidden bar:

display=main   after hidden=on    Y=-9999  hidden
display=main   after shadow=on    Y=0      visible    query "hidden": "on"
display=main   after hidden=on    Y=-9999  hidden
display=main   after topmost=on   Y=0      visible    query "hidden": "on"

display=all    after hidden=on    Y=-9999  hidden
display=all    after shadow=on    Y=-9999  hidden     query "hidden": "on"
display=all    after hidden=on    Y=-9999  hidden
display=all    after topmost=on   Y=-9999  hidden     query "hidden": "on"

Same master commit on macOS 26.7 (25G229), built-in plus an external display, normal spaces, with shadow=on as the trigger:

display=main   after shadow=on    built-in Y=29       visible    query "hidden": "on"
display=all    after shadow=on    both displays Y=-9999  hidden  query "hidden": "on"

Y=29 is the position below the menu bar, because the menu bar is visible on that machine and topmost is off.

Suggestion

Restore the hidden state in the DISPLAY_MAIN_PATTERN branch the same way the display list branch does.

I opened #857 with this change.