You are not logged in.

#1 2015-01-03 17:39:06

ldelossa
Member
Registered: 2015-01-03
Posts: 2

Light-DM Lock on Hibernate

Hey guys,

I'm trying to get my new Linux Arch build on a x1 carbon (2nd gen) to lock the screen just before it attempts to hibernate. I tried this many difference ways. One being acpid - which I find to be very flackey. I have since removed the ACPID package and I'm hibernating using logind hook in /etc/systemd/logind.conf

I've attempted to go even as far as adding another execstart statement into the systemd-hibernate.service file in /usr/lib/systemd/system directory. This ran the dm-tool lock command, however it ran it as what I'm assuming is the root session, which then the tool complains that there is no display manager. I don't see a way to tell dm-tool to run the lock command in a different tty or session.

I was also thinking about a way to run a script in systemd-hibernate.service that will then run dm-tool lock in my user session, or any available user session if the script can enumerate this.

My instinct is that editing the systemd-hibernate.service file is not the best way to go here, as it's a systemd specific file and just feels wrong lol.

Any suggestions?

Last edited by ldelossa (2015-01-03 17:43:59)

Offline

#2 2015-01-03 17:53:47

progandy
Member
Registered: 2012-05-17
Posts: 5,280

Re: Light-DM Lock on Hibernate

I believe Light DM works well with the logind session API, so I guess you should use a user session lock manager that listens for the systemd lock, unlock and hibernate events like xss-lock. Desktop environments like gnome, kde and mate should come with its own screensaver/locker mechanism.
With xss-lock you can then run a screenlocker like xlock to make the session inaccessible and use dm-tool to switch to the greeter. When you unlock your session in the greeter, xss-lock should receive a systemd unlock event and kill the locker.
Edit: I can't test it since I use slim now, I didn't need all that fancy stuff from lightdm.

Last edited by progandy (2015-01-03 17:56:09)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2015-01-03 18:18:01

ldelossa
Member
Registered: 2015-01-03
Posts: 2

Re: Light-DM Lock on Hibernate

Very interesting, I do like light-dm however I'm not completely opposed to switching to another DM, if it means there's less CPU/actual time taken to hibernate and lock the machine.

So if I understand you correctly, you are saying use xss-lock to notify light-dm that a acpi event has taken place (lid shut). xss-lock will lock my user session, and then send a notification to light-dm to lock the desktop? Unlocking my session via light-dm will then send a notification to xss-lock and that will unlock the user session?

Do I have a correct understanding?

Last edited by ldelossa (2015-01-03 18:18:28)

Offline

#4 2015-01-22 07:20:08

pszafer
Member
Registered: 2015-01-22
Posts: 39

Re: Light-DM Lock on Hibernate

Hello,
I think that I can help you with that:
- create lockscreen.sh file somewhere in your home directory with:

#!/bin/sh
XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0" dm-tool lock

- I've prefer just for sure creating dmlock.service file in home dir and create symlink to /etc/systemd/system.
File has to be in /etc/systemd/system/dmlock.service

[Unit]
Description=DM Lock before sleep
Before=sleep.target

[Service]
ExecStart=/home/user/dir/lockscreen.sh

[Install]
WantedBy=sleep.target

For your needs, you probably need hibernate.target.

Next run following commands:

systemctl daemon-reload
systemctl enable dmlock.service

Just for sure it is working you could run:

systemctl list-unit-files
systemctl start dmlock.service

Hope it helps you a little

Offline

#5 2015-01-22 09:59:17

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: Light-DM Lock on Hibernate

I've never got it working myself, but you could try lightlocker which was specifically written for lightdm.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

Board footer

Powered by FluxBB