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>
This commit is contained in:
AleksElixir 2025-09-23 12:31:36 +03:00 committed by GitHub
parent 21e1efd944
commit 50ef4871c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 3 deletions

View file

@ -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;

View file

@ -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"])
}
}