WM (macOS): add WindowServer version detection

This commit is contained in:
李通洲
2025-01-02 10:37:27 +08:00
committed by Carter Li
parent c68d21e215
commit 89e4403cc8
2 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -922,7 +922,7 @@ elseif(APPLE)
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_apple.m
src/detection/wifi/wifi_apple.m
src/detection/wm/wm_apple.c
src/detection/wm/wm_apple.m
src/detection/de/de_nosupport.c
src/detection/wmtheme/wmtheme_apple.m
src/detection/camera/camera_apple.m
@@ -5,6 +5,7 @@
#include "util/stringUtils.h"
#include <ctype.h>
#import <Foundation/Foundation.h>
const char* ffDetectWMPlugin(FFstrbuf* pluginName)
{
@@ -39,7 +40,18 @@ const char* ffDetectWMPlugin(FFstrbuf* pluginName)
return NULL;
}
const char* ffDetectWMVersion(FF_MAYBE_UNUSED const FFstrbuf* wmName, FF_MAYBE_UNUSED FFstrbuf* result, FF_MAYBE_UNUSED FFWMOptions* options)
const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_MAYBE_UNUSED FFWMOptions* options)
{
return "Not supported on this platform";
if (!wmName)
return "No WM detected";
if (ffStrbufEqualS(wmName, "WindowServer"))
{
NSError* error;
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL:[NSURL URLWithString:@"file:///System/Library/CoreServices/WindowManager.app/Contents/version.plist"]
error:&error];
ffStrbufInitS(result, ((NSString*) dict[@"CFBundleVersion"]).UTF8String);
}
return NULL;
}