move NiriIpc and PowerProfileService singletons to services/

This commit is contained in:
Damocles 2026-04-17 23:11:46 +02:00
parent 63e93f5de0
commit 0160e4a1fb
10 changed files with 18 additions and 19 deletions

View file

@ -1,54 +0,0 @@
pragma Singleton
import QtQuick
import Quickshell.Io
import "." as M
import "../services" as S
QtObject {
id: root
property string profile: ""
readonly property bool powerSaver: profile === "power-saver"
property var _proc: Process {
running: S.Modules.powerProfile.enable
command: ["powerprofilesctl", "get"]
stdout: StdioCollector {
onStreamFinished: root.profile = text.trim()
}
}
property var _monitor: Process {
running: S.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: S.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
}
}