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

`popup.topmost=false` makes popups order below the bar #321

Closed chrisgrieser closed 1 year ago

chrisgrieser commented 1 year ago

I think this is a follow-up issue to #316. After upgrading to 2.14, popups now work correctly on the mac mini, however, popup.topmost=false seems to break the popups, ie.e. they do not show at all. It seems this issue only occurs on the mac mini with the said one external display.

FelixKratz commented 1 year ago

Can you provide the minimal config where you observe this? I will try to understand why, but I guess it will again be a bit of work to pin down what exactly it is that breaks popups on your system. I am wondering if this is happening on all mac mini/pros or if it has to do with the display. The fix for the previous issue shows that the WindowServer seems to not report a proper UUID for the monitor when it is the only connected display and should be the active one. So it is either the API that is behaving strange without a builtin display or the monitor breaks the API.

chrisgrieser commented 1 year ago

Ah, i figured it out. It's not related to displays this time, but rather a combination of popup.topmost=false combined with a negative value for popup.y_offset. I'll explain:

This is the base config:

sketchybar \
    --bar color=0xff333333 height=50 \
    --default popup.drawing=true popup.topmost=false popup.drawing=on \
    popup.y_offset=0 y_offset=15 \
    --add item foo left --set foo label="bar" \
    --add item baz popup.foo --set baz label="nek"

which results in this: Pasted image 2023-02-02 16 44 55

since I am trying to create an "second row", I want to move the popups up. Using the config above with popup.y_offset=-30 to achieve that results in this:

Pasted image 2023-02-02 16 47 28

which at first led me to believe that the popups are not working. However, after tons of trial and error, I figured out that what actually happens is that popup.topmost=false puts the popup under the menubar. This can be seen when using popup.y_offset=-10, where the popup is partially below the menubar:

Pasted image 2023-02-02 16 49 28


So this is pretty much the result of popup.topmost=false combined with a negative value for popup.y_offset, and should be fixable by making non-topmost-popups not occur below the menubar itself? While this occurs due to my attempt to create a "second bar", I think it's not purely an edge case since cut-off popups should also be visually glitchy for other people when using a low negative y-offset for popups. Also, I don't see any scenario where popups being below the menubar would be desirable in any way.

I am not totally sure whether this is a problem related to the mac mini or version 2.14, since at my iMac at home, I think I still have 2.13. I'll check when I'm home and report back.

FelixKratz commented 1 year ago

Ah ok, I see. I think the ordering of the menu bar and the popups is actually arbitrary since they share the same window level, but are not ordered relative to each other, so ordering kind of depends on execution order. The same problem will actually also occur if both the bar and the popups are set to be topmost. I will try to include the relative ordering in the popup logic, as I think you are correct that it is never expected to have a popup below the bar, except when popups are not topmost and the bar is topmost...

chrisgrieser commented 1 year ago

Can confirm, the issue also occurs on my iMac at home after updating to 2.14

FelixKratz commented 1 year ago

Should be fixed on master, it will be included in the next release. Till then you can install from head to get the fix for your setup.

chrisgrieser commented 1 year ago

thank you! can confirm that it works 🥳