Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unlock signal isn't sent to swayidle #363

Closed
Lcchy opened this issue Jun 21, 2024 · 3 comments
Closed

Unlock signal isn't sent to swayidle #363

Lcchy opened this issue Jun 21, 2024 · 3 comments

Comments

@Lcchy
Copy link

Lcchy commented Jun 21, 2024

Hi, thanks for the nice tool!

I would like to execute both a command at session locking and another at session unlocking.

For this I am using swayidle and have it watching for a "lock" and an "unlock" event.
The "lock" signal is well received by swayidle and it executes the command.

But at unlocking swaylock, swayidle does not trigger the "unlock" event.

Meanwhile loginctl unlock-session does trigger the event and command, so the problem seems to be that swaylock does not trigger swayidle at unlock ?

Any help is welcome.

EDIT: I cannot see any error messages in the logs of swaylock and swayidle

@Lcchy
Copy link
Author

Lcchy commented Jun 21, 2024

A few questions I am asking myself:

If swaylock is not designed to trigger logind, how can the swayidle "unlock" event be triggered?

I also found this workaround:
(swaylock; lock.sh) & unlock.sh
This works but is the bash forking as safe as swaylock -f ?
If so, what purpose does the -f flag serve ?

@kennylevinsen
Copy link
Member

Your problem is most likely that you are using swayidle -w without specifying -f to swaylock to daeemonize. swayidle -w blocks completely until the command terminates, but swaylock with -f does not terminate until the screen unlocks.

Either use swayidle -w with swaylock -f, or use swayidle with swaylock (no -w or -f).

If so, what purpose does the -f flag serve ?

       -f, --daemonize
           Detach from the controlling terminal after locking.

           Note: this is the default behavior of i3lock.

If you fork outside swaylock then you do not know if the lock succeeded.

If swaylock is not designed to trigger logind,

swaylock does not talk to logind in any way or form, it's only swayidle that can run arbitrary commands in response to logind events.

@Lcchy
Copy link
Author

Lcchy commented Jun 27, 2024

I see, thanks a lot for your reply!

After trying out different variations I have finally settled to not use dbus logind signals via swayidle events. I just use swayidle for its timeout functionality and have setup my locking and unlocking commands manually which work nicely.

I also saw that this seems to be the way swayidle is headed anyways as there is a discussion to drop logind support.

Thanks again for the help!

@Lcchy Lcchy closed this as completed Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants