From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Peter Baumgarten" Subject: Re: Lock screen gnome Date: Sun, 16 Dec 2018 12:35:21 -0500 Message-ID: References: <95058329-5b45-47d0-ad6a-0b3eb4be65cd@sloti2d2t06> <875zvvsppt.fsf@ngyro.com> <87r2eivz71.fsf@gmail.com> Content-Type: multipart/alternative; boundary=f605d45bd62b4216bf7eb3cacdec14cd Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYaV6-00068a-DL for help-guix@gnu.org; Sun, 16 Dec 2018 12:46:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYaK8-0005AH-P5 for help-guix@gnu.org; Sun, 16 Dec 2018 12:35:32 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:46177) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYaK8-00053W-HC for help-guix@gnu.org; Sun, 16 Dec 2018 12:35:28 -0500 In-Reply-To: <87r2eivz71.fsf@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Timothy Sample , Chris Marusich Cc: help-guix@gnu.org --f605d45bd62b4216bf7eb3cacdec14cd Content-Type: text/plain Thank you both. I'm glad it is not a mistake I did. I would like to fix the GDM bug(s) but right now I do not know scheme nor do I know much about how GDM, X, and Wayland work. I am learning scheme from this book though. https://mitpress.mit.edu/sites/default/files/sicp/index.html On Sun, Dec 16, 2018, at 5:05 AM, Chris Marusich wrote: > Hi Peter and Timothy, > > Timothy Sample 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: > > (services (cons* > (screen-locker-service xscreensaver) > (remove-screen-lockers %desktop-services))) > > 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 > objects) and returns a new list that contains the same > elements, but with the specified kind-to-remove removed." > (lambda (services) > (remove (match-lambda > ((? service? s) > (eq? kind-to-remove (service-kind s)))) > services))) > > (define remove-screen-lockers > (remove-services 'screen-locker)) > > 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 [1], 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 [2] named > ~/.config/autostart/xscreensaver.desktop with the following contents: > > [Desktop Entry] > Version=1.0 > Type=Application > Name=XScreenSaver > Comment=Launch XScreenSaver > Exec=xscreensaver -nosplash > StartupNotify=false > Terminal=false > Hidden=false > > 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! > > Footnotes: > [1] https://www.jwz.org/xscreensaver/faq.html#setuid > > [2] https://specifications.freedesktop.org/autostart-spec/0.5/ > > -- > Chris > --f605d45bd62b4216bf7eb3cacdec14cd Content-Type: text/html Content-Transfer-Encoding: quoted-printable
Thank you both.= I'm glad it is not a mistake I did. I would like to fix the GDM bug(s) = but right now I do not know scheme nor do I know much about how GDM, X, = and Wayland work. I am learning scheme from this book though. https://m= itpress.mit.edu/sites/default/files/sicp/index.html
On Sun, Dec 16, 2018, at 5:05 AM, Chris Marusich wrote:
=
Hi Peter and= Timothy,

Timothy Sample <samplet@ngyro.= com> writes:

> [...] If I want to loc= k 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.&nb= sp; I set it up so that my
screen automatically locks afte= r 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 xs= creensaver:

  (services (cons*
           = ;  (screen-locker-service xscreensaver)
  &= nbsp;          (remove-scre= en-lockers %desktop-services)))

The procedu= re remove-screen-lockers is a custom procedure I've defined
in my OS config file.  Here it is:

&= nbsp; (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."
    (lambda (servi= ces)
      (remove (match-lambda<= br>
         &nbs= p;    ((? service? s)
   &nb= sp;           (eq? kin= d-to-remove (service-kind s))))
    &n= bsp;         services)))

  (define remove-screen-lockers
    (remove-services 'screen-locker))

=
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 i= t (both via the "xscreensaver" program).

Be= cause I also want to be able to manually lock the screen on demand
(via the separate "xscreensaver-command" program), I also insta= ll the
xscreensaver package to my system profile by adding= it to the "packages"
field of my OS declaration.  Yo= u probably don't want to add it to your
user profile, sinc= e if you do that, your user profile's "xscreensaver"
progr= am (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 te= chnically possible
for xscreensaver to function correctly = without being setuid root [1], I
haven't figured out how t= o do it on GuixSD at this time.

Once the xs= creensaver package is installed, I create an alias in my
~= /.bashrc that enables me to lock the screen on demand after
xscreensaver has been started.

  ali= as lk=3D'xscreensaver-command -activate'

Fi= nally, to start xscreensaver automatically when I log into a desktop
=
session, I create an autostart file [2] named
~= /.config/autostart/xscreensaver.desktop with the following contents:
=

  [Desktop Entry]
  Ve= rsion=3D1.0
  Type=3DApplication
 = Name=3DXScreenSaver
  Comment=3DLaunch XScreenSaver<= br>
  Exec=3Dxscreensaver -nosplash
  = StartupNotify=3Dfalse
  Terminal=3Dfalse
  Hidden=3Dfalse

Reconfigure your sy= stem and reboot to verify that it still boots.  To
lo= ck the screen while logged into GNOME or similar, just open a terminal
(e.g., GNOME Terminal) and run lk.  You can also confi= gure xscreensaver
by running xscreensaver-prefs.  Fro= m there, you can configure
xscreenlocker to lock the scree= n after a certain period of idle time.

Anyw= ay, I hope that helps!

Footnotes: 
=
[1]  https://www.jwz.org/xscreensaver/faq.html#setuid

[2]  https://specifications.freedesktop.= org/autostart-spec/0.5/

-- 
<= div>Chris


--f605d45bd62b4216bf7eb3cacdec14cd--