reorganize repo: move shell sources into shell/, test scripts into test/
This commit is contained in:
parent
344c1f8512
commit
d6cd2f173a
60 changed files with 2 additions and 2 deletions
53
shell/modules/PowerProfileService.qml
Normal file
53
shell/modules/PowerProfileService.qml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import "." as M
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property string profile: ""
|
||||
readonly property bool powerSaver: profile === "power-saver"
|
||||
|
||||
property var _proc: Process {
|
||||
running: M.Modules.powerProfile.enable
|
||||
command: ["powerprofilesctl", "get"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root.profile = text.trim()
|
||||
}
|
||||
}
|
||||
|
||||
property var _monitor: Process {
|
||||
running: M.Modules.powerProfile.enable
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
property var _debounce: Timer {
|
||||
interval: 300
|
||||
onTriggered: root._proc.running = true
|
||||
}
|
||||
|
||||
property var _poll: Timer {
|
||||
interval: 60000
|
||||
running: M.Modules.powerProfile.enable
|
||||
repeat: true
|
||||
onTriggered: root._proc.running = true
|
||||
}
|
||||
|
||||
function set(p) {
|
||||
_setter.next = p;
|
||||
_setter.running = true;
|
||||
}
|
||||
|
||||
property var _setter: Process {
|
||||
property string next: ""
|
||||
command: ["powerprofilesctl", "set", next]
|
||||
onRunningChanged: if (!running && next !== "")
|
||||
root._proc.running = true
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue