Open shroff opened 5 years ago
Digging around with the code, it looks like the modifier key press state gets out of sync when you switch VTs, since the key release events don't get captured. A quick workaround is to press ctrl
to reset state and it works fine after that.
Feel free to close or leave open to track.
Feel free to close or leave open to track.
Let’s not close that, as that’s surely a bug!
Code to detect VT switches could be something like:
int fd;
if ((fd = open("/dev/console", O_NOCTTY)) < 0) {
perror("open");
_exit(-1);
}
for (;;) {
struct vt_event ev;
memset(&ev, 0, sizeof(ev));
ev.event = VT_EVENT_SWITCH;
if (ioctl(fd, VT_WAITEVENT, &ev) < 0) {
perror("ioctl");
_exit(-2);
}
handle_vt_switch(ev.oldev, ev.newev);
}
oldev
is the previous VT, and newev
is the new one, as per https://github.com/torvalds/linux/blob/c0cc271173b2e1c2d8d0ceaef14e4dfa79eefc0d/include/uapi/linux/vt.h#L66-L78
This seems to happen pretty consistently for me, that when I switch to a different VT and back, swaylock seems to start treating
u
asEsc
(clearing input) andd
asreturn
(verifying password) - the reverse is not true. I can only unlock by logging into a different VT and runningkillall -9 swaylock
.Which flags I use don't seem to make a difference as calling
swaylock -f
from a terminal yields a the same result. I have to run with-f
from a terminal since without it,swaylock
crashes withwl_display@1: error 0: invalid object xx
when I log in from a VT;I have also attempted this on another machine and get the same result.
swaylock -v
reports1.3
, butpacman
shows package version1.4.2