owenthewizard / i3lockr

Distort a screenshot and run i3lock
Other
23 stars 6 forks source link

Combine with suspend/hibernate? #2

Closed scrogson closed 5 years ago

scrogson commented 5 years ago

Hi there!

Thanks for creating this project! I'm attempting to use this in place of i3lock but for some reason it doesn't seem to work when combining with commands for suspending and hibernating:

https://github.com/scrogson/dotfiles/blob/master/config/i3/config#L125-L138

It appears that the && systemctl suspend doesn't get run until after I unlock my screen.

I've tried this with i3lockr --invert && systemctl suspend and i3lockr --invert -- --nofork && systemctl suspend and both work as I've described above.

Any ideas how I can fix this?

JohnAZoidberg commented 5 years ago

I remember that I wanted to do that and I think the problem was that I was still pressing the key when the system already wanted to sleep and I woke it up again. If I tapped the suspend key really fast it or I added a sleep statement in between it worked. (Ah, that was not suspending but disabling the screen)

For sleeping I ended up creating a systemd service that suspends the screen whenever I suspend or sleep - no matter how it's triggered:

[Unit]
Before=sleep.target suspend.target
Description=Lock when sleeping or suspending

[Service]
Environment=DISPLAY=:0
ExecStart=/usr/bin/i3lockr
Type=forking
User=myusername
scrogson commented 5 years ago

@JohnAZoidberg nice, thanks. I'll give this a try.

scrogson commented 5 years ago

@owenthewizard this works! Thank you :+1: