From 8fbef6ea541d2df751a1e46111c8b762a197eec4 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 7 Aug 2026 03:18:03 +0000 Subject: [PATCH 36/38] wallpaper (Apple): restrict Sonoma wallpaper-store lookup to macOS > 13 Also replaces subscripting literals with objectAtIndex:/valueForKey:. Ported from https://github.com/macos-powerpc/powerpc-ports/blob/main/sysutils/fastfetch/files/0012-Misc-fixes-for-legacy-systems.patch --- src/detection/wallpaper/wallpaper_apple.m | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/detection/wallpaper/wallpaper_apple.m b/src/detection/wallpaper/wallpaper_apple.m index f4ba8a682..1a60a89ee 100644 --- a/src/detection/wallpaper/wallpaper_apple.m +++ b/src/detection/wallpaper/wallpaper_apple.m @@ -2,11 +2,14 @@ #include "common/settings.h" #include "common/apple/osascript.h" -#import -#import +#include +#include +#include const char* ffDetectWallpaper(FFstrbuf* result) { + #if MAC_OS_X_VERSION_MIN_REQUIRED > 130000 + { // Reliable for user-picked static images. NSURL* url = [NSWorkspace.sharedWorkspace desktopImageURLForScreen:NSScreen.mainScreen]; @@ -29,16 +32,16 @@ NSArray* choices = [dict valueForKeyPath:@"SystemDefault.Desktop.Content.Choices"]; if (choices.count > 0) { - NSDictionary* choice = choices[0]; - NSArray* files = choice[@"Files"]; + NSDictionary* choice = [choices objectAtIndex:0]; + NSArray* files = [choice valueForKey:@"Files"]; if (files.count > 0) { - NSString* file = files[0][@"relative"]; + NSString* file = [[files objectAtIndex: 0] valueForKey: @"relative"]; ffStrbufAppendS(result, [NSURL URLWithString:file].path.UTF8String); } else { - NSString* provider = choice[@"Provider"]; + NSString* provider = [choice valueForKey:@"Provider"]; NSString* builtinPrefix = @"com.apple.wallpaper.choice."; if ([provider hasPrefix:builtinPrefix]) provider = [provider substringFromIndex:builtinPrefix.length]; @@ -55,6 +58,8 @@ } } + #endif + #ifdef FF_HAVE_SQLITE3 {