Skip to content

Commit

Permalink
#793 workaround for broken Apple code
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Feb 14, 2021
1 parent c12a712 commit de898cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 18 additions & 0 deletions src/display_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit de898cd

Please sign in to comment.