Closed jonathangarelick closed 7 months ago
https://github.com/ feedback-assistant /reports/issues/37#issuecomment-537366857
observer = NotificationCenter.default.addObserver(forName: NSWindow.didChangeOcclusionStateNotification, object: statusItem.button!.window, queue: nil) { _ in
// We don't want to report when you manually make it invisible.
guard self.statusItem.isVisible else {
return
}
print("Is status item force-hidden by the system:", self.statusItem.button!.window?.occlusionState.contains(.visible) == false)
}
get window of a swiftui view
https://stackoverflow.com/questions/63432700/how-to-access-nswindow-from-main-app-using-only-swiftui
Not sure if I'll need to use this. The window occlusion event is a bit flaky?
func isMenuBarExtraVisible() -> Bool {
let processNamesWithStatusItems = Set(
(CGWindowListCopyWindowInfo(.optionOnScreenOnly, kCGNullWindowID) as! [NSDictionary])
.filter { $0[kCGWindowLayer] as! Int == 25 }
.map { $0[kCGWindowOwnerName] as! String }
)
return processNamesWithStatusItems.contains("SoundSeer")
}
It probably is not a good idea to dynamically maximize. It would inevitably cause the song to flicker every time this happens.
One option is to make a menu option to reset song size.
make the dropdown menu double the prefix length
https://stackoverflow.com/questions/9139197/how-to-get-all-nsstatusitem-elements-of-nsstatusbar-in-osx?rq=3