Skip to content

Commit

Permalink
Mac installer: don't offer to set BOINC as screensaver when running u…
Browse files Browse the repository at this point in the history
…nder MacOS 14 Sonoma
  • Loading branch information
Charlie Fenton committed Oct 28, 2023
1 parent cc2168c commit eb02312
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions mac_installer/PostInstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1678,19 +1678,27 @@ OSErr UpdateAllVisibleUsers(long brandID, long oldBrandID)
}
}

if (! saverAlreadySetForAll) {
if (gCommandLineInstall) {
err = stat("/tmp/setboincsaver.txt", &sbuf);
if (err == noErr) {
puts("setboincsaver.txt file detected\n");
fflush(stdout);
unlink("/tmp/setboincsaver.txt");
setSaverForAllUsers = true;
}
} else {
setSaverForAllUsers = ShowMessage(true,
// As of MacOS 14.0, the legacyScreenSaver sandbox prevents using
// IOSurfaceLookupFromMachPort. I have filed bug report FB13300491
// with Apple and hope they will change this in a future MacOS.
// Also as of MacOS 14.0 Sonoma, we can't set the screensaver
//automatically. I have filed bug report FB13270885 about this.
// See a;so the comment at top of SetScreenSaverSelection().
if (compareOSVersionTo(14, 0) < 0) {
if (! saverAlreadySetForAll) {
if (gCommandLineInstall) {
err = stat("/tmp/setboincsaver.txt", &sbuf);
if (err == noErr) {
puts("setboincsaver.txt file detected\n");
fflush(stdout);
unlink("/tmp/setboincsaver.txt");
setSaverForAllUsers = true;
}
} else {
setSaverForAllUsers = ShowMessage(true,
(char *)_("Do you want to set %s as the screensaver for all %s users on this Mac?"),
brandName[brandID], brandName[brandID]);
}
}
}

Expand Down Expand Up @@ -2008,6 +2016,8 @@ OSErr UpdateAllVisibleUsers(long brandID, long oldBrandID)
}


// As of MacOS 14.0 Sonoma, this code no longer will detect the current screensaver,
// and will need to be rewritten. See the comment at top of SetScreenSaverSelection().
OSErr GetCurrentScreenSaverSelection(passwd *pw, char *moduleName, size_t maxLen) {
char buf[1024];
FILE *f;
Expand Down Expand Up @@ -2047,6 +2057,11 @@ OSErr GetCurrentScreenSaverSelection(passwd *pw, char *moduleName, size_t maxLen
}


// As of MacOS 14.0 Sonoma, we can't set the screensaver automatically.
// I have filed bug report FB13270885 about this. After this is fixed,
// probably need to put an AppleScript to do this in the launch agent
// we add for each user. See also:
// https://forum.iscreensaver.com/t/understanding-the-macos-sonoma-screensaver-plist/718
OSErr SetScreenSaverSelection(char *moduleName, char *modulePath, int type) {
OSErr err = noErr;
CFStringRef preferenceName = CFSTR("com.apple.screensaver");
Expand Down

0 comments on commit eb02312

Please sign in to comment.