Skip to content

Commit

Permalink
Update the menu when displays change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnpn committed Apr 15, 2024
1 parent d4b0515 commit 9780acf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Azayaka/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, SCStreamDelegate, SCStreamOu
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
if let error = error { print("Notification authorization denied: \(error.localizedDescription)") }
}

NotificationCenter.default.addObserver( // update the content & menu when a display device has changed
forName: NSApplication.didChangeScreenParametersNotification,
object: NSApplication.shared,
queue: OperationQueue.main
) { [self] notification -> Void in
updateAvailableContent(buildMenu: true)
}
}

func updateAvailableContent(buildMenu: Bool) {
Expand Down

0 comments on commit 9780acf

Please sign in to comment.