From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: Lock screen gnome Date: Sat, 15 Dec 2018 21:05:22 -0800 Message-ID: <87r2eivz71.fsf@gmail.com> References: <95058329-5b45-47d0-ad6a-0b3eb4be65cd@sloti2d2t06> <875zvvsppt.fsf@ngyro.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYOfx-0002um-Nm for help-guix@gnu.org; Sun, 16 Dec 2018 00:09:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYOcK-0001WQ-OF for help-guix@gnu.org; Sun, 16 Dec 2018 00:05:29 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:34096) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gYOcK-0001W4-Hd for help-guix@gnu.org; Sun, 16 Dec 2018 00:05:28 -0500 Received: by mail-pl1-x631.google.com with SMTP id w4so4592570plz.1 for ; Sat, 15 Dec 2018 21:05:28 -0800 (PST) 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: Peter Baumgarten , Timothy Sample Cc: help-guix@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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=3D'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=3D1.0 Type=3DApplication Name=3DXScreenSaver Comment=3DLaunch XScreenSaver Exec=3Dxscreensaver -nosplash StartupNotify=3Dfalse Terminal=3Dfalse Hidden=3Dfalse 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:=20 [1] https://www.jwz.org/xscreensaver/faq.html#setuid [2] https://specifications.freedesktop.org/autostart-spec/0.5/ =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlwV3RIACgkQ3UCaFdgi Rp3l6BAAtxr4HKSwhqc/+fm7alkjahZbOVxZYm3rU167td2VqdvYD9lI+A94Wsuj nrWzWg/cfUqaGvCH4wh6fJMBrDUKj9BXvBPieWzbJLZDwKcCNTT4qxm/uiVCKjkh 4CXcTQT4a4fHD29Px1svMxyR4PHPcyADK7lOoskeI9VcrNH7n3EpjQwhA8QYbVb3 l3/5+cnAStvTyrbgEKWO903e6rU5mnKGFjauqjuYQH5ixQX2IMqSR3DtZbxWlJdA B7kfp1Zk000D+ZwuDAI0roPQ9XJYMRnBn9hQxgEzrBQbZr5naCmbj4f4bmHWh5gT W3qcyyVdJhUjSLcM/3NLULGH3BqV7Tq6lNkTpkSB4wqvtnOBhamZSAddLLxfqP2z M8W+P6zNkfggwsSXL55mTbbsRxv5ajUf3CLofEselLTTtjZu4GBt9ALDdpCAXhw2 sfP+uH8FXlMWyK58g3d4tFEczhtKArcb4bfEiEOIfzfT4krEf6UYoFvMHDNMrTrT d6B2BRRsq4XVGpLXdw9lPLHCsG39SdQdkbEjp5l/57Ume2qi0fDlki7YNAH4PYMn /MyfEqY2jO6DLvOAW0nURtK9guhpEZ2DIxda6O7ileEl4JifmpkM7BsUu+0Fd4NN do2nfDJaIl+rxeSKebwhRXGJ1GcgPPsk4XMuAq6p+TUcOwemREI= =Xg+W -----END PGP SIGNATURE----- --=-=-=--