[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lock screen gnome
Re: Lock screen gnome
Sat, 15 Dec 2018 21:05:22 -0800
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Hi Peter and Timothy,
Timothy Sample <address@hidden> writes:
> [...] If I want to lock and suspend, I use the following rather
> unglamorous command:
> $ xlock & (sleep 3; loginctl suspend)
> If anyone has any better advice, I would love to hear it!
I do something similar, but with xscreensaver. I set it up so that my
screen automatically locks after a period of no activity, and also so
that I can manually lock it on demand. Here's how I do it.
First, in my OS configuration file, I replace all screen lockers in
%desktop-services with a screen locker service that uses xscreensaver:
The procedure remove-screen-lockers is a custom procedure I've defined
in my OS config file. Here it is:
(define (remove-services kind-to-remove)
"Return a procedure that accepts a single argument (a list of
<service> objects) and returns a new list that contains the same
elements, but with the specified kind-to-remove removed."
((? service? s)
(eq? kind-to-remove (service-kind s))))
You don't have to remove all the other screen lockers, but I didn't need
them, so I decided to remove them.
This installs specifically the "xscreensaver" program as a setuid-root
program. This makes it possible to manually start the xscreensaver
program and to configure it (both via the "xscreensaver" program).
Because I also want to be able to manually lock the screen on demand
(via the separate "xscreensaver-command" program), I also install the
xscreensaver package to my system profile by adding it to the "packages"
field of my OS declaration. You probably don't want to add it to your
user profile, since if you do that, your user profile's "xscreensaver"
program (which is not setuid-root) will take precedence (via the PATH
environment variable) over the setuid-root "xscreensaver" program
installed in /run/setuid-programs. Although it's technically possible
for xscreensaver to function correctly without being setuid root , I
haven't figured out how to do it on GuixSD at this time.
Once the xscreensaver package is installed, I create an alias in my
~/.bashrc that enables me to lock the screen on demand after
xscreensaver has been started.
alias lk='xscreensaver-command -activate'
Finally, to start xscreensaver automatically when I log into a desktop
session, I create an autostart file  named
~/.config/autostart/xscreensaver.desktop with the following contents:
Reconfigure your system and reboot to verify that it still boots. To
lock the screen while logged into GNOME or similar, just open a terminal
(e.g., GNOME Terminal) and run lk. You can also configure xscreensaver
by running xscreensaver-prefs. From there, you can configure
xscreenlocker to lock the screen after a certain period of idle time.
Anyway, I hope that helps!
Description: PGP signature