Smartcard Lock for GNOME is a GNOME Shell Extension I wrote that immediately locks the screen if a smartcard is removed.

You can install it at and check out the code and an action shot video here.

I hope you’ll find it as useful as it is for me.


I was inspired by a Fedora Magazine article on using Yubikeys which uses udev rules in order to lock the screen.

But I not only found that a bit clumsy, it actually became a small hell as using pam_yubico triggers the event that’s used very frequently… so no, that wouldn’t do.

Also, since it’s “hardcoded” to GNOME, why not just make it an extension? So that’s the full story.