tmandry/Swindler

Don't receive ScreenLayoutChangedEvent events

choco opened this issue · 1 comments

choco commented

Maybe I'm doing something wrong, but I don't receive ScreenLayoutChangedEvent events.

swindler.on { (event: ScreenLayoutChangedEvent) in
                print("screen changed") 
}

With the above if I change some parameter, for example the resolution, nothing is printed.

If I register manually (which is the same way Swindler does)

NotificationCenter.default.addObserver(forName: NSApplication.didChangeScreenParametersNotification,
                                               object: NSApplication.shared,
                                               queue: OperationQueue.main) {
                                                notification -> Void in
                                                print("screen parameters changed")}

it works.

Oh, and the example app in the project still uses the old API.

Thanks for reporting! Looks like the wrong NotificationCenter was being used. Fix coming up in #44.

I wish I could come up with a way to do integration testing on this stuff..