hyprlanddata: use stdiocollector instead of jq hack with splitparser

This commit is contained in:
end-4
2025-07-27 08:51:43 +07:00
parent cc176a999d
commit fe07298adb
+25 -20
View File
@@ -69,10 +69,11 @@ Singleton {
Process { Process {
id: getClients id: getClients
command: ["bash", "-c", "hyprctl clients -j | jq -c"] command: ["bash", "-c", "hyprctl clients -j"]
stdout: SplitParser { stdout: StdioCollector {
onRead: data => { id: clientsCollector
root.windowList = JSON.parse(data); onStreamFinished: {
root.windowList = JSON.parse(clientsCollector.text)
let tempWinByAddress = {}; let tempWinByAddress = {};
for (var i = 0; i < root.windowList.length; ++i) { for (var i = 0; i < root.windowList.length; ++i) {
var win = root.windowList[i]; var win = root.windowList[i];
@@ -86,30 +87,33 @@ Singleton {
Process { Process {
id: getMonitors id: getMonitors
command: ["bash", "-c", "hyprctl monitors -j | jq -c"] command: ["bash", "-c", "hyprctl monitors -j"]
stdout: SplitParser { stdout: StdioCollector {
onRead: data => { id: monitorsCollector
root.monitors = JSON.parse(data); onStreamFinished: {
root.monitors = JSON.parse(monitorsCollector.text);
} }
} }
} }
Process { Process {
id: getLayers id: getLayers
command: ["bash", "-c", "hyprctl layers -j | jq -c"] command: ["bash", "-c", "hyprctl layers -j"]
stdout: SplitParser { stdout: StdioCollector {
onRead: data => { id: layersCollector
root.layers = JSON.parse(data); onStreamFinished: {
root.layers = JSON.parse(layersCollector.text);
} }
} }
} }
Process { Process {
id: getWorkspaces id: getWorkspaces
command: ["bash", "-c", "hyprctl workspaces -j | jq -c"] command: ["bash", "-c", "hyprctl workspaces -j"]
stdout: SplitParser { stdout: StdioCollector {
onRead: data => { id: workspacesCollector
root.workspaces = JSON.parse(data); onStreamFinished: {
root.workspaces = JSON.parse(workspacesCollector.text);
let tempWorkspaceById = {}; let tempWorkspaceById = {};
for (var i = 0; i < root.workspaces.length; ++i) { for (var i = 0; i < root.workspaces.length; ++i) {
var ws = root.workspaces[i]; var ws = root.workspaces[i];
@@ -123,10 +127,11 @@ Singleton {
Process { Process {
id: getActiveWorkspace id: getActiveWorkspace
command: ["bash", "-c", "hyprctl activeworkspace -j | jq -c"] command: ["bash", "-c", "hyprctl activeworkspace -j"]
stdout: SplitParser { stdout: StdioCollector {
onRead: data => { id: activeWorkspaceCollector
root.activeWorkspace = JSON.parse(data); onStreamFinished: {
root.activeWorkspace = JSON.parse(activeWorkspaceCollector.text);
} }
} }
} }