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() } }