From 466ce70f96f8bdde32260f6951c5cbb62cfc02a7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 31 Aug 2025 21:57:00 +0200 Subject: ... --- .../gkleen@sif/shell/quickshell/KeyboardLayout.qml | 43 +++++++++++++++++----- 1 file changed, 33 insertions(+), 10 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 710ea10c..b9f91580 100644 --- a/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml +++ b/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml @@ -1,6 +1,7 @@ import Quickshell import QtQuick import qs.Services +import Quickshell.Widgets Rectangle { id: kbdWidget @@ -27,6 +28,9 @@ Rectangle { onClicked: { NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": "Next" } } }, _ => {}) } + onWheel: event => { + NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": event.angleDelta > 0 ? "Next" : "Prev" } } }, _ => {}) + } } Text { @@ -50,28 +54,47 @@ Rectangle { } PopupWindow { + id: tooltip + + property bool nextVisible: kbdMouseArea.containsMouse || tooltipMouseArea.containsMouse + anchor { item: kbdMouseArea - edges: Edges.Bottom + edges: Edges.Bottom | Edges.Left + } + visible: false + + onNextVisibleChanged: hangTimer.restart() + + Timer { + id: hangTimer + interval: 100 + onTriggered: tooltip.visible = tooltip.nextVisible } - visible: kbdMouseArea.containsMouse implicitWidth: kbdTooltipText.contentWidth + 16 implicitHeight: kbdTooltipText.contentHeight + 16 color: "black" - Text { - id: kbdTooltipText + WrapperMouseArea { + id: tooltipMouseArea + + hoverEnabled: true + enabled: true anchors.centerIn: parent - font.pointSize: 10 - font.family: "Fira Sans" - color: "white" + Text { + id: kbdTooltipText + + font.pointSize: 10 + font.family: "Fira Sans" + color: "white" - text: { - const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; - return currentLayout || ""; + text: { + const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; + return currentLayout || ""; + } } } } -- cgit v1.2.3