configurable polling intervals and thresholds per module
This commit is contained in:
parent
0eaba947f4
commit
7a4e1859a9
11 changed files with 64 additions and 32 deletions
|
|
@ -19,8 +19,10 @@ M.BarSection {
|
|||
readonly property var dev: UPower.displayDevice
|
||||
readonly property real pct: (dev?.percentage ?? 0) * 100
|
||||
readonly property bool charging: dev?.state === UPowerDeviceState.Charging
|
||||
readonly property bool _critical: pct < 15 && !charging
|
||||
property color _stateColor: charging ? M.Theme.base0B : _critical ? M.Theme.base09 : pct < 30 ? M.Theme.base0A : M.Theme.base08
|
||||
readonly property int _critThresh: M.Modules.battery.critical || 15
|
||||
readonly property int _warnThresh: M.Modules.battery.warning || 25
|
||||
readonly property bool _critical: pct < _critThresh && !charging
|
||||
property color _stateColor: charging ? M.Theme.base0B : _critical ? M.Theme.base09 : pct < _warnThresh ? M.Theme.base0A : M.Theme.base08
|
||||
property real _blinkOpacity: 1
|
||||
|
||||
SequentialAnimation {
|
||||
|
|
@ -37,11 +39,11 @@ M.BarSection {
|
|||
onChargingChanged: { _warnSent = false; _critSent = false; }
|
||||
onPctChanged: {
|
||||
if (charging) return;
|
||||
if (pct < 15 && !_critSent) {
|
||||
if (pct < _critThresh && !_critSent) {
|
||||
_critSent = true; _warnSent = true;
|
||||
_notif.command = ["notify-send", "--urgency=critical", "--icon=battery-low", "--category=device", "Very Low Battery", "Connect to power now!"];
|
||||
_notif.running = true;
|
||||
} else if (pct < 25 && !_warnSent) {
|
||||
} else if (pct < _warnThresh && !_warnSent) {
|
||||
_warnSent = true;
|
||||
_notif.command = ["notify-send", "--icon=battery-caution", "--category=device", "Low Battery"];
|
||||
_notif.running = true;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ M.BarSection {
|
|||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 5000
|
||||
interval: M.Modules.bluetooth.interval || 5000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: proc.running = true
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ M.BarSection {
|
|||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 1000
|
||||
interval: M.Modules.cpu.interval || 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ M.BarSection {
|
|||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 30000
|
||||
interval: M.Modules.disk.interval || 30000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: proc.running = true
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ M.BarSection {
|
|||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 2000
|
||||
interval: M.Modules.memory.interval || 2000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: meminfo.reload()
|
||||
|
|
|
|||
|
|
@ -14,17 +14,17 @@ QtObject {
|
|||
property var notifications: ({ enable: true })
|
||||
property var mpris: ({ enable: true })
|
||||
property var volume: ({ enable: true })
|
||||
property var bluetooth: ({ enable: true })
|
||||
property var bluetooth: ({ enable: true, interval: 5000 })
|
||||
property var backlight: ({ enable: true, step: 5 })
|
||||
property var network: ({ enable: true })
|
||||
property var powerProfile: ({ enable: true })
|
||||
property var network: ({ enable: true, interval: 5000 })
|
||||
property var powerProfile: ({ enable: true, interval: 5000 })
|
||||
property var idleInhibitor: ({ enable: true })
|
||||
property var weather: ({ enable: true, args: ["--nerd"] })
|
||||
property var temperature: ({ enable: true })
|
||||
property var cpu: ({ enable: true })
|
||||
property var memory: ({ enable: true })
|
||||
property var disk: ({ enable: true })
|
||||
property var battery: ({ enable: true })
|
||||
property var weather: ({ enable: true, args: ["--nerd"], interval: 3600000 })
|
||||
property var temperature: ({ enable: true, interval: 2000, warm: 60, hot: 80 })
|
||||
property var cpu: ({ enable: true, interval: 1000 })
|
||||
property var memory: ({ enable: true, interval: 2000 })
|
||||
property var disk: ({ enable: true, interval: 30000 })
|
||||
property var battery: ({ enable: true, warning: 25, critical: 15 })
|
||||
property var power: ({ enable: true })
|
||||
|
||||
property FileView _file: FileView {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ M.BarSection {
|
|||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 5000
|
||||
interval: M.Modules.network.interval || 5000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: proc.running = true
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ M.BarIcon {
|
|||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 5000
|
||||
interval: M.Modules.powerProfile.interval || 5000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: proc.running = true
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ M.BarSection {
|
|||
tooltip: "Temperature: " + root.celsius + "\u00B0C"
|
||||
|
||||
property int celsius: 0
|
||||
property color _stateColor: celsius > 80 ? M.Theme.base09 : celsius > 60 ? M.Theme.base0A : M.Theme.base08
|
||||
property color _stateColor: celsius > (M.Modules.temperature.hot || 80) ? M.Theme.base09
|
||||
: celsius > (M.Modules.temperature.warm || 60) ? M.Theme.base0A : M.Theme.base08
|
||||
Behavior on _stateColor { ColorAnimation { duration: 300 } }
|
||||
|
||||
FileView {
|
||||
|
|
@ -17,7 +18,7 @@ M.BarSection {
|
|||
onLoaded: root.celsius = Math.round(parseInt(text()) / 1000)
|
||||
}
|
||||
Timer {
|
||||
interval: 2000
|
||||
interval: M.Modules.temperature.interval || 2000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: thermal.reload()
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ M.BarSection {
|
|||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 3600000
|
||||
interval: M.Modules.weather.interval || 3600000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: proc.running = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue