-
-
Notifications
You must be signed in to change notification settings - Fork 647
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
Detection of menubar visibility (and/or) dimensions do not work on Apple Silicon M1 (arm64) #793
Comments
Looks like
This is the code used: int g_connection = SLSMainConnectionID();
printf("SLSMainConnectionID: %d\n", g_connection);
int status = 0;
SLSGetMenuBarAutohideEnabled(g_connection, &status);
printf("SLSGetMenuBarAutohideEnabled: %d\n", status);
int activeSpace = SLSGetActiveSpace(g_connection);
printf("SLSGetActiveSpace: %d\n", activeSpace);
activeSpace = SLSManagedDisplayGetCurrentSpace(g_connection, CFUUIDCreateString(NULL, CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID())));
printf("SLSManagedDisplayGetCurrentSpace: %d\n", activeSpace);
CGRect bounds = {};
SLSGetRevealedMenuBarBounds(&bounds, g_connection, activeSpace);
NSLog(@"SLSGetRevealedMenuBarBounds: %@\n", CGRectCreateDictionaryRepresentation(bounds)); |
What if you compile for x64 and run through Rosetta?
…Sent from my iPhone
On 24 Jan 2021, at 15:23, Alin Panaitiu <[email protected]> wrote:
Looks like SLSGetRevealedMenuBarBounds doesn't populate the CGRect anymore:
SLSMainConnectionID: 859503
SLSGetMenuBarAutohideEnabled: 0
SLSGetActiveSpace: 7
SLSManagedDisplayGetCurrentSpace: 7
2021-01-24 16:00:44.590 test[71825:1662024] SLSGetRevealedMenuBarBounds: {
Height = 0;
Width = 0;
X = 0;
Y = 0;
}
This is the code used:
int g_connection = SLSMainConnectionID();
printf("SLSMainConnectionID: %d\n", g_connection);
int status = 0;
SLSGetMenuBarAutohideEnabled(g_connection, &status);
printf("SLSGetMenuBarAutohideEnabled: %d\n", status);
int activeSpace = SLSGetActiveSpace(g_connection);
printf("SLSGetActiveSpace: %d\n", activeSpace);
activeSpace = SLSManagedDisplayGetCurrentSpace(g_connection, CFUUIDCreateString(NULL, CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID())));
printf("SLSManagedDisplayGetCurrentSpace: %d\n", activeSpace);
CGRect bounds = {};
SLSGetRevealedMenuBarBounds(&bounds, g_connection, activeSpace);
NSLog(@"SLSGetRevealedMenuBarBounds: %@\n", CGRectCreateDictionaryRepresentation(bounds));
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#793 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABPDZV6O2QQEKEZXOGJDZZTS3QUOZANCNFSM4WCP7CBQ>.
|
Interesting, that seems to work fine: ❯ file test.x64
test.x64: Mach-O 64-bit executable x86_64
❯ ./test.x64
SLSMainConnectionID: 483075
SLSGetMenuBarAutohideEnabled: 0
SLSGetActiveSpace: 7
SLSManagedDisplayGetCurrentSpace: 5
2021-01-24 18:55:57.380 test.x64[88089:2187176] SLSGetRevealedMenuBarBounds: {
Height = 24;
Width = 1680;
X = 0;
Y = 0;
}
❯ ./test
SLSMainConnectionID: 483283
SLSGetMenuBarAutohideEnabled: 0
SLSGetActiveSpace: 7
SLSManagedDisplayGetCurrentSpace: 5
2021-01-24 18:56:10.114 test[88209:2188451] SLSGetRevealedMenuBarBounds: {
Height = 0;
Width = 0;
X = 0;
Y = 0;
} |
Looks like a bug in SkyLight. Until Apple fixes this, we can work around it using:
|
This may break with the new MacBook Pro's, as their menu bar seems to be quite a bit taller. |
This is guaranteed to break on the new MacBook Pro's, as we need to deal with the Notch in some way or another. Hopefully there is some API that we can use here. |
Well this is just great; the height of the menubar changes based on the selected resolution this time around, so I guess we have to dig for a new kind of API. In default resolution the lowest y-coordinate usable on a display with notch is 38, where as with the 14" maximum scaled resolution it changes to 44. |
Fixed on master using the same technique as to detect that a notch is present. For non-notch Apple Silicon MacBooks we just assume that the menubar height is 24em as I have no way to experiment with such a build. |
Note to self. The following function is able to properly grab the display height on both x86_64 and arm64 running Monterey: |
The code responsible for this works fine on macOS Big Sur running on intel architecture.
Responsible functions:
check if menubar is visible:
https://github.com/koekeishiya/yabai/blob/master/src/display_manager.c#L200
retrieve dimensions of menubar:
https://github.com/koekeishiya/yabai/blob/master/src/display_manager.c#L207
Help welcome if someone with an M1 wants to debug the result of these functions to see what they output.
The text was updated successfully, but these errors were encountered: