diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell')
| -rw-r--r-- | accounts/gkleen@sif/shell/quickshell/Bar.qml | 106 |
1 files changed, 59 insertions, 47 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml index 47f3a83c..52f875da 100644 --- a/accounts/gkleen@sif/shell/quickshell/Bar.qml +++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml | |||
| @@ -217,53 +217,7 @@ PanelWindow { | |||
| 217 | anchors.right: parent.right | 217 | anchors.right: parent.right |
| 218 | anchors.rightMargin: 8 | 218 | anchors.rightMargin: 8 |
| 219 | anchors.verticalCenter: parent.verticalCenter | 219 | anchors.verticalCenter: parent.verticalCenter |
| 220 | spacing: 8 | 220 | spacing: 0 |
| 221 | |||
| 222 | Rectangle { | ||
| 223 | id: kbdWidget | ||
| 224 | |||
| 225 | property var keyboardAbbrev: { "English (programmer Dvorak)": "dvp", "English (US)": "us" } | ||
| 226 | |||
| 227 | width: kbdLabel.contentWidth | ||
| 228 | color: { | ||
| 229 | /* if (kbdMouseArea.containsMouse) { | ||
| 230 | return "#33808080"; | ||
| 231 | } */ | ||
| 232 | return "transparent"; | ||
| 233 | } | ||
| 234 | height: parent.height | ||
| 235 | anchors.verticalCenter: parent.verticalCenter | ||
| 236 | |||
| 237 | MouseArea { | ||
| 238 | id: kbdMouseArea | ||
| 239 | |||
| 240 | anchors.fill: parent | ||
| 241 | hoverEnabled: true | ||
| 242 | cursorShape: Qt.PointingHandCursor | ||
| 243 | enabled: true | ||
| 244 | onClicked: { | ||
| 245 | NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": "Next" } } }, _ => {}) | ||
| 246 | } | ||
| 247 | } | ||
| 248 | |||
| 249 | Text { | ||
| 250 | id: kbdLabel | ||
| 251 | |||
| 252 | font.pointSize: 10 | ||
| 253 | font.family: "Fira Sans" | ||
| 254 | color: { | ||
| 255 | if (NiriService.keyboardLayouts?.current_idx === 0) | ||
| 256 | return "#555"; | ||
| 257 | return "white"; | ||
| 258 | } | ||
| 259 | anchors.centerIn: parent | ||
| 260 | |||
| 261 | text: { | ||
| 262 | const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; | ||
| 263 | return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; | ||
| 264 | } | ||
| 265 | } | ||
| 266 | } | ||
| 267 | 221 | ||
| 268 | Item { | 222 | Item { |
| 269 | anchors.verticalCenter: parent.verticalCenter | 223 | anchors.verticalCenter: parent.verticalCenter |
| @@ -355,6 +309,64 @@ PanelWindow { | |||
| 355 | } | 309 | } |
| 356 | } | 310 | } |
| 357 | 311 | ||
| 312 | Rectangle { | ||
| 313 | height: parent.height | ||
| 314 | width: 4 | ||
| 315 | color: "transparent" | ||
| 316 | } | ||
| 317 | |||
| 318 | Rectangle { | ||
| 319 | id: kbdWidget | ||
| 320 | |||
| 321 | property var keyboardAbbrev: { "English (programmer Dvorak)": "dvp", "English (US)": "us" } | ||
| 322 | |||
| 323 | width: kbdLabel.contentWidth + 8 | ||
| 324 | color: { | ||
| 325 | if (kbdMouseArea.containsMouse) { | ||
| 326 | return "#33808080"; | ||
| 327 | } | ||
| 328 | return "transparent"; | ||
| 329 | } | ||
| 330 | height: parent.height | ||
| 331 | anchors.verticalCenter: parent.verticalCenter | ||
| 332 | |||
| 333 | MouseArea { | ||
| 334 | id: kbdMouseArea | ||
| 335 | |||
| 336 | anchors.fill: parent | ||
| 337 | hoverEnabled: true | ||
| 338 | cursorShape: Qt.PointingHandCursor | ||
| 339 | enabled: true | ||
| 340 | onClicked: { | ||
| 341 | NiriService.sendCommand({ "Action": { "SwitchLayout": { "layout": "Next" } } }, _ => {}) | ||
| 342 | } | ||
| 343 | } | ||
| 344 | |||
| 345 | Text { | ||
| 346 | id: kbdLabel | ||
| 347 | |||
| 348 | font.pointSize: 10 | ||
| 349 | font.family: "Fira Sans" | ||
| 350 | color: { | ||
| 351 | if (NiriService.keyboardLayouts?.current_idx === 0) | ||
| 352 | return "#555"; | ||
| 353 | return "white"; | ||
| 354 | } | ||
| 355 | anchors.centerIn: parent | ||
| 356 | |||
| 357 | text: { | ||
| 358 | const currentLayout = NiriService.keyboardLayouts?.names?.[NiriService.keyboardLayouts.current_idx]; | ||
| 359 | return kbdWidget.keyboardAbbrev[currentLayout] ? kbdWidget.keyboardAbbrev[currentLayout] : currentLayout; | ||
| 360 | } | ||
| 361 | } | ||
| 362 | } | ||
| 363 | |||
| 364 | Rectangle { | ||
| 365 | height: parent.height | ||
| 366 | width: 4 | ||
| 367 | color: "transparent" | ||
| 368 | } | ||
| 369 | |||
| 358 | Text { | 370 | Text { |
| 359 | id: clock | 371 | id: clock |
| 360 | color: "white" | 372 | color: "white" |
