xyb3rt / physlock

Lightweight linux console locking tool
GNU General Public License v2.0
303 stars 36 forks source link

Lock activates as root after waking when used with systemd and manual locking #77

Closed AlexLJordan closed 5 years ago

AlexLJordan commented 5 years ago

Setup: I lock the screen manually with a hotkey (which executes DISPLAY=:0 /usr/local/bin/physlock -ds && sleep 1) AND close my laptops lid. Lid closing tries to activate physlock.service

[Unit]
Description=Lock X session
Before=sleep.target

[Service]
Type=forking
ExecStart=/usr/local/bin/physlock -ds
Restart=on-failure

[Install]
WantedBy=sleep.target

...but fails because physlock(manual) basically froze the whole computer (as i understand it). Laptop also doesn't go to sleep this way, which is annoying.

This wouldn't be a very big problem if, after reopening and entering the password for physlock(manual) and resuming to work, it wouldn't lock the session AGAIN as root because the physlock(systemd) caught up with everything. Then I can't unlock the session, because the root password is not set and have to reboot the computer.

This is a big problem for me right now, because i have some muscle memory for locking the laptop before closing it going on and I only really want the service active to ensure that physlock is executed even if I forget it. I hope I made the problem clear.

I'm looking forward to a solution, please help me!

xyb3rt commented 5 years ago

Sorry, but physlock is designed to run only once.