swaywm / swaylock

Screen locker for Wayland
MIT License
851 stars 202 forks source link

Garbage characters already present in place of password after waking up from sleep mode #306

Open AbheetChaudhary opened 1 year ago

AbheetChaudhary commented 1 year ago

I have noticed it happen multiple times that after waking up from sleep, before I type my password I have to first hold backspace to clear some garbage value that is already typed there. It can be anything from 2-3 characters to 2-3 words size garbage.

I am currently using swaylock version v1.6.11. This is the script I am using to lock screen and I have mapped it to a keybinging in sway config file.

#!/bin/sh
# Times the screen off and puts it to background
swayidle \
    timeout 10 'swaymsg "output * dpms off"' \
    resume 'swaymsg "output * dpms on"' \
    timeout 60 'systemctl suspend ' &
# Locks the screen immediately
swaylock --clock --indicator --effect-scale 0.4 --effect-vignette 0.2:0.5 --effect-blur 4x2 --datestr "%a %e.%m.%Y" --timestr "%k:%M" --ignore-empty-password --show-failed-attempts --indicator-caps-lock -i ~/.config/lockscreen-wall.jpg --indicator-radius 75 --indicator-thickness=15
# Kills last background task so idle timer doesn't keep running
kill %%

Since I do not know how to approach debugging this issue so this is the best I can provide now, but I am happy to share any info or log that might be needed to fix this.

crimsonknave commented 5 months ago

On one of my machines every time my machine wakes from suspend there appears to be a single character already typed.

I'm using swaylock version 1.7.2

swaylock -f;systemctl suspend consistently reproduces this for me.

I'd be happy to debug this, I'm just not sure how. Not sure if it makes it easier to debug given it's consistent in how it manifests for me.

kennylevinsen commented 5 months ago

If you run sudo libinput debug-events --show-keycodes in the background while testing you would be able to see what keyboard events appear and from what keyboard device. Note that this also shows every key you press, including your password.

The-Toblin commented 4 months ago

I ran the libinput command and parsed the output. There were no registered input events between the screen locking and me entering my password, and it did still not recognize my password. Double-checking, there is one "garbage" character entered before my password.

Basically, the screen locks, 5 seconds later, the screen is turned off via the swaylock command (referenced below). When the screen is dark, I return and either wiggle the mouse to wake the screen up, or I just start typing my password. If I do that and press backspace, ONE character will be removed and then the message "Cleared" is shown. If I type the first letter of my password and then press backspace, it will not say "cleared", as the garbage character is still there.

And, as per the libinput test, there is no event associated with this character, so it must come from elsewhere. I don't know from where, however. I'm not super-convinced it's from swaylock, but it could be. The input could also be coming from my swayidle/swaylock command itself (which does not trigger libinput, since it's not coming from any input device).

My swaylock entry in config:

exec swayidle -w \
         timeout 600 'swaylock -f -c 000000' \
         timeout 605 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
         before-sleep 'swaylock -f -c 000000'