You are not logged in.

#1 2017-03-31 14:38:22

neutronst4r
Member
Registered: 2016-02-25
Posts: 31

What does logind.conf's 'lock' actually do and where can I change it?

Greetings,
I want to lock my screen whenever I close my laptops lid. I know about login.conf and the "HandleLidSwitch" event. I have set it to 'lock'. It says in the manual:

HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=,
       HandleLidSwitchDocked=
           Controls how logind shall handle the system power and sleep keys and the lid switch to
           trigger actions such as system power-off or suspend. Can be one of "ignore", "poweroff",
           "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", and "lock". If
           "ignore", logind will never handle these keys. If "lock", all running sessions will be
           screen-locked; otherwise, the specified action will be taken in the respective event.
           Only input devices with the "power-switch" udev tag will be watched for key/lid switch
           events.  HandlePowerKey= defaults to "poweroff".  HandleSuspendKey= and HandleLidSwitch=
           default to "suspend".  HandleLidSwitchDocked= defaults to "ignore".  HandleHibernateKey=
           defaults to "hibernate". If the system is inserted in a docking station, or if more than
           one display is connected, the action specified by HandleLidSwitchDocked= occurs;
           otherwise the HandleLidSwitch= action occurs.

           A different application may disable logind's handling of system power and sleep keys and
           the lid switch by taking a low-level inhibitor lock ("handle-power-key",
           "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch"). This is most commonly
           used by graphical desktop environments to take over suspend and hibernation handling, and
           to use their own configuration mechanisms. If a low-level inhibitor lock is taken, logind
           will not take any action when that key or switch is triggered and the Handle*= settings
           are irrelevant.

What does

If 'lock', all running sessions will be screen-locked;[...]

mean? Where is the script/command/service that handles this?
Here is my logind.conf:

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=lock
HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#UserTasksMax=12288

And here is the output of journactl when I open and close the lid. In case you are wondering whether or not systemd actually notices the lid close:

Mar 31 16:23:38 Archy systemd-logind[21591]: Locking sessions...
Mar 31 16:23:38 Archy kernel: psmouse serio2: Touchpad at isa0060/serio2/input0 lost sync at byte 6
Mar 31 16:23:38 Archy kernel: psmouse serio2: issuing reconnect request
Mar 31 16:23:39 Archy kernel: psmouse serio2: Touchpad at isa0060/serio2/input0 lost sync at byte 6
Mar 31 16:23:39 Archy kernel: psmouse serio2: Touchpad at isa0060/serio2/input0 lost sync at byte 6
Mar 31 16:23:39 Archy kernel: psmouse serio2: Touchpad at isa0060/serio2/input0 lost sync at byte 6
Mar 31 16:23:39 Archy kernel: psmouse serio2: Touchpad at isa0060/serio2/input0 lost sync at byte 6
Mar 31 16:23:39 Archy kernel: psmouse serio2: Touchpad at isa0060/serio2/input0 lost sync at byte 6
Mar 31 16:23:39 Archy kernel: psmouse serio2: issuing reconnect request
Mar 31 16:23:39 Archy systemd-logind[21591]: Lid opened.

makepkg not war

Offline

#2 2017-03-31 15:07:33

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: What does logind.conf's 'lock' actually do and where can I change it?

neutronst4r wrote:

Where is the script/command/service that handles this?

logind uses DBus to propagate the "Lock" event (and all the other events, AFAIK) to other processes (if they are listening).

So yes, you'll need an application that listens for those events. Honestly, I only know xss-lock (which I am basing my knowlege on) - it's possible that GDM, SDDM ... etc also interact with logind this way.

I use xss-lock to launch my lock screen as follows:

xset s 300           # auto-lock after 5 minutes
xss-lock xtrlock &   # use xtrlock to lock the screen

Last edited by ayekat (2017-03-31 15:08:26)


pkgshackscfgblag

Offline

#3 2017-03-31 15:09:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,551
Website

Re: What does logind.conf's 'lock' actually do and where can I change it?

This just triggers `loginctl lock-session` which in turn just sends a signal via dbus.

You'd need to have something running that listens for and responds to that signal.  Some screensaver daemons listen for this signal.  Usually some part of the big DE's does.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB