diff options
| author | AleksElixir <71710534+AleksElixir@users.noreply.github.com> | 2025-09-23 12:31:36 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-23 19:31:36 +1000 |
| commit | 50ef4871c782ae88ec0b6d4f6468d1e4d5dd9c6b (patch) | |
| tree | 370de99ba8e564d9dd1947742d972f7c0c3427b0 | |
| parent | config: enable/disable specific toasts (diff) | |
| download | caelestia-shell-50ef4871c782ae88ec0b6d4f6468d1e4d5dd9c6b.tar.gz caelestia-shell-50ef4871c782ae88ec0b6d4f6468d1e4d5dd9c6b.tar.bz2 caelestia-shell-50ef4871c782ae88ec0b6d4f6468d1e4d5dd9c6b.zip | |
popouts/kblayout: add switch layout button (#682)
* keyboard layout
* Update KbLayout.qml
Code cleanup
* Update KbLayout.qml
more code cleanup
* fix
---------
Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
| -rw-r--r-- | components/controls/TextButton.qml | 8 | ||||
| -rw-r--r-- | modules/bar/popouts/KbLayout.qml | 26 |
2 files changed, 31 insertions, 3 deletions
diff --git a/components/controls/TextButton.qml b/components/controls/TextButton.qml index 71ebcfa..ef84185 100644 --- a/components/controls/TextButton.qml +++ b/components/controls/TextButton.qml @@ -25,13 +25,19 @@ StyledRect { property bool internalChecked property color activeColour: type === TextButton.Filled ? Colours.palette.m3primary : Colours.palette.m3secondary - property color inactiveColour: type === TextButton.Filled ? Colours.tPalette.m3surfaceContainer : Colours.palette.m3secondaryContainer + property color inactiveColour: { + if (!toggle && type === TextButton.Filled) + return Colours.palette.m3primary; + return type === TextButton.Filled ? Colours.tPalette.m3surfaceContainer : Colours.palette.m3secondaryContainer; + } property color activeOnColour: { if (type === TextButton.Text) return Colours.palette.m3primary; return type === TextButton.Filled ? Colours.palette.m3onPrimary : Colours.palette.m3onSecondary; } property color inactiveOnColour: { + if (!toggle && type === TextButton.Filled) + return Colours.palette.m3onPrimary; if (type === TextButton.Text) return Colours.palette.m3primary; return type === TextButton.Filled ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer; diff --git a/modules/bar/popouts/KbLayout.qml b/modules/bar/popouts/KbLayout.qml index 8e5ae8d..b12f2ef 100644 --- a/modules/bar/popouts/KbLayout.qml +++ b/modules/bar/popouts/KbLayout.qml @@ -1,6 +1,28 @@ import qs.components +import qs.components.controls import qs.services +import qs.config +import Quickshell +import QtQuick.Layouts -StyledText { - text: qsTr("Keyboard layout: %1").arg(Hypr.kbLayoutFull) +ColumnLayout { + id: root + + spacing: Appearance.spacing.normal + + StyledText { + Layout.topMargin: Appearance.padding.normal + Layout.rightMargin: Appearance.padding.normal + text: qsTr("Keyboard layout: %1").arg(Hypr.kbLayoutFull) + font.weight: 500 + } + + TextButton { + Layout.bottomMargin: Appearance.padding.normal + Layout.rightMargin: Appearance.padding.normal + Layout.fillWidth: true + + text: qsTr("Switch layout") + onClicked: Quickshell.execDetached(["hyprctl", "switchxkblayout", "all", "next"]) + } } |