mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-15 00:34:08 +09:00
feat: improved popup toggling when clicking the same module widgets. When modules have a few widgets enabled and opened popup view, clicking on another widget the popup disappear. Now click will reopen popup view on the target widget, not close the view.
This commit is contained in:
@@ -282,7 +282,13 @@ open class Module: Module_p {
|
||||
let openedWindows = NSApplication.shared.windows.filter{ $0 is NSPanel }
|
||||
openedWindows.forEach{ $0.setIsVisible(false) }
|
||||
|
||||
if popup.occlusionState.rawValue == 8192 {
|
||||
var reopen: Bool = false
|
||||
if let widget = notification.userInfo?["widget"] as? widget_t {
|
||||
reopen = popup.openedBy != nil && popup.openedBy != widget
|
||||
popup.openedBy = widget
|
||||
}
|
||||
|
||||
if popup.occlusionState.rawValue == 8192 || reopen {
|
||||
NSApplication.shared.activate(ignoringOtherApps: true)
|
||||
|
||||
popup.contentView?.invalidateIntrinsicContentSize()
|
||||
@@ -300,6 +306,7 @@ open class Module: Module_p {
|
||||
popup.setIsVisible(true)
|
||||
} else {
|
||||
popup.locked = false
|
||||
popup.openedBy = nil
|
||||
popup.setIsVisible(false)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user