hyprwm / hyprlock

Hyprland's GPU-accelerated screen locking utility
BSD 3-Clause "New" or "Revised" License
714 stars 53 forks source link

focus get lost after lock->unlock #347

Closed kaedwen closed 2 months ago

kaedwen commented 3 months ago

Hey, I have observed an annoying thing that after unlocking the machine the focus is nowhere and I can not start typing further. Not sure if this can be fixed somehow, but I think the focus should stay where it was (kind of natural behavior).

So let's say you have a terminal focused, than hyperidle locks the screen, after typing in your password the screen unlocks but you can not type ahead because first you have to move your mouse or use other bindings to bring the focus again to the terminal.

hyprlock 0.3.0

Hyprland, built from branch  at commit cba1ade848feac44b2eda677503900639581c3f4  (props: bump version to 0.40.0).
Date: Sat May 4 15:42:32 2024
Tag: v0.40.0, commits: 4606

flags: (if any)
agentx3 commented 3 months ago

Same. As a janky workaround, I made a wrapper script for hyprlock that contains the following

trap 'hyprctl dispatch focuscurrentorlast; hyprctl dispatch focuscurrentorlast` EXIT
hyprlock <options>
noahgitsham commented 3 months ago

The window doesn't have focus, but weirdly it still has the active_opacity, perhaps this is a bug with Hyprland?

LoneWolf4713 commented 3 months ago

I'm facing this issue too, I can select text let's say in a text editor or a terminal, it's clickable but I cannot type in anything until I switch workspaces, I switch and comeback to workspace and everything starts working. and hey @agentx3 could you pls let me know how to use this script? (still kinda new to linux)

sorathpanzer commented 3 months ago

I'm facing this issue too, I can select text let's say in a text editor or a terminal, it's clickable but I cannot type in anything until I switch workspaces, I switch and comeback to workspace and everything starts working. and hey @agentx3 could you pls let me know how to use this script? (still kinda new to linux)

@LoneWolf4713 I followed the suggestion of @agentx3 and solved the problem, the steps are these: 1-Create within the ~/.local/bin folder, a file with these script: (as an example with the name fixlock)

#!/usr/bin/env bash trap 'hyprctl dispatch focuscurrentorlast; hyprctl dispatch focuscurrentorlast' EXIT hyprlock

2- Open a terminal, and make the file executable:

chmod +x ~/.local/bin/fixlock

3- Than in your hyprland.conf write a keybind for that script. For example

bind=$Mod, BackSpace, exec, fixlock

unifreak commented 2 months ago

Same here. Hope the issue can get fixed soon. The workaround with focuscurrentorlast twice works, but will trigger a switching animation when unlocked, which is not ideal.

PaideiaDilemma commented 2 months ago

I think this is fixed since https://github.com/hyprwm/Hyprland/pull/6423 and can be closed