fix: fixed popup open registration when module is enabled after the app has been running (#2540)

This commit is contained in:
Serhiy Mytrovtsiy
2025-08-30 22:28:08 +02:00
parent 053f265bdb
commit 16efe9dda8
2 changed files with 28 additions and 14 deletions

View File

@@ -232,9 +232,7 @@ public class SWidget {
public var item: widget_p
public var isActive: Bool {
get {
self.list.contains{ $0 == self.type }
}
get { self.list.contains{ $0 == self.type } }
set {
if newValue {
self.list.append(self.type)
@@ -251,12 +249,8 @@ public class SWidget {
NextLog.shared.copy(category: self.module)
}
public var position: Int {
get {
Store.shared.int(key: "\(self.module)_\(self.type)_position", defaultValue: 0)
}
set {
Store.shared.set(key: "\(self.module)_\(self.type)_position", value: newValue)
}
get { Store.shared.int(key: "\(self.module)_\(self.type)_position", defaultValue: 0) }
set { Store.shared.set(key: "\(self.module)_\(self.type)_position", value: newValue) }
}
private var list: [widget_t] {
@@ -264,9 +258,7 @@ public class SWidget {
let string = Store.shared.string(key: "\(self.module)_widget", defaultValue: self.defaultWidget.rawValue)
return string.split(separator: ",").map{ (widget_t(rawValue: String($0)) ?? .unknown)}
}
set {
Store.shared.set(key: "\(self.module)_widget", value: newValue.map{ $0.rawValue }.joined(separator: ","))
}
set { Store.shared.set(key: "\(self.module)_widget", value: newValue.map{ $0.rawValue }.joined(separator: ",")) }
}
private var menuBarItem: NSStatusItem? = nil
@@ -576,8 +568,6 @@ public class MenuBarView: NSView {
public func removeWidget(type: widget_t) {
if let view = self.subviews.first(where: { $0.identifier == NSUserInterfaceItemIdentifier(type.rawValue) }) {
view.removeFromSuperview()
} else {
error("\(type) could not be removed from the one view because not found!")
}
}