From c9b4c6834e390f051e3137a6a45882ea8608ee9d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 1 Sep 2025 14:05:25 +0200 Subject: ... --- accounts/gkleen@sif/shell/quickshell/Clock.qml | 30 +++++++++---------- .../gkleen@sif/shell/quickshell/KeyboardLayout.qml | 34 +++++++++++----------- .../shell/quickshell/Services/NiriService.qml | 8 ++++- .../gkleen@sif/shell/quickshell/SystemTray.qml | 24 ++++++++------- 4 files changed, 52 insertions(+), 44 deletions(-) diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml index 58600adb..55fabd1c 100644 --- a/accounts/gkleen@sif/shell/quickshell/Clock.qml +++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml @@ -11,7 +11,7 @@ Item { height: parent.height anchors.verticalCenter: parent.verticalCenter - MouseArea { + WrapperMouseArea { id: clockMouseArea anchors.fill: parent @@ -29,24 +29,24 @@ Item { } onWheel: event => scrollYear(event) - } - Text { - id: clock - color: "white" + Text { + id: clock + color: "white" - anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenter: parent.verticalCenter - Custom.Chrono { - id: chrono - format: "W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}" - } + Custom.Chrono { + id: chrono + format: "W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}" + } - text: chrono.date + text: chrono.date - font.pointSize: 10 - font.family: "Fira Sans" - font.features: { "tnum": 1 } + font.pointSize: 10 + font.family: "Fira Sans" + font.features: { "tnum": 1 } + } } PopupWindow { @@ -250,4 +250,4 @@ Item { } } } -} \ No newline at end of file +} diff --git a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml index b9f91580..4a6b8390 100644 --- a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml +++ b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml @@ -18,7 +18,7 @@ Rectangle { height: parent.height anchors.verticalCenter: parent.verticalCenter - MouseArea { + WrapperMouseArea { id: kbdMouseArea anchors.fill: parent @@ -31,25 +31,25 @@ Rectangle { onWheel: event => { NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": event.angleDelta > 0 ? "Next" : "Prev" } } }, _ => {}) } - } - Text { - id: kbdLabel + Text { + id: kbdLabel - font.pointSize: 10 - font.family: "Fira Sans" - color: { - if (NiriService.keyboardLayouts?.current_idx === 0) - return "#555"; - return "white"; - } - anchors.centerIn: parent + font.pointSize: 10 + font.family: "Fira Sans" + color: { + if (NiriService.keyboardLayouts?.current_idx === 0) + return "#555"; + return "white"; + } + anchors.centerIn: parent - text: { - const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; - if (!currentLayout) - return ""; - return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; + 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 c82caaa6..179b55e0 100644 --- a/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml +++ b/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml @@ -28,9 +28,12 @@ Singleton { path: root.socketPath connected: true + property bool acked: false + onConnectionStateChanged: { if (connected) { - write('"EventStream"\n') + acked = false; + write('"EventStream"\n'); } } @@ -66,6 +69,9 @@ Singleton { eventWindowUrgencyChanged(event.WindowUrgencyChanged); else if (event.WindowLayoutsChanged) eventWindowLayoutsChanged(event.WindowLayoutsChanged); + else if (event.Ok && !eventStreamSocket.acked) { eventStreamSocket.acked = true; } + else if (event.OverviewOpenedOrClosed) {} + else if (event.ConfigLoaded) {} else console.log(JSON.stringify(event)); } catch (e) { diff --git a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml index ba678138..024026a3 100644 --- a/accounts/gkleen@sif/shell/quickshell/SystemTray.qml +++ b/accounts/gkleen@sif/shell/quickshell/SystemTray.qml @@ -24,6 +24,8 @@ Item { } delegate: Item { + id: trayItemWrapper + property var trayItem: modelData property string iconSource: { let icon = trayItem && trayItem.icon @@ -47,17 +49,7 @@ Item { height: parent.height anchors.verticalCenter: parent.verticalCenter - IconImage { - anchors.centerIn: parent - width: parent.width - height: parent.width - source: parent.iconSource - asynchronous: true - smooth: true - mipmap: true - } - - MouseArea { + WrapperMouseArea { id: trayItemArea anchors.fill: parent @@ -88,6 +80,16 @@ Item { menuAnchor.open() } } + + IconImage { + anchors.centerIn: parent + width: parent.width + height: parent.width + source: trayItemWrapper.iconSource + asynchronous: true + smooth: true + mipmap: true + } } PopupWindow { -- cgit v1.2.3