added adaptive quickshell

This commit is contained in:
wt committed 2026-11-17 18:15:16 +07:00
1 parent 6eb56d2065
commit 5b33a73fd8
189 files changed
+8678 -15

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
QtObject {
id: root
property var monitors: []
property bool busy: false
property string error: ""
function refresh() {
if (busy) return;
busy = true;
worker.command = ["python3", Quickshell.shellPath("backend/displays.py"), "list"];
worker.running = true;
}
property Process worker: Process {
stdout: StdioCollector { id: output }
stderr: StdioCollector { id: errors }
onExited: (code, status) => {
root.busy = false;
try {
const result = JSON.parse(output.text);
if (code !== 0 || !result.ok || !Array.isArray(result.monitors))
throw new Error(result.error || errors.text || "Не удалось получить список дисплеев");
root.monitors = result.monitors;
root.error = "";
} catch (e) { root.error = String(e); }
}
}
property Timer refreshTimer: Timer {
interval: 5000
repeat: true
running: true
triggeredOnStart: true
onTriggered: root.refresh()
}
}