From 2f0e13af015d5bfdbac77d2340e8f4810929620a Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 30 Aug 2025 23:53:06 +0200 Subject: ... --- accounts/gkleen@sif/shell/quickshell/Bar.qml | 2 ++ .../gkleen@sif/shell/quickshell/Services/NiriService.qml | 12 +++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml index 52f875da..520ec2c6 100644 --- a/accounts/gkleen@sif/shell/quickshell/Bar.qml +++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml @@ -356,6 +356,8 @@ PanelWindow { text: { const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; + if (!currentLayout) + return ""; return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; } } diff --git a/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml b/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml index 914152e1..c82caaa6 100644 --- a/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml +++ b/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml @@ -13,10 +13,6 @@ Singleton { property var windows: [] readonly property string socketPath: Quickshell.env("NIRI_SOCKET") - onKeyboardLayoutsChanged: { - console.log(JSON.stringify(keyboardLayouts)); - } - function refreshOutputs() { commandSocket.sendCommand("Outputs", data => { outputs = data.Ok.Outputs; @@ -70,6 +66,8 @@ Singleton { eventWindowUrgencyChanged(event.WindowUrgencyChanged); else if (event.WindowLayoutsChanged) eventWindowLayoutsChanged(event.WindowLayoutsChanged); + else + console.log(JSON.stringify(event)); } catch (e) { console.warn("NiriService: Failed to parse event:", line, e) } @@ -156,11 +154,7 @@ Singleton { }); } function eventWindowOpenedOrChanged(data) { - root.windows = Array.from(root.windows).map(win => { - if (win.id === data.window.id) - return data.window; - return win; - }); + root.windows = Array.from(root.windows).filter(win => win.id !== data.window.id).concat([data.window]); } function eventWindowClosed(data) { root.windows = Array.from(root.windows).filter(win => win.id !== data.id); -- cgit v1.2.3