swaylock icon indicating copy to clipboard operation
swaylock copied to clipboard

Unlock the screen on SIGUSR1

Open danieldg opened this issue 2 years ago • 5 comments

When the screen is locked using ext_session_lock, killing swaylock will leave the session locked. This is normally desirable if the kill is due to the OOM killer or swaylock crashing, but can be undesirable if an unlock is desired. This adds a signal handler for SIGTERM if using ext_session_lock without the --disable-unlock-on-sigterm option.

danieldg avatar May 14 '22 18:05 danieldg

Hm, I really don't think we should unlock the screen when the OOM killer kicks in.

An explicit Sway IPC command to unlock the screen would be less dangerous.

emersion avatar May 23 '22 08:05 emersion

The OOM killer generally uses SIGKILL, so it won't trigger this. However, there are other processes that might automatically send SIGTERM; changing the unlock signal to SIGUSR1 would prevent accidental unlocking.

A sway IPC command would be sway-specific; swaylock is usable on other compositors.

danieldg avatar May 23 '22 12:05 danieldg

Right.

Can we document this new behavior in the man page? Maybe under a new SIGNALS section?

What is the use-case for the --disable-unlock-on-sigusr flag?

emersion avatar May 24 '22 16:05 emersion

What is the use-case for the --disable-unlock-on-sigusr flag?

Disabling the feature if it is unwanted. I think this was more relevant when it was on SIGTERM - with SIGUSR1 it's not likely someone will be sending it signals by accident that you would want to disable.

danieldg avatar May 24 '22 22:05 danieldg

Disabling the feature if it is unwanted. I think this was more relevant when it was on SIGTERM - with SIGUSR1 it's not likely someone will be sending it signals by accident that you would want to disable.

I'd prefer to leave that out then if there's no clear use-case -- every CLI flag we add, we can't remove easily without breaking users.

emersion avatar May 25 '22 12:05 emersion

Ping. I find this quite useful.

Nefsen402 avatar Sep 23 '22 22:09 Nefsen402