event-driven network/bluetooth/powerprofile via dbus-monitor + nmcli monitor
This commit is contained in:
parent
b06e3582ff
commit
0568f71d1b
3 changed files with 49 additions and 3 deletions
|
|
@ -41,8 +41,23 @@ M.BarSection {
|
||||||
onStreamFinished: root._parse(text)
|
onStreamFinished: root._parse(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Event-driven: watch BlueZ DBus property changes
|
||||||
|
Process {
|
||||||
|
id: btMonitor
|
||||||
|
running: true
|
||||||
|
command: ["sh", "-c", "dbus-monitor --system \"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',path_namespace='/org/bluez'\" 2>/dev/null"]
|
||||||
|
stdout: SplitParser {
|
||||||
|
splitMarker: "\n"
|
||||||
|
onRead: _debounce.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
Timer {
|
Timer {
|
||||||
interval: M.Modules.bluetooth.interval || 5000
|
id: _debounce
|
||||||
|
interval: 500
|
||||||
|
onTriggered: proc.running = true
|
||||||
|
}
|
||||||
|
Timer {
|
||||||
|
interval: 60000
|
||||||
running: true
|
running: true
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: proc.running = true
|
onTriggered: proc.running = true
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,24 @@ M.BarSection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Event-driven: re-poll on any network change
|
||||||
|
Process {
|
||||||
|
id: monitor
|
||||||
|
running: true
|
||||||
|
command: ["nmcli", "monitor"]
|
||||||
|
stdout: SplitParser {
|
||||||
|
splitMarker: "\n"
|
||||||
|
onRead: _debounce.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
Timer {
|
Timer {
|
||||||
interval: M.Modules.network.interval || 5000
|
id: _debounce
|
||||||
|
interval: 300
|
||||||
|
onTriggered: proc.running = true
|
||||||
|
}
|
||||||
|
// Fallback poll
|
||||||
|
Timer {
|
||||||
|
interval: 60000
|
||||||
running: true
|
running: true
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: proc.running = true
|
onTriggered: proc.running = true
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,23 @@ M.BarIcon {
|
||||||
onStreamFinished: root.profile = text.trim()
|
onStreamFinished: root.profile = text.trim()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Event-driven: watch power-profiles-daemon DBus changes
|
||||||
|
Process {
|
||||||
|
id: ppMonitor
|
||||||
|
running: true
|
||||||
|
command: ["sh", "-c", "dbus-monitor --system \"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',path='/net/hadess/PowerProfiles'\" 2>/dev/null"]
|
||||||
|
stdout: SplitParser {
|
||||||
|
splitMarker: "\n"
|
||||||
|
onRead: _debounce.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
Timer {
|
Timer {
|
||||||
interval: M.Modules.powerProfile.interval || 5000
|
id: _debounce
|
||||||
|
interval: 300
|
||||||
|
onTriggered: proc.running = true
|
||||||
|
}
|
||||||
|
Timer {
|
||||||
|
interval: 60000
|
||||||
running: true
|
running: true
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: proc.running = true
|
onTriggered: proc.running = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue