summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-08-31 21:57:00 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2025-08-31 21:57:00 +0200
commit466ce70f96f8bdde32260f6951c5cbb62cfc02a7 (patch)
tree3d3120f6a1ace487d2db5a024411a467d55b9632 /accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml
parent828893e930886872fcf612bc8958d33fee73b5df (diff)
downloadnixos-466ce70f96f8bdde32260f6951c5cbb62cfc02a7.tar
nixos-466ce70f96f8bdde32260f6951c5cbb62cfc02a7.tar.gz
nixos-466ce70f96f8bdde32260f6951c5cbb62cfc02a7.tar.bz2
nixos-466ce70f96f8bdde32260f6951c5cbb62cfc02a7.tar.xz
nixos-466ce70f96f8bdde32260f6951c5cbb62cfc02a7.zip
...
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml43
1 files changed, 33 insertions, 10 deletions
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 @@
1import Quickshell 1import Quickshell
2import QtQuick 2import QtQuick
3import qs.Services 3import qs.Services
4import Quickshell.Widgets
4 5
5Rectangle { 6Rectangle {
6 id: kbdWidget 7 id: kbdWidget
@@ -27,6 +28,9 @@ Rectangle {
27 onClicked: { 28 onClicked: {
28 NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": "Next" } } }, _ => {}) 29 NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": "Next" } } }, _ => {})
29 } 30 }
31 onWheel: event => {
32 NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": event.angleDelta > 0 ? "Next" : "Prev" } } }, _ => {})
33 }
30 } 34 }
31 35
32 Text { 36 Text {
@@ -50,28 +54,47 @@ Rectangle {
50 } 54 }
51 55
52 PopupWindow { 56 PopupWindow {
57 id: tooltip
58
59 property bool nextVisible: kbdMouseArea.containsMouse || tooltipMouseArea.containsMouse
60
53 anchor { 61 anchor {
54 item: kbdMouseArea 62 item: kbdMouseArea
55 edges: Edges.Bottom 63 edges: Edges.Bottom | Edges.Left
64 }
65 visible: false
66
67 onNextVisibleChanged: hangTimer.restart()
68
69 Timer {
70 id: hangTimer
71 interval: 100
72 onTriggered: tooltip.visible = tooltip.nextVisible
56 } 73 }
57 visible: kbdMouseArea.containsMouse
58 74
59 implicitWidth: kbdTooltipText.contentWidth + 16 75 implicitWidth: kbdTooltipText.contentWidth + 16
60 implicitHeight: kbdTooltipText.contentHeight + 16 76 implicitHeight: kbdTooltipText.contentHeight + 16
61 color: "black" 77 color: "black"
62 78
63 Text { 79 WrapperMouseArea {
64 id: kbdTooltipText 80 id: tooltipMouseArea
81
82 hoverEnabled: true
83 enabled: true
65 84
66 anchors.centerIn: parent 85 anchors.centerIn: parent
67 86
68 font.pointSize: 10 87 Text {
69 font.family: "Fira Sans" 88 id: kbdTooltipText
70 color: "white" 89
90 font.pointSize: 10
91 font.family: "Fira Sans"
92 color: "white"
71 93
72 text: { 94 text: {
73 const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; 95 const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx];
74 return currentLayout || ""; 96 return currentLayout || "";
97 }
75 } 98 }
76 } 99 }
77 } 100 }