diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-01 15:12:09 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-01 15:12:09 +0200 |
commit | 85bf62eaa2fd71eb15ef401e537457fb9098a540 (patch) | |
tree | 707e7f4ea5b0d55992eae062ad7ed4795c1105c8 /accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml | |
parent | c9b4c6834e390f051e3137a6a45882ea8608ee9d (diff) | |
download | nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.tar nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.tar.gz nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.tar.bz2 nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.tar.xz nixos-85bf62eaa2fd71eb15ef401e537457fb9098a540.zip |
...
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml')
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/KeyboardLayout.qml | 53 |
1 files changed, 29 insertions, 24 deletions
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 | |||
3 | import qs.Services | 3 | import qs.Services |
4 | import Quickshell.Widgets | 4 | import Quickshell.Widgets |
5 | 5 | ||
6 | Rectangle { | 6 | Item { |
7 | id: kbdWidget | ||
8 | |||
9 | property var keyboardAbbrev: { "English (programmer Dvorak)": "dvp", "English (US)": "us" } | ||
10 | |||
11 | width: kbdLabel.contentWidth + 8 | 7 | width: kbdLabel.contentWidth + 8 |
12 | color: { | ||
13 | if (kbdMouseArea.containsMouse) { | ||
14 | return "#33808080"; | ||
15 | } | ||
16 | return "transparent"; | ||
17 | } | ||
18 | height: parent.height | 8 | height: parent.height |
19 | anchors.verticalCenter: parent.verticalCenter | 9 | anchors.verticalCenter: parent.verticalCenter |
20 | 10 | ||
@@ -22,6 +12,7 @@ Rectangle { | |||
22 | id: kbdMouseArea | 12 | id: kbdMouseArea |
23 | 13 | ||
24 | anchors.fill: parent | 14 | anchors.fill: parent |
15 | |||
25 | hoverEnabled: true | 16 | hoverEnabled: true |
26 | cursorShape: Qt.PointingHandCursor | 17 | cursorShape: Qt.PointingHandCursor |
27 | enabled: true | 18 | enabled: true |
@@ -32,23 +23,37 @@ Rectangle { | |||
32 | NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": event.angleDelta > 0 ? "Next" : "Prev" } } }, _ => {}) | 23 | NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": event.angleDelta > 0 ? "Next" : "Prev" } } }, _ => {}) |
33 | } | 24 | } |
34 | 25 | ||
35 | Text { | 26 | Rectangle { |
36 | id: kbdLabel | 27 | id: kbdWidget |
37 | 28 | ||
38 | font.pointSize: 10 | 29 | property var keyboardAbbrev: { "English (programmer Dvorak)": "dvp", "English (US)": "us" } |
39 | font.family: "Fira Sans" | 30 | |
31 | anchors.fill: parent | ||
40 | color: { | 32 | color: { |
41 | if (NiriService.keyboardLayouts?.current_idx === 0) | 33 | if (kbdMouseArea.containsMouse) { |
42 | return "#555"; | 34 | return "#33808080"; |
43 | return "white"; | 35 | } |
36 | return "transparent"; | ||
44 | } | 37 | } |
45 | anchors.centerIn: parent | ||
46 | 38 | ||
47 | text: { | 39 | Text { |
48 | const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; | 40 | id: kbdLabel |
49 | if (!currentLayout) | 41 | |
50 | return ""; | 42 | font.pointSize: 10 |
51 | return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; | 43 | font.family: "Fira Sans" |
44 | color: { | ||
45 | if (NiriService.keyboardLayouts?.current_idx === 0) | ||
46 | return "#555"; | ||
47 | return "white"; | ||
48 | } | ||
49 | anchors.centerIn: parent | ||
50 | |||
51 | text: { | ||
52 | const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; | ||
53 | if (!currentLayout) | ||
54 | return ""; | ||
55 | return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; | ||
56 | } | ||
52 | } | 57 | } |
53 | } | 58 | } |
54 | } | 59 | } |