swaywm / swaylock

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

Unlock the screen on SIGUSR1 #237

Closed danieldg closed 2 years ago

danieldg commented 2 years ago

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.

emersion commented 2 years ago

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.

danieldg commented 2 years ago

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.

emersion commented 2 years ago

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?

danieldg commented 2 years ago

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.

emersion commented 2 years ago

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.

Nefsen402 commented 2 years ago

Ping. I find this quite useful.