From 85bf62eaa2fd71eb15ef401e537457fb9098a540 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 1 Sep 2025 15:12:09 +0200 Subject: ... --- .../gkleen@sif/shell/quickshell/KeyboardLayout.qml | 53 ++++++++++++---------- 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml') diff --git a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml index 4a6b8390..bc3750f9 100644 --- a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml +++ b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml @@ -3,18 +3,8 @@ import QtQuick import qs.Services import Quickshell.Widgets -Rectangle { - id: kbdWidget - - property var keyboardAbbrev: { "English (programmer Dvorak)": "dvp", "English (US)": "us" } - +Item { width: kbdLabel.contentWidth + 8 - color: { - if (kbdMouseArea.containsMouse) { - return "#33808080"; - } - return "transparent"; - } height: parent.height anchors.verticalCenter: parent.verticalCenter @@ -22,6 +12,7 @@ Rectangle { id: kbdMouseArea anchors.fill: parent + hoverEnabled: true cursorShape: Qt.PointingHandCursor enabled: true @@ -32,23 +23,37 @@ Rectangle { NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": event.angleDelta > 0 ? "Next" : "Prev" } } }, _ => {}) } - Text { - id: kbdLabel + Rectangle { + id: kbdWidget - font.pointSize: 10 - font.family: "Fira Sans" + property var keyboardAbbrev: { "English (programmer Dvorak)": "dvp", "English (US)": "us" } + + anchors.fill: parent color: { - if (NiriService.keyboardLayouts?.current_idx === 0) - return "#555"; - return "white"; + if (kbdMouseArea.containsMouse) { + return "#33808080"; + } + return "transparent"; } - 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 { + id: kbdLabel + + 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; + } } } } -- cgit v1.2.3