hyprlock icon indicating copy to clipboard operation
hyprlock copied to clipboard

Can't type after resuming from suspend

Open lucasreis1 opened this issue 1 year ago • 54 comments

I'm using hypridle to trigger hyprlock before suspending. After resuming, I can move my mouse and the clock updates, which signals that hypridle is working fine, but keyboard input won't work in the password box.

hypridle.conf:

general {
  before_sleep_cmd = WAYLAND_DEBUG=1 ~/.config/hypr/scripts/lock.sh &> /tmp/hyprlock_out.txt
  after_sleep_cmd = ~/.config/hypr/scripts/wp_init.sh -r
}

listener {
  timeout = 600
  on-timeout = ~/.config/hypr/scripts/lock.sh --dimfirst
}

listener {
  timeout = 720
  on-timeout = hyprctl dispatch dpms off
}

lock.sh:

#/bin/bash

WALLPAPER_DIR=~/Pictures/wallpapers/blurred
CURRENT_WALL=$(wpg -c)


EXTENSION="${CURRENT_WALL##*.}"
# for gifs, replace fframe with the gif.
# also, remember they are stored in the subfolder "animated"
if [[ "$EXTENSION" =~ fframe.*$ ]]; then
  CURRENT_WALL=${CURRENT_WALL%.*}.png
fi

IMG="$WALLPAPER_DIR/$CURRENT_WALL"

if [ ! -f $IMG ];
then
  IMG=$(ls $WALLPAPER_DIR/* | shuf | head -n 1)
fi
cp $IMG /tmp/hyprlock.png
#swaylock -f -i $IMG
if [ "$1" == "--dimfirst" ]
then
  chayang -d 10 && hyprlock 
else
  hyprlock
fi

hyprland.log:

[LOG] Instance Signature: 29cdd7de1f8d99462915540569fbe54f10f609f4_1709181372
[LOG] Hyprland PID: 396621
[LOG] ===== SYSTEM INFO: =====
[LOG] System name: Linux
[LOG] Node name: lucas
[LOG] Release: 6.7.6-arch1-1
[LOG] Version: #1 SMP PREEMPT_DYNAMIC Fri, 23 Feb 2024 16:31:48 +0000


[LOG] GPU information:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA104 [GeForce RTX 3070 Lite Hash Rate] [10de:2488] (rev a1) (prog-if 00 [VGA controller])


[WARN] Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.

[LOG] os-release:
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo

[LOG] ========================



[INFO] If you are crashing, or encounter any bugs, please consult https://wiki.hyprland.org/Crashes-and-Bugs/


[LOG] 
Current splash: Take on me, take me on...


[LOG] Creating the HookSystem!
[LOG] Creating the KeybindManager!
[LOG] [hookSystem] New hook event registered: configReloaded
[LOG] Creating the AnimationManager!
[LOG] Created a bezier curve, baked 255 points, mem usage: 4.08kB, time to bake: 25.07µs. Estimated average calc time: 0.14µs.
[LOG] Creating the ConfigManager!
[LOG] NOTE: further logs to stdout / logfile are disabled by default. Use debug:disable_logs and debug:enable_stdout_logs to override this.
[LOG] Created a bezier curve, baked 255 points, mem usage: 4.08kB, time to bake: 10.90µs. Estimated average calc time: 0.14µs.
[LOG] Using config: /home/lucas/.config/hypr/hyprland.conf

hyprlock_out.txt

lucasreis1 avatar Feb 29 '24 15:02 lucasreis1

I've the same issue, after suspend I cannot type my password anymore...

LeGmask avatar Feb 29 '24 21:02 LeGmask

same here

ArvineKwok avatar Mar 01 '24 14:03 ArvineKwok

Same issue here

MathisP75 avatar Mar 01 '24 20:03 MathisP75

I would like to add that for me, the textbox types 3 dots for each character typed after waking from suspend.

harshkhandeparkar avatar Mar 02 '24 07:03 harshkhandeparkar

I would like to add that for me, the textbox types 3 dots for each character typed after waking from suspend.

this is fixed. build from source...

FearlessSpiff avatar Mar 03 '24 08:03 FearlessSpiff

bump

dtk9289 avatar Mar 08 '24 12:03 dtk9289

I'm sorry but why is this closed as completed? I'm still experiencing the issue on latest git for hyprland, hypridle and hyprlock.

lucasreis1 avatar Mar 09 '24 04:03 lucasreis1

I assumed "this is fixed" and 3 likes meant this is fixed. Are you sure you're on latest git? no duplicate binaries?

vaxerski avatar Mar 09 '24 04:03 vaxerski

I can also confirm that I had this issue on the latest git this morning when I woke up to wake up my computer from sleep. It wouldn't take in any input, also if I remember correctly, the mouse cursor was also showing which isn't supposed to be showing.

However, after this issue was closed, I looked around at other issues and ran across #76. In that issue it was mentioned that the crashing only occurs when running systemctl suspend from a terminal and not when ran by hypridle. So far today, after making that change (and updating to the latest commit this morning b4a1c8c, I haven't had this issue. But I also haven't went to sleep overnight again. I will update hyprlock again before bed tonight to the latest git and test this again.

I think the "this is fixed" was referring to a side tangent of "the textbox types 3 dots for each character typed after waking from suspend" which isn't what it looks like the first post was talking about.

sefodopo avatar Mar 09 '24 04:03 sefodopo

I assumed "this is fixed" and 3 likes meant this is fixed. Are you sure you're on latest git? no duplicate binaries?

I'm pretty sure he was replying to the person who pointed to another adjacent issue (typing three dots for each character). The original problem from suspending is still present here.

lucasreis1 avatar Mar 09 '24 05:03 lucasreis1

In that issue it was mentioned that the crashing only occurs when running systemctl suspend from a terminal and not when ran by hypridle

Can you clarify what running "suspending by hypridle" means? The only way I was aware of running suspend without writing to system files is directly from systemd.

lucasreis1 avatar Mar 09 '24 05:03 lucasreis1

So if I run systemctl suspend from kitty, then go to sleep while using hypridle with lock_cmd = pidof hyprlock || hyprlock and before_sleep_cmd = loginctl lock-session, Hyprlock won't let me input any text in the morning when I wake up and wake my computer.

On the other hand if I add a listener in hypridle to on-timeout = systemctl suspend and wait for my computer to go to sleep (instead of manually running systemctl suspend, I was unable to recreate this bug. Hyprlock worked correctly upon waking up. Also, hyprlock seemed to work okay when I did hyprctl keyword exec systemctl suspend. Granted, I haven't tested any of these other methods overnight. It may take time to cause the issue, or the latest commits late last night or early this morning fixed this bug.

I also did a quick test earlier today running systemctl suspend from kitty, and then immediately waking the computer up within a minute, and hyprlock worked correctly. So either the latest commits fixed it, or it takes all night for an issue to appear.

sefodopo avatar Mar 09 '24 06:03 sefodopo

I assumed "this is fixed" and 3 likes meant this is fixed. Are you sure you're on latest git? no duplicate binaries?

I'm pretty sure he was replying to the person who pointed to another adjacent issue (typing three dots for each character). The original problem from suspending is still present here.

Yes. The three dots is fixed. The other problem I don't know. Never a good idea to add other issues in an issue.

FearlessSpiff avatar Mar 09 '24 08:03 FearlessSpiff

I can replicate what @sefodopo described, on NixOS on e9a57f0dae1dfa02240040f5975d048175440c2c commit.

hakan-demirli avatar Mar 09 '24 09:03 hakan-demirli

So I suspect, that hypridle is running multiple times for you guys. That way I was able to reproduce it (happened to myself by accident, because in nix you don't have to exec it since hypridle starts when services.hypridle.enable = true).

That would cause hyprlock to be launched twice and one instance would receive the finished event which would lock it up.

PaideiaDilemma avatar Mar 10 '24 13:03 PaideiaDilemma

So, a simple solution would be running pidoff hyprlock inside hyprlock when it is first launched to detect if anyother hyprlock instance is running and then exit if it is?

PS: I do not use the home-manager module/service. I just add pkgs.hyprlock+ override src and lock my screen using a lockscreen key.

hakan-demirli avatar Mar 10 '24 14:03 hakan-demirli

You could try this patch and see if you are still able to repro. patch.txt

PaideiaDilemma avatar Mar 10 '24 14:03 PaideiaDilemma

I've tried the patch and the issue persists. But oddly enough running ps -aux --forest on another tty shows that indeed, the before-sleep command is being called more than one, even if hyprlock is called only once:

lucas     914040  0.0  0.0   7520  3712 tty2     S+   13:55   0:00 /bin/sh -c WAYLAND_DEBUG=1 ~/.config/hypr/scripts/lock.sh &> /tmp/hyprlock_out.txt
lucas     914041  0.0  0.0   7520  2304 tty2     S+   13:55   0:00  \_ /bin/sh -c WAYLAND_DEBUG=1 ~/.config/hypr/scripts/lock.sh &> /tmp/hyprlock_out.txt
lucas     914065  0.4  0.4 905528 160056 tty2    Sl+  13:55   0:00      \_ /tmp/tmp.xMscfB99bP/hyprlock/build/hyprlock

lucasreis1 avatar Mar 10 '24 18:03 lucasreis1

If your before_sleep script gets called twice shouldn't hyprlock get called twice as well?

PaideiaDilemma avatar Mar 10 '24 18:03 PaideiaDilemma

There is probably also something else going on. If you start it with pidof hyprlock || hyprlock it should be fine. I just got a bug where hyprlock stops accepting input after suspend, but after a few seconds it started to work again.

PaideiaDilemma avatar Mar 10 '24 19:03 PaideiaDilemma

Upon further investigation, spawning an identical child seems to be a perk of the way hypridle runs execl and pipe redirection when running under shell scripts (i.e. this only happens when before_sleep_cmd is a shell script that redirects its output).

if I do

before_sleep_cmd = hyprlock

I don't see two processes with the same input when running ps aux --forest, but the problem of being unable to type after suspend on hyprlock persists.

I just got a bug where hyprlock stops accepting input after suspend, but after a few seconds it started to work again.

I can't replicate this. I can wait as long as I want, I cannot type if I resume from suspend. If I could take a wild guess, I'd say nvidia is to blame here.

lucasreis1 avatar Mar 11 '24 15:03 lucasreis1

If I could take a wild guess, I'd say nvidia is to blame here.

Non nvidia user here with the same problem. But other NixOs users have a similar problem with swaylock and swayidle. https://github.com/swaywm/swaylock/issues/344

So I suspect, that hypridle is running multiple times for you guys. That way I was able to reproduce it (happened to myself by accident, because in nix you don't have to exec it since hypridle starts when services.hypridle.enable = true).

I searched NixOs options unstable and couldn't find it. Where is that service?

Cody-W-Tucker avatar Mar 13 '24 22:03 Cody-W-Tucker

Where is that service?

The option is in the hm-module contained in this repo :)

As described in #190 I ran into this issue. Not sure if that fixes it but we will see.

But it is good to check that there aren't multiple hyprlock instances running. Can lead to similar symptoms.

PaideiaDilemma avatar Mar 14 '24 00:03 PaideiaDilemma

Where is that service?

The option is in the hm-module contained in this repo :)

That's really cool, how can I use it? Is it with a flake?

Cody-W-Tucker avatar Mar 14 '24 02:03 Cody-W-Tucker

Where is that service?

The option is in the hm-module contained in this repo :)

That's really cool, how can I use it? Is it with a flake?

Yup. You add inputs.hyprlock.url = "github:hyprwm/hyprlock"; to your flake, then add inputs.hyprlock.homeManagerModules.default to your HM's imports list.

fufexan avatar Mar 14 '24 08:03 fufexan

happened again to me, but I don't see anything wrong in hyprlock when it happens.

PaideiaDilemma avatar Mar 15 '24 16:03 PaideiaDilemma

I am still facing this issue on the latest git

MathisP75 avatar Mar 19 '24 17:03 MathisP75

patch.txt try this

vaxerski avatar Mar 19 '24 19:03 vaxerski

error: src/managers/input/InputManager.cpp: No such file or directory Where even is InputManager.cpp?

MathisP75 avatar Mar 19 '24 23:03 MathisP75

thats hyprland

vaxerski avatar Mar 20 '24 01:03 vaxerski