summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml20
1 files changed, 12 insertions, 8 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml b/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml
index 914152e1..af522ec4 100644
--- a/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml
+++ b/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml
@@ -13,10 +13,6 @@ Singleton {
13 property var windows: [] 13 property var windows: []
14 readonly property string socketPath: Quickshell.env("NIRI_SOCKET") 14 readonly property string socketPath: Quickshell.env("NIRI_SOCKET")
15 15
16 onKeyboardLayoutsChanged: {
17 console.log(JSON.stringify(keyboardLayouts));
18 }
19
20 function refreshOutputs() { 16 function refreshOutputs() {
21 commandSocket.sendCommand("Outputs", data => { 17 commandSocket.sendCommand("Outputs", data => {
22 outputs = data.Ok.Outputs; 18 outputs = data.Ok.Outputs;
@@ -32,9 +28,12 @@ Singleton {
32 path: root.socketPath 28 path: root.socketPath
33 connected: true 29 connected: true
34 30
31 property bool acked: false
32
35 onConnectionStateChanged: { 33 onConnectionStateChanged: {
36 if (connected) { 34 if (connected) {
37 write('"EventStream"\n') 35 acked = false;
36 write('"EventStream"\n');
38 } 37 }
39 } 38 }
40 39
@@ -70,6 +69,11 @@ Singleton {
70 eventWindowUrgencyChanged(event.WindowUrgencyChanged); 69 eventWindowUrgencyChanged(event.WindowUrgencyChanged);
71 else if (event.WindowLayoutsChanged) 70 else if (event.WindowLayoutsChanged)
72 eventWindowLayoutsChanged(event.WindowLayoutsChanged); 71 eventWindowLayoutsChanged(event.WindowLayoutsChanged);
72 else if (event.Ok && !eventStreamSocket.acked) { eventStreamSocket.acked = true; }
73 else if (event.OverviewOpenedOrClosed) {}
74 else if (event.ConfigLoaded) {}
75 else
76 console.log(JSON.stringify(event));
73 } catch (e) { 77 } catch (e) {
74 console.warn("NiriService: Failed to parse event:", line, e) 78 console.warn("NiriService: Failed to parse event:", line, e)
75 } 79 }
@@ -157,10 +161,10 @@ Singleton {
157 } 161 }
158 function eventWindowOpenedOrChanged(data) { 162 function eventWindowOpenedOrChanged(data) {
159 root.windows = Array.from(root.windows).map(win => { 163 root.windows = Array.from(root.windows).map(win => {
160 if (win.id === data.window.id) 164 if (data.window.is_focused)
161 return data.window; 165 win.is_focused = false;
162 return win; 166 return win;
163 }); 167 }).filter(win => win.id !== data.window.id).concat([data.window]);
164 } 168 }
165 function eventWindowClosed(data) { 169 function eventWindowClosed(data) {
166 root.windows = Array.from(root.windows).filter(win => win.id !== data.id); 170 root.windows = Array.from(root.windows).filter(win => win.id !== data.id);