lahwaacz / sxlock

MIT License
41 stars 21 forks source link

Delayed screenlock on wake up #20

Open ghost opened 6 years ago

ghost commented 6 years ago

I'm using a Lenovo Thinkpad X200 w/ Arch. I installed this via AUR and started and enabled the service you suggested in you README to run sxlock when the pc goes in sleep/hibernation mode and it worked but there is a sensible delay when I wake up the pc. You can literally see the unlocked screen for like 2 seconds and only then the black screen of sxlock appears running as usual thanks to the previously set service. Is this a problem on my end?

lahwaacz commented 6 years ago

Does adding Before=sleep.target to the [Unit] section help?

ghost commented 6 years ago

nope. maybe this is a window manager (i3) problem.. I put my system in sleep mode with Fn + F4. Maybe I should rebind Fn + 4 to run a script that first start the sxlock service and only then put the pc in sleep mode

2017-09-28 17:52 GMT+02:00 Jakub Klinkovský notifications@github.com:

Does adding Before=sleep.target to the [Unit] section help?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lahwaacz/sxlock/issues/20#issuecomment-332880541, or mute the thread https://github.com/notifications/unsubscribe-auth/AKva_QsFFVKw6AbN8gFKMlZsAwVCu1x1ks5sm8CngaJpZM4PnWnw .

lahwaacz commented 6 years ago

Have you run systemctl daemon-reload after editing the service? Do you have other services bound to the sleep/suspend/hibernate targets? Does using Before=suspend.target or Before=hibernate.target instead of the sleep.target help? It has to work somehow. There are also some examples here. Maybe use ExecStartPost=/usr/bin/sleep 1 or something like that as a workaround?

Writing a script won't help because sxlock does not fork itself, it has to keep running in foreground until you unlock the screen. Or maybe the lack of notification to the parent process when the screen is actually locked is the problem. There are delays to grab the keyboard and pointer, but I don't see how that could get into seconds...

ghost commented 6 years ago

Sorry if I reply this late. I tried all the three methods (sleep, suspend, hibernate) and they didn't work. The ExecStartPost didn't work either. I was talking about a script because I can rebind the key that put the pc in sleep mode and redirect to a script that first start sxlock and only then run the command to put the pc in sleep mode

limitedAtonement commented 6 years ago

The way this looks on my system is that the screen flickers perhaps 4 times on wakeup showing the unlocked screen then black alternating before showing the lock screen. My guess is that the graphics card is showing "uninitialized" memory...a different buffer that still has the unlocked desktop on it? I'm thinking the desktop environment (xfce in this case) should take care of clearing graphical memory before going to sleep or before calling the lack command.