- add an option to select a color for each module (from a predefined list)

- add a separator to select color menu
This commit is contained in:
Serhiy Mytrovtsiy
2020-07-08 17:50:40 +02:00
parent cb8ab6365c
commit 8b9698006f
10 changed files with 299 additions and 129 deletions

View File

@@ -17,11 +17,19 @@
<key>Value</key>
<string>0.08</string>
</dict>
<key>Unsupported colors</key>
<array>
<string>pressure</string>
</array>
</dict>
<key>line_chart</key>
<dict>
<key>Default</key>
<false/>
<key>Unsupported colors</key>
<array>
<string>pressure</string>
</array>
</dict>
<key>bar_chart</key>
<dict>
@@ -34,6 +42,10 @@
<key>Color</key>
<true/>
</dict>
<key>Unsupported colors</key>
<array>
<string>pressure</string>
</array>
</dict>
</dict>
</dict>

View File

@@ -21,6 +21,10 @@
<key>Value</key>
<string>0.36</string>
</dict>
<key>Unsupported colors</key>
<array>
<string>pressure</string>
</array>
</dict>
<key>bar_chart</key>
<dict>
@@ -40,11 +44,13 @@
<true/>
<key>Box</key>
<true/>
<key>Color</key>
<true/>
<key>Value</key>
<string>0.36</string>
</dict>
<key>Unsupported colors</key>
<array>
<string>pressure</string>
</array>
</dict>
<key>disk</key>
<dict>

View File

@@ -27,7 +27,9 @@ internal class Popup: NSView {
internal func usageCallback(_ value: DiskList) {
if self.list.count != value.list.count {
self.subviews.forEach{ $0.removeFromSuperview() }
DispatchQueue.main.async(execute: {
self.subviews.forEach{ $0.removeFromSuperview() }
})
self.list = [:]
}

View File

@@ -67,6 +67,7 @@ public class Memory: Module {
self.popupView.loadCallback(value!)
if let widget = self.widget as? Mini {
widget.setValue(value!.usage ?? 0, sufix: "%")
widget.setPressure(value?.pressureLevel ?? 0)
}
if let widget = self.widget as? LineChart {
widget.setValue(value!.usage ?? 0)