From b74a4c6ff6fae5e6ecb8e08e57b10e33df76adff Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 9 Aug 2026 08:38:12 -0400 Subject: [PATCH] alt-tab-macos: fix compatibility building with the 26.x SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s not clear how upstream is able to build this using an upstream toolchain, but the header for this API in our SDK has marked it obsolete. This causes the build to fail even though it won’t be used on our default deployment target. Fortunately, that means the offending static method can just be deleted. --- .../0005-avoid-using-obsolete-api.patch | 53 +++++++++++++++++++ pkgs/by-name/al/alt-tab-macos/package.nix | 2 + 2 files changed, 55 insertions(+) create mode 100644 pkgs/by-name/al/alt-tab-macos/0005-avoid-using-obsolete-api.patch diff --git a/pkgs/by-name/al/alt-tab-macos/0005-avoid-using-obsolete-api.patch b/pkgs/by-name/al/alt-tab-macos/0005-avoid-using-obsolete-api.patch new file mode 100644 index 000000000000..e4658dd7bf27 --- /dev/null +++ b/pkgs/by-name/al/alt-tab-macos/0005-avoid-using-obsolete-api.patch @@ -0,0 +1,53 @@ +diff --git a/src/macos/SystemPermissions.swift b/src/macos/SystemPermissions.swift +index 4a98ef9461..ae983eb73a 100644 +--- a/src/macos/SystemPermissions.swift ++++ b/src/macos/SystemPermissions.swift +@@ -158,24 +158,7 @@ + // their return value is not updated during the app lifetime + // note: shows the system prompt if there's no permission + private static func isGrantedOnSomeDisplay() -> Bool { +- if #available(macOS 12.3, *) { +- return checkWithSCShareableContent() +- } else { +- let mainDisplayID = CGMainDisplayID() +- if checkWithCGDisplayStream(mainDisplayID) { +- return true +- } +- // maybe the main screen can't produce a CGDisplayStream, but another screen can +- // a positive on any screen must mean that the permission is granted; we try on the other screens +- for screen in NSScreen.screens { +- if let id = screen.number(), id != mainDisplayID { +- if checkWithCGDisplayStream(id) { +- return true +- } +- } +- } +- return false +- } ++ return checkWithSCShareableContent() + } + + @available(macOS 12.3, *) +@@ -193,22 +176,6 @@ + } + } + +- private static func checkWithCGDisplayStream(_ id: CGDirectDisplayID) -> Bool { +- return runWithTimeout { completion in +- // this initializer can actually block for a while +- // it's undocumented but has been proven by spindumps shared by AltTab users +- let displayStream = CGDisplayStream( +- dispatchQueueDisplay: id, +- outputWidth: 1, +- outputHeight: 1, +- pixelFormat: Int32(kCVPixelFormatType_32BGRA), +- properties: nil, +- queue: .global() +- ) { _, _, _, _ in } +- completion(displayStream != nil) +- } +- } +- + private static func runWithTimeout(_ block: @escaping (@escaping (Bool) -> Void) -> Void) -> Bool { + let semaphore = DispatchSemaphore(value: 0) + var result = false diff --git a/pkgs/by-name/al/alt-tab-macos/package.nix b/pkgs/by-name/al/alt-tab-macos/package.nix index a5c70709aaac..6309dc6675d0 100644 --- a/pkgs/by-name/al/alt-tab-macos/package.nix +++ b/pkgs/by-name/al/alt-tab-macos/package.nix @@ -288,6 +288,8 @@ stdenv.mkDerivation (finalAttrs: { ./0003-use-runtime-dispatch-for-Liquid-Glass-with-SDK-14.patch # Don't offer preferences for services disabled by the source-only stubs. ./0004-hide-settings-for-disabled-services.patch + # Avoids error about `CGDisplayStream` initializer being unavailable on macOS when using the 26.x SDK. + ./0005-avoid-using-obsolete-api.patch ]; # Remove trailing comma incompatible with Swift 5.10