Skip to content

Commit

Permalink
#2331 #2324 fix spaces functionality for macOS Sequoia
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Jun 24, 2024
1 parent 4bd6f58 commit cbefe36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/osax/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SA_COMMON_H
#define SA_COMMON_H

#define OSAX_VERSION "2.1.13"
#define OSAX_VERSION "2.1.14"

#define OSAX_ATTRIB_DOCK_SPACES 0x01
#define OSAX_ATTRIB_DPPM 0x02
Expand Down
15 changes: 11 additions & 4 deletions src/osax/payload.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
static uint64_t move_space_fp;
static uint64_t set_front_window_fp;
static uint64_t animation_time_addr;
static bool macOSSequoia;

static pthread_t daemon_thread;
static int daemon_sockfd;
Expand Down Expand Up @@ -231,10 +232,11 @@ static bool verify_os_version(NSOperatingSystemVersion os_version)
} else if (os_version.majorVersion == 14) {
return true; // Sonoma 14.0
} else if (os_version.majorVersion == 15) {
macOSSequoia = true;
return true; // Sequoia 15.0
}

NSLog(@"[yabai-sa] spaces functionality is only supported on macOS Big Sur 11.0.0+, Monterey 12.0.0+, Ventura 13.0.0+, and Sonoma 14.0.0+");
NSLog(@"[yabai-sa] spaces functionality is only supported on macOS Big Sur 11.0.0+, Monterey 12.0.0+, Ventura 13.0.0+, Sonoma 14.0.0+, and Sequoia 15.0");
#elif __arm64__
if (os_version.majorVersion == 12) {
return true; // Monterey 12.0
Expand All @@ -243,10 +245,11 @@ static bool verify_os_version(NSOperatingSystemVersion os_version)
} else if (os_version.majorVersion == 14) {
return true; // Sonoma 14.0
} else if (os_version.majorVersion == 15) {
macOSSequoia = true;
return true; // Sequoia 15.0
}

NSLog(@"[yabai-sa] spaces functionality is only supported on macOS Monterey 12.0.0+, and Ventura 13.0.0+, and Sonoma 14.0.0+");
NSLog(@"[yabai-sa] spaces functionality is only supported on macOS Monterey 12.0.0+, and Ventura 13.0.0+, Sonoma 14.0.0+, and Sequoia 15.0");
#endif

return false;
Expand Down Expand Up @@ -540,7 +543,9 @@ static void do_space_create(char *message)

CFStringRef __block display_uuid = SLSCopyManagedDisplayForSpace(SLSMainConnectionID(), space_id);
dispatch_sync(dispatch_get_main_queue(), ^{
id new_space = [[objc_getClass("Dock.ManagedSpace") alloc] init];
id new_space = macOSSequoia
? [[objc_getClass("ManagedSpace") alloc] init]
: [[objc_getClass("Dock.ManagedSpace") alloc] init];
id display_space = display_space_for_display_uuid(display_uuid);
asm__call_add_space(new_space, display_space, add_space_fp);
CFRelease(display_uuid);
Expand All @@ -556,7 +561,9 @@ static void do_space_focus(char *message)

if (dest_space_id) {
CFStringRef dest_display = SLSCopyManagedDisplayForSpace(SLSMainConnectionID(), dest_space_id);
id source_space = ((id (*)(id, SEL, CFStringRef)) objc_msgSend)(dock_spaces, @selector(currentSpaceforDisplayUUID:), dest_display);
id source_space = macOSSequoia
? ((id (*)(id, SEL, CFStringRef)) objc_msgSend)(dock_spaces, @selector(currentSpaceForDisplayUUID:), dest_display)
: ((id (*)(id, SEL, CFStringRef)) objc_msgSend)(dock_spaces, @selector(currentSpaceforDisplayUUID:), dest_display);
uint64_t source_space_id = get_space_id(source_space);

if (source_space_id != dest_space_id) {
Expand Down

0 comments on commit cbefe36

Please sign in to comment.