Skip to content

Commit

Permalink
Fix not being able to change settings
Browse files Browse the repository at this point in the history
and breaking animations on subsequent starts of
the screensaver
  • Loading branch information
rbeeger committed Oct 21, 2023
1 parent b252fb5 commit 2062212
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Epigraver/Main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ class Main: ScreenSaverView {
let timingFunction = CAMediaTimingFunction(
controlPoints: 0.25, .random(in: 0.2...1.0), 0.75, .random(in: 0.2...1.0))
selectedAnimator.setup(boxes: textDisplayBoxes, with: timingFunction)

if !isPreview {
// https://www.jwz.org/blog/2023/10/xscreensaver-6-08-out-now/
DistributedNotificationCenter.default.addObserver(
self,
selector: #selector(willStop),
name: Notification.Name("com.apple.screensaver.willstop"), object: nil
)
}
}

@objc func willStop() {
NSApplication.shared.terminate(self)
}

func resetAnimator(animator: Animator) {
Expand Down

0 comments on commit 2062212

Please # to comment.