fix: detect niri availability from event stream; fix workspaces visibility

This commit is contained in:
Damocles 2026-04-15 21:23:02 +02:00
parent e3cae59ac3
commit 1b5bdd3010
4 changed files with 7 additions and 8 deletions

View file

@ -11,14 +11,14 @@ QtObject {
signal windowFocusChanged(var windowId)
signal windowOpenedOrChanged(var window)
readonly property bool available: Quickshell.env("NIRI_SOCKET") !== ""
property bool available: false
property string focusedTitle: ""
property string focusedAppId: ""
property bool overviewOpen: false
property var _focusedProc: Process {
running: root.available
running: true
command: ["niri", "msg", "--json", "focused-window"]
stdout: StdioCollector {
onStreamFinished: {
@ -37,13 +37,14 @@ QtObject {
}
property var _eventStream: Process {
running: root.available
running: true
command: ["niri", "msg", "--json", "event-stream"]
stdout: SplitParser {
splitMarker: "\n"
onRead: line => {
try {
const ev = JSON.parse(line);
root.available = true;
if (ev.WorkspacesChanged !== undefined)
root.workspacesChanged(ev.WorkspacesChanged.workspaces);
else if (ev.WorkspaceActivated !== undefined)