You are not logged in.

#1 2019-07-21 09:26:11

hills_of_eternity
Member
From: Moscow
Registered: 2017-04-28
Posts: 22
Website

[Solved] How to ignore first key pressed while screen is switched off

Hi, when i leave my PC with SDDM DM without login for some time it switches screen off. When i want to login i pressed Space (or something else) and pressed key instantly placed into password area. How can i ignore key pressed for awaking? Is it SDDM config or xserver?

linux 5.1.16-1-ck

yay -Q sddm xorg-server plasma-meta
sddm 0.18.1-1
xorg-server 1.20.5-2
plasma-meta 5.16-1

Last edited by hills_of_eternity (2019-07-22 10:12:00)

Offline

#2 2019-07-21 09:30:54

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [Solved] How to ignore first key pressed while screen is switched off

How about just pressing a key that doesn't produce a character? ctrl, shift etc...

Or the first letter of your password.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2019-07-21 09:49:29

hills_of_eternity
Member
From: Moscow
Registered: 2017-04-28
Posts: 22
Website

Re: [Solved] How to ignore first key pressed while screen is switched off

Slithery wrote:

How about just pressing a key that doesn't produce a character? ctrl, shift etc...

Or the first letter of your password.

I do it for ages, but my GF doesn't )

Offline

#4 2019-07-21 10:21:52

linux-mate
Banned
Registered: 2018-06-28
Posts: 78

Re: [Solved] How to ignore first key pressed while screen is switched off

"Message" is a required field in this form.

Last edited by linux-mate (2020-01-05 21:57:14)

Offline

#5 2019-07-21 10:34:46

hills_of_eternity
Member
From: Moscow
Registered: 2017-04-28
Posts: 22
Website

Re: [Solved] How to ignore first key pressed while screen is switched off

linux-mate wrote:
hills_of_eternity wrote:
Slithery wrote:

How about just pressing a key that doesn't produce a character? ctrl, shift etc...

Or the first letter of your password.

I do it for ages, but my GF doesn't )

When screen goes off map space key to ctrl for example and map it back to space when screen comes on, or on first press of it. Or teach your GF not to do it wink

sad

Offline

#6 2019-07-21 13:07:15

seth
Member
Registered: 2012-09-03
Posts: 60,795

Re: [Solved] How to ignore first key pressed while screen is switched off

This would have to be provided by the client (SDDM) - at least by checking the DPMS condition, but actually (since the latter is non-deterministic as the tested input will also break DPMS) by disabling the DPMS timers and handling DPMS itself (thus knowing the state)

Assuming SDDM doesn't provide that, you could probably stitch xautolock and "xset dpms force off" along some 

xterm -geometry 0x0 -e 'bash -c "read -n 1"' 

together for some sddm setup script.
No idea whether she's worth that :-P

Offline

#7 2019-07-22 10:11:06

hills_of_eternity
Member
From: Moscow
Registered: 2017-04-28
Posts: 22
Website

Re: [Solved] How to ignore first key pressed while screen is switched off

seth wrote:

This would have to be provided by the client (SDDM) - at least by checking the DPMS condition, but actually (since the latter is non-deterministic as the tested input will also break DPMS) by disabling the DPMS timers and handling DPMS itself (thus knowing the state)

Assuming SDDM doesn't provide that, you could probably stitch xautolock and "xset dpms force off" along some 

xterm -geometry 0x0 -e 'bash -c "read -n 1"' 

together for some sddm setup script.
No idea whether she's worth that :-P

Actually she doesn't smile I figured out that issue is much harder than i expected. Let it be as is.

Offline

#8 2019-07-22 13:07:35

seth
Member
Registered: 2012-09-03
Posts: 60,795

Re: [Solved] How to ignore first key pressed while screen is switched off

You could try on it to improve your skills and just tell her you did it out of love.
Certainly nothing I would have ever done, though… >)

Offline

#9 2024-06-30 16:41:27

jonathan-dd
Member
Registered: 2024-06-30
Posts: 1

Re: [Solved] How to ignore first key pressed while screen is switched off

I know this thread is really old, but it was still the first one I found when looking into this problem. I found a pretty simple solution, at least if you don't want to use a space in your password.

Go to /usr/share/sddm/themes/<YourTheme> and open the Main.qml file. Look for the password input field. In most cases, it should be a TextField or PasswordField with an id like "passwordBox," "passwordField," or something similar. Sometimes it's not in the Main.qml file, but in another file like Login.qml.

Remember to make a backup of the theme before editing it!

Now you can just add:

onTextChanged: {
      passwordBox.text = passwordBox.text.replace(/\s/g, '');
}

It should look something like this:

PlasmaExtras.PasswordField {
            id: passwordBox
            font.pointSize: fontSize + 1
            Layout.fillWidth: true

            onTextChanged: {
                passwordBox.text = passwordBox.text.replace(/\s/g, '');
            }

            placeholderText: i18nd("plasma-desktop-sddm-theme", "Password")
            focus: !showUsernamePrompt || lastUserName

            // Disable reveal password action because SDDM does not have the breeze icon set loaded
            rightActions: []

            onAccepted: {
                if (root.loginScreenUiVisible) {
                    startLogin();
                }
            }
...

I hope this helps a few people who stumble upon this thread like I did.

I'm completely new to this forum. If it isn't allowed to post in old closed threads, please just remove this post.

Last edited by jonathan-dd (2024-06-30 16:48:31)

Offline

#10 2024-06-30 17:02:10

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,323

Re: [Solved] How to ignore first key pressed while screen is switched off

Welcome to the forums.  We generally discourage posting to old threads, unless it is truly relevant.  Sometimes it is a bit grey.  Your solution seems relevant, but I hope the OP is not still having the issue wink

In any event, I am going to use this opportunity to close this old thread.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB