Lock the computer when key removed

I saw an article about how to have my computer lock itself (gnone) when the Librem key is removed. Has anyone here been able to accomplish this?

1 Like

If someone who’s done this could post some easy to understand steps for the less savvy members like me, you’d be a real hero. I’ve wanted to get this set up for a while and haven’t had much success.

1 Like

Have a look here

1 Like

The explanations are not very clear to me. What I’m I supposed to do with those two files?

I would guess

  • download each file
  • put each file in its respective directory (as given at the top of the article)
  • restart (either the service using the command shown in the article, although I would guess it needs sudo in front of the command, or the whole computer)
1 Like

i’m sorry but which directory are you refering to ?

@kieran already gave the correct answer. However, if you are just getting started with Linux then check out the following links:

  1. https://linuxhandbook.com/linux-directory-structure/
  2. https://www.togaware.com/linux/survivor/ - in particular, look at the “Basic Administration” section, especially the “File system”.
1 Like

In Terminal:

sudo nano /etc/udev/rules.d/85-libremkey.rules

Paste this:

ACTION=="remove", ENV{PRODUCT}=="316d/4c4b/101" RUN+="/usr/local/bin/gnome-screensaver-lock"

Type: CTRL X Y

sudo nano /usr/local/bin/gnome-screensaver-lock

Paste Content of the screensaver-lock file (see link above)

Type: CTRL X Y

systemctl restart udev

This feature does not work for me with the two mentioned files, but I got it working by changing the udev rule to

ACTION=="remove", KERNELS=="0003:20A0:4108*", SUBSYSTEMS=="hid", RUN+="/usr/local/bin/gnome-screensaver-lock"

after having fiddled with udev man page and udevadm commands (mostly monitor and info -a). I hope the KERNELS prefix value I use in this rule is not specific to my particular device; it looks like the second number is the vendor ID, and the third the product ID. I ordered my Librem key in February 2019.