FelixKratz / SketchyBar

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

Default menu items disappears from sketchybar #341

Closed lokxii closed 1 year ago

lokxii commented 1 year ago

Default menu items sometimes disappears from sketchybar. Although I notice it mostly after switching spaces, I believe its not the only time when the items disappears.

FelixKratz commented 1 year ago

I have noticed this too. It has something to do with the animations in macOS. When I disable those animations (with yabai) the aliases do not disappear anymore.

I think it could be that I have to check if the display is animating before capturing the surface of the default bar item.

FelixKratz commented 1 year ago

Hmm, so it seems that calling

extern void SLSCaptureWindowsContentsToRectWithOptions(uint32_t cid, uint64_t* wid, uint32_t count, CGRect bounds, uint32_t flags, CGImageRef* image);

during a system animation leaves the macOS bar windows in a state where their surfaces can not be captured again until another event updates them (e.g. another space change or revealing the macOS bar). This can be mitigated by choosing a higher alias.update_freq or by disabling the system animations.

lokxii commented 1 year ago

I've set alias.update_freq=1 and the items doesn't seem to disappear (or at least I haven't notice it). Sketchybar doesn't seem to use much resources because of this so I will just stick with this solution. Thank you for your response :)

FelixKratz commented 1 year ago

I think alias.update_freq=5 will reduce the probability of this happening on space change, while alias.update_freq=1 is default. I will have to look for a way to detect these animations…

FelixKratz commented 1 year ago

I think this commit should fix it: 2f01d41