mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 22:15:38 -05:00
Add os keyboard to greeter
This commit is contained in:
@@ -11,6 +11,7 @@ import Quickshell.Services.Mpris
|
|||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import qs.Modules.Lock
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -322,6 +323,8 @@ Item {
|
|||||||
TextInput {
|
TextInput {
|
||||||
id: inputField
|
id: inputField
|
||||||
|
|
||||||
|
property bool syncingFromState: false
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: lockIcon.width + Theme.spacingM * 2
|
anchors.leftMargin: lockIcon.width + Theme.spacingM * 2
|
||||||
anchors.rightMargin: {
|
anchors.rightMargin: {
|
||||||
@@ -329,6 +332,9 @@ Item {
|
|||||||
if (GreeterState.showPasswordInput && revealButton.visible) {
|
if (GreeterState.showPasswordInput && revealButton.visible) {
|
||||||
margin += revealButton.width
|
margin += revealButton.width
|
||||||
}
|
}
|
||||||
|
if (virtualKeyboardButton.visible) {
|
||||||
|
margin += virtualKeyboardButton.width
|
||||||
|
}
|
||||||
if (enterButton.visible) {
|
if (enterButton.visible) {
|
||||||
margin += enterButton.width + 2
|
margin += enterButton.width + 2
|
||||||
}
|
}
|
||||||
@@ -338,6 +344,7 @@ Item {
|
|||||||
focus: true
|
focus: true
|
||||||
echoMode: GreeterState.showPasswordInput ? (parent.showPassword ? TextInput.Normal : TextInput.Password) : TextInput.Normal
|
echoMode: GreeterState.showPasswordInput ? (parent.showPassword ? TextInput.Normal : TextInput.Password) : TextInput.Normal
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
|
if (syncingFromState) return
|
||||||
if (GreeterState.showPasswordInput) {
|
if (GreeterState.showPasswordInput) {
|
||||||
GreeterState.passwordBuffer = text
|
GreeterState.passwordBuffer = text
|
||||||
} else {
|
} else {
|
||||||
@@ -355,13 +362,17 @@ Item {
|
|||||||
GreeterState.showPasswordInput = true
|
GreeterState.showPasswordInput = true
|
||||||
PortalService.getGreeterUserProfileImage(GreeterState.username)
|
PortalService.getGreeterUserProfileImage(GreeterState.username)
|
||||||
GreeterState.passwordBuffer = ""
|
GreeterState.passwordBuffer = ""
|
||||||
inputField.text = ""
|
syncingFromState = true
|
||||||
|
text = ""
|
||||||
|
syncingFromState = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
syncingFromState = true
|
||||||
text = GreeterState.showPasswordInput ? GreeterState.passwordBuffer : GreeterState.usernameInput
|
text = GreeterState.showPasswordInput ? GreeterState.passwordBuffer : GreeterState.usernameInput
|
||||||
|
syncingFromState = false
|
||||||
if (isPrimaryScreen)
|
if (isPrimaryScreen)
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
}
|
}
|
||||||
@@ -371,12 +382,18 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeyboardController {
|
||||||
|
id: keyboard_controller
|
||||||
|
target: inputField
|
||||||
|
rootObject: root
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
id: placeholder
|
id: placeholder
|
||||||
|
|
||||||
anchors.left: lockIcon.right
|
anchors.left: lockIcon.right
|
||||||
anchors.leftMargin: Theme.spacingM
|
anchors.leftMargin: Theme.spacingM
|
||||||
anchors.right: (GreeterState.showPasswordInput && revealButton.visible ? revealButton.left : (enterButton.visible ? enterButton.left : parent.right))
|
anchors.right: (GreeterState.showPasswordInput && revealButton.visible ? revealButton.left : (virtualKeyboardButton.visible ? virtualKeyboardButton.left : (enterButton.visible ? enterButton.left : parent.right)))
|
||||||
anchors.rightMargin: 2
|
anchors.rightMargin: 2
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: {
|
text: {
|
||||||
@@ -413,7 +430,7 @@ Item {
|
|||||||
StyledText {
|
StyledText {
|
||||||
anchors.left: lockIcon.right
|
anchors.left: lockIcon.right
|
||||||
anchors.leftMargin: Theme.spacingM
|
anchors.leftMargin: Theme.spacingM
|
||||||
anchors.right: (GreeterState.showPasswordInput && revealButton.visible ? revealButton.left : (enterButton.visible ? enterButton.left : parent.right))
|
anchors.right: (GreeterState.showPasswordInput && revealButton.visible ? revealButton.left : (virtualKeyboardButton.visible ? virtualKeyboardButton.left : (enterButton.visible ? enterButton.left : parent.right)))
|
||||||
anchors.rightMargin: 2
|
anchors.rightMargin: 2
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: {
|
text: {
|
||||||
@@ -441,8 +458,8 @@ Item {
|
|||||||
DankActionButton {
|
DankActionButton {
|
||||||
id: revealButton
|
id: revealButton
|
||||||
|
|
||||||
anchors.right: enterButton.visible ? enterButton.left : parent.right
|
anchors.right: virtualKeyboardButton.visible ? virtualKeyboardButton.left : (enterButton.visible ? enterButton.left : parent.right)
|
||||||
anchors.rightMargin: enterButton.visible ? 0 : Theme.spacingS
|
anchors.rightMargin: 0
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
iconName: parent.showPassword ? "visibility_off" : "visibility"
|
iconName: parent.showPassword ? "visibility_off" : "visibility"
|
||||||
buttonSize: 32
|
buttonSize: 32
|
||||||
@@ -450,6 +467,24 @@ Item {
|
|||||||
enabled: visible
|
enabled: visible
|
||||||
onClicked: parent.showPassword = !parent.showPassword
|
onClicked: parent.showPassword = !parent.showPassword
|
||||||
}
|
}
|
||||||
|
DankActionButton {
|
||||||
|
id: virtualKeyboardButton
|
||||||
|
|
||||||
|
anchors.right: enterButton.visible ? enterButton.left : parent.right
|
||||||
|
anchors.rightMargin: enterButton.visible ? 0 : Theme.spacingS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
iconName: "keyboard"
|
||||||
|
buttonSize: 32
|
||||||
|
visible: Greetd.state === GreetdState.Inactive && !GreeterState.unlocking
|
||||||
|
enabled: visible
|
||||||
|
onClicked: {
|
||||||
|
if (keyboard_controller.isKeyboardActive) {
|
||||||
|
keyboard_controller.hide()
|
||||||
|
} else {
|
||||||
|
keyboard_controller.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
id: enterButton
|
id: enterButton
|
||||||
|
|||||||
Reference in New Issue
Block a user