diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d89c95f..bd4984e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] ### Changed +- Work around broken Apple code for retrieving menubar dimensions on Apple Silicon M1 [#793](https://github.com/koekeishiya/yabai/issues/793) - Rework query attributes and define dataformat as part of the API [#775](https://github.com/koekeishiya/yabai/issues/775) - Properly clear space.last-window and space.first-window query attributes when the last window is made floating [#786](https://github.com/koekeishiya/yabai/issues/786) - Reworked signal system; events are no longer coupled 1-1 with observed system events. diff --git a/src/display_manager.c b/src/display_manager.c index 8a7ec882..54bb589d 100644 --- a/src/display_manager.c +++ b/src/display_manager.c @@ -208,6 +208,24 @@ CGRect display_manager_menu_bar_rect(uint32_t did) { CGRect bounds = {}; SLSGetRevealedMenuBarBounds(&bounds, g_connection, display_space_id(did)); + +#ifdef __arm64__ + + // + //NOTE(koekeishiya): The above function is broken on Apple Silicon and always returns an empty rectangle, + // as of macOS 11.0.1, 11.1, 11.2 and 11.2.1.. The menubar height seems to be a constant of 24em always, + // regardless of the display being a 13" or 16", so we patch it here. The width of the menubar should be + // equal to the width of the display. + // + + if (bounds.size.width == 0 && bounds.size.height == 0) { + CGRect frame = display_bounds(did); + bounds.size.height = 24; + bounds.size.width = frame.size.width; + } + +#endif + return bounds; }