feat: added a new Text widget that allows to visualize custom values in the menu bar

This commit is contained in:
Serhiy Mytrovtsiy
2024-09-10 18:14:46 +02:00
parent c52d0e23b5
commit 4b213c4392
3 changed files with 97 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ public enum widget_t: String {
case label = "label"
case tachometer = "tachometer"
case state = "state"
case text = "text"
public func new(module: String, config: NSDictionary, defaultWidget: widget_t) -> SWidget? {
guard let widgetConfig: NSDictionary = config[self.rawValue] as? NSDictionary else { return nil }
@@ -74,6 +75,9 @@ public enum widget_t: String {
case .state:
preview = StateWidget(title: module, config: widgetConfig, preview: true)
item = StateWidget(title: module, config: widgetConfig, preview: false)
case .text:
preview = TextWidget(title: module, config: widgetConfig, preview: true)
item = TextWidget(title: module, config: widgetConfig, preview: false)
default: break
}
@@ -137,6 +141,7 @@ public enum widget_t: String {
case .label: return localizedString("Label widget")
case .tachometer: return localizedString("Tachometer widget")
case .state: return localizedString("State widget")
case .text: return localizedString("Text widget")
default: return ""
}
}