diff --git a/Components/LoginForm.qml b/Components/LoginForm.qml index 2283449..ea61438 100644 --- a/Components/LoginForm.qml +++ b/Components/LoginForm.qml @@ -13,9 +13,6 @@ ColumnLayout { property int p: config.ScreenPadding property string a: config.FormPosition - property alias systemButtonVisibility: systemButtons.visible - property alias clockVisibility: clock.visible - property bool virtualKeyboardActive Clock { id: clock @@ -30,7 +27,7 @@ ColumnLayout { Layout.alignment: Qt.AlignVCenter Layout.preferredHeight: root.height / 10 Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 - Layout.topMargin: virtualKeyboardActive ? -height * 1.5 : 0 + Layout.topMargin: 0 } SystemButtons { diff --git a/Main.qml b/Main.qml index 261b4d1..543317b 100644 --- a/Main.qml +++ b/Main.qml @@ -81,25 +81,35 @@ Pane { LoginForm { id: form - height: virtualKeyboard.state == "visible" ? parent.height - virtualKeyboard.implicitHeight : parent.height + height: parent.height width: parent.width / 2.5 anchors.horizontalCenter: config.FormPosition == "center" ? parent.horizontalCenter : undefined anchors.left: config.FormPosition == "left" ? parent.left : undefined anchors.right: config.FormPosition == "right" ? parent.right : undefined - virtualKeyboardActive: virtualKeyboard.state == "visible" ? true : false z: 1 } Button { id: vkb + checkable: true onClicked: virtualKeyboard.switchState() + + Keys.onReturnPressed: { + toggle(); + virtualKeyboard.switchState(); + } + Keys.onEnterPressed: { + toggle(); + virtualKeyboard.switchState(); + } visible: virtualKeyboard.status == Loader.Ready && config.ForceHideVirtualKeyboardButton == "false" anchors.bottom: parent.bottom anchors.bottomMargin: implicitHeight anchors.horizontalCenter: form.horizontalCenter z: 1 contentItem: Text { - text: config.TranslateVirtualKeyboardButton || "Virtual Keyboard" + id: buttonVirtualKeyboard + text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)" color: parent.visualFocus ? palette.highlight : palette.text font.pointSize: root.font.pointSize * 0.8 } @@ -107,6 +117,16 @@ Pane { id: vkbbg color: "transparent" } + states: [ + State { + name: "checked" + when: vkb.checked + PropertyChanges { + target: buttonVirtualKeyboard + text: config.TranslateVirtualKeyboardButtonOn || "Virtual Keyboard (on)" + } + } + ] } Loader { @@ -114,18 +134,14 @@ Pane { source: "Components/VirtualKeyboard.qml" state: "hidden" property bool keyboardActive: item ? item.active : false - onKeyboardActiveChanged: keyboardActive ? state = "visible" : state = "hidden" - width: parent.width + // x * 0.4 = x / 2.5 + width: config.KeyboardSize == "" ? parent.width * 0.4 : parent.width * config.KeyboardSize + anchors.horizontalCenter: parent.horizontalCenter z: 1 - function switchState() { state = state == "hidden" ? "visible" : "hidden" } + function switchState() { state = state == "hidden" ? "visible" : "hidden"} states: [ State { name: "visible" - PropertyChanges { - target: form - systemButtonVisibility: false - clockVisibility: false - } PropertyChanges { target: virtualKeyboard y: root.height - virtualKeyboard.height @@ -186,6 +202,7 @@ Pane { } ScriptAction { script: { + virtualKeyboard.item.activated = false; Qt.inputMethod.hide(); } } diff --git a/Previews/preview5.png b/Previews/preview5.png new file mode 100644 index 0000000..0bc1a03 Binary files /dev/null and b/Previews/preview5.png differ diff --git a/README.md b/README.md index 211f718..6629c11 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,17 @@ Here are some examples: ### Dependencies +#### Arch, Void ```sh -qt6-declarative qt6-svg sddm +sddm qt6-svg +``` +#### Fedora +```sh +sddm qt6-qtsvg +``` +#### OpenSUSE +```sh +sddm-qt6 qt6-svg ``` ### Install @@ -37,6 +46,24 @@ qt6-declarative qt6-svg sddm Current=sddm-astronaut-theme" | sudo tee /etc/sddm.conf ``` + +### Virtual keyboard + +![Preview](./Previews/preview5.png) + +#### Arch +1. Install package. + ```sh + sddm qt6-virtualkeyboard + ``` + +2. Then edit `/etc/sddm.conf.d/virtualkbd.conf`, so that it looks like this: + + ```sh + [General] + InputMethod=qtvirtualkeyboard + ``` + ### Credits Based on the theme [`Sugar Dark for SDDM`](https://github.com/MarianArlt/sddm-sugar-dark) by **MarianArlt**. diff --git a/theme.conf b/theme.conf index 63abefb..9b9efa8 100644 --- a/theme.conf +++ b/theme.conf @@ -78,6 +78,8 @@ FontSize="" HideLoginButton="true" ## Hides login button if set to true. +KeyboardSize="" +## Default 0.4. ## [Interface Behavior] @@ -136,5 +138,6 @@ TranslateSuspend="" TranslateHibernate="" TranslateReboot="" TranslateShutdown="" -TranslateVirtualKeyboardButton="" +TranslateVirtualKeyboardButtonOn="" +TranslateVirtualKeyboardButtonOff="" ## These don't necessarily need to translate anything. You can enter whatever you want here.