Skip to content

Commit

Permalink
Fix for CPU usage under Sonoma
Browse files Browse the repository at this point in the history
  • Loading branch information
glouel committed Jul 12, 2023
1 parent 24b0ab5 commit c47e930
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Aerial.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3241,15 +3241,15 @@
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3.2.7beta2;
CURRENT_PROJECT_VERSION = 3.2.7beta3;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3L54M5L5KK;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/Resources/Old stuff/Info.plist";
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.7beta2;
MARKETING_VERSION = 3.2.7beta3;
PRODUCT_BUNDLE_IDENTIFIER = com.johncoates.Aerial;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -3270,15 +3270,15 @@
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3.2.7beta2;
CURRENT_PROJECT_VERSION = 3.2.7beta3;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 3L54M5L5KK;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/Resources/Old stuff/Info.plist";
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.7beta2;
MARKETING_VERSION = 3.2.7beta3;
OTHER_CODE_SIGN_FLAGS = "--timestamp";
PRODUCT_BUNDLE_IDENTIFIER = com.johncoates.Aerial;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
37 changes: 29 additions & 8 deletions Aerial/Source/Views/AerialView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,10 @@ final class AerialView: ScreenSaverView, CAAnimationDelegate {
DistributedNotificationCenter.default.addObserver(self,
selector: #selector(AerialView.willStop(_:)),
name: Notification.Name("com.apple.screensaver.willstop"), object: nil)

DistributedNotificationCenter.default.addObserver(self,
selector: #selector(AerialView.screenIsUnlocked(_:)),
name: Notification.Name("com.apple.screenIsUnlocked"), object: nil)

Music.instance.setup()
}

Expand All @@ -550,15 +553,33 @@ final class AerialView: ScreenSaverView, CAAnimationDelegate {
}
}

@objc func willStop(_ aNotification: Notification) {
debugLog("🖼️ 📢📢📢 willStop")
if !Aerial.helper.underCompanion {
if let player = player {
player.pause()
@objc func screenIsUnlocked(_ aNotification: Notification) {
if #available(macOS 14.0, *) {
debugLog("🖼️ 📢📢📢 ☢️sonoma☢️ workaround screenIsUnlocked")
if !Aerial.helper.underCompanion {
if let player = player {
player.pause()
}
self.stopAnimation()
} else {
player?.play()
}
self.stopAnimation()
}
}

@objc func willStop(_ aNotification: Notification) {
if #available(macOS 14.0, *) {
debugLog("🖼️ 📢📢📢 🖼️ 📢📢📢 ☢️sonoma☢️ workaround IGNORING willStop")
} else {
player?.play()
debugLog("🖼️ 📢📢📢 willStop")
if !Aerial.helper.underCompanion {
if let player = player {
player.pause()
}
self.stopAnimation()
} else {
player?.play()
}
}
}

Expand Down

0 comments on commit c47e930

Please sign in to comment.