FelixKratz / SketchyBar

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

Notch Behavior #108

Closed FelixKratz closed 2 years ago

FelixKratz commented 2 years ago

Has anyone tried this on a new macbook with a notch yet? I would be interested to hear what happens if the menu bar is set to auto-hide -- is sketchybar drawn at the original menu bar location or below it? In another sense: Are the screen coordinates beginning below the notch if you auto-hide the menu bar, or on the top of the screen?

If the bar is drawn below the notch does it help to set a negative y_offset for the bar with ac376fffe332cea293db042bbc96ea0a2bc3bffe?

nyLiao commented 2 years ago

Hi I just got a MBP with notch and tried it. As I experienced, no matter the menu bar is auto-hide or not, the sketchybar is always drawn from the top of the screen (so if the menu bar exists, sketchybar is behind it instead of under it). Also I notice that setting y_offset does not change the position, whether the value is positive or negative. I am not quite sure is the difference caused by notch or Monterery?

OS: macOS Monterey 12.0.1 sketchybar: v2.2.2

FelixKratz commented 2 years ago

That is very interesting, thanks for reporting. I think the menu bar height is not reported anymore with the notch, instead it is an inset area. What happens if you set: sketchybar -m --bar topmost=on is the bar on top of the default bar then?

nyLiao commented 2 years ago

What happens if you set: sketchybar -m --bar topmost=on is the bar on top of the default bar then?

Yes, topmost works.

And today my y_offset works again. I found:

  1. The y_offset setting is not so stable. The WindowServer process sometimes crashes. Maybe the whole OS is not stable yet 🤔
  2. If I launch the sketchybar when the default bar is on, it will flash several times under the default bar (looks like its position on the Mac without a notch) before locating to its current position.

I do agree that the areas on both sides of the notch are special. For example, most application windows cannot be placed into these areas or they will be popped out, even when the default bar is hidden and there is nothing in them.

FelixKratz commented 2 years ago

The unstable y_offset behavior seems a bit strange, since in the code it is just an offset for the window origin. Maybe Monterey does not want this window in the notch area and tries to pop it out, but can't because the window is immoveable. All of this sounds to me as if it where an "apple problem" but if someone with a notch likes to play around with the code and experiment a bit I would start in bar.c where the window is created. I am pretty sure that in the future all of these problems can be sorted out. If I get my hands on a notched MBP at some point in time I will definitely experiment with it till it is stable.

nyLiao commented 2 years ago

That sounds reasonable. Maybe I will try playing around with the code some day to see if I can find out something. And thanks for the great software!

typkrft commented 2 years ago

I'm using the latest stable release with notched macbook. I haven't noticed any problems with it per se.

I would like to mention though that. Sketchybar is a perfect notch hider. I can't even see the notch with the bar settings below. It would be great to see a sketchybar -m --notch hidden=yes config as a secondary bar that simply hides it. The notch is additional screen real estate not part of the 16in diagonal from my understanding. So covering it then using another bar as you normally would, would be like using sketchybar on a 16in screen without a notch. I'll add pictures tomorrow if I get a chance.

sketchybar -m --bar \
        position=top \
        height=39 \
        margin=0 \
        y_offset=0 \
        corner_radius=0 \
        border_width=0 \
        border_color="0xFF${CURRENT_LINE:1}" \
        blur_radius=0 \
        padding_left=0 \
        padding_right=0 \
        color="0xFF000000" \
        display=all \
        hidden=off \
        topmost=off \
        font_smoothing=off \
        shadow=off
FelixKratz commented 2 years ago

I am already playing with some features for the notch, e.g. on HEAD you can already place items anchored left/right of the notch and play with the width of the notch. While I could create a black "notch hide" area option for the built-in display I am not sure how it would be integrated with e.g. yabai, because I think currently you can only set the external_bar property in yabai globally and not on a per display basis, which would make the "bar gap" inconsitent between external monitors and the builtin display. I might tinker with that at some point though. Equivalently you could just black out this region in the wallpaper and put a y_offset on sketchybar such that it displays below the notch.