diff --git a/src/macos.m b/src/macos.m

index b000fed9..975ba928 100644

--- a/src/macos.m

+++ b/src/macos.m

@@ -38,6 +38,16 @@ enum iTouchBarVariant {

 default_TouchBarVariant,

};



+static NSString *currentSystemAppearance_(void) {

+ /* This API does not exist on 10.13. */

+ @try {

+ return [[NSApp effectiveAppearance] name];

+ }

+ @catch (NSException *) {

+ return @"NSAppearanceNameAqua";

+ }

+}

+

/----------------------------------------------------------------------------------------------/



@interface CommandButton : NSCustomTouchBarItem {

@@ -447,7 +457,11 @@ void setupApplication_MacOS(void) {

 NSApplication *app = [NSApplication sharedApplication];

 /* Our delegate will override SDL's delegate. */

 MyDelegate *myDel = [[MyDelegate alloc] initWithSDLDelegate:app.delegate];

- [myDel setAppearance:[[app effectiveAppearance] name]];

+ [myDel setAppearance:currentSystemAppearance_()];

+ [app addObserver:myDel

+ forKeyPath:@"effectiveAppearance"

+ options:0

+ context:myDel];

 app.delegate = myDel;

 NSMenu *appMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu];

 NSMenuItem *prefsItem = [appMenu itemWithTitle:@"Preferences…"];

@@ -463,10 +477,6 @@ void setupApplication_MacOS(void) {

void insertMenuItems_MacOS(const char *menuLabel, int atIndex, const iMenuItem *items, size_t count) {

 NSApplication *app = [NSApplication sharedApplication];

 MyDelegate *myDel = (MyDelegate *) app.delegate;

- [app addObserver:myDel

- forKeyPath:@"effectiveAppearance"

- options:0

- context:myDel];

 NSMenu *appMenu = [app mainMenu];

 NSMenuItem *mainItem = [appMenu insertItemWithTitle:[NSString stringWithUTF8String:menuLabel]

                                              action:nil

@@ -525,7 +535,7 @@ void insertMenuItems_MacOS(const char *menuLabel, int atIndex, const iMenuItem *

void handleCommand_MacOS(const char *cmd) {

 if (equal_Command(cmd, "prefs.ostheme.changed")) {

     if (arg_Command(cmd)) {

- appearanceChanged_MacOS_([[NSApp effectiveAppearance] name]);

+ appearanceChanged_MacOS_(currentSystemAppearance_());

     }

 }

#if 0

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.9/pcdiff/73d9c1d6f0dee5b391ec0484d62638c087f2adf7
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
60.865734 milliseconds
Gemini-to-HTML Time
1.226089 milliseconds

This content has been proxied by September (3851b).