Skip to main content
cinnamon-udev-locker
====================

.. image:: https://img.shields.io/pypi/v/cinnamon-udev-locker.svg
:target: https://pypi.python.org/pypi/cinnamon-udev-locker
:alt: Latest PyPI version

.. image:: https://travis-ci.org/fladi/cinnamon-udev-locker.png
:target: https://travis-ci.org/fladi/cinnamon-udev-locker
:alt: Latest Travis CI build status

Lock Cinnamon desktop session through device status (i.e YubiKey)

Usage
-----

Run in INIT mode with an empty YAML configuration:

> touch ~/.config/cinnamon-udev-locker/config.yml
> cinnamon-udev-locker --init

This will print out all available properties for a UDev event. With a YubiKey
just plug it in after executing the above steps and it will output something
like this:

add:
* ACTION: add
* BUSNUM: 003
* DEVNAME: /dev/bus/usb/003/030
* DEVNUM: 030
* DEVPATH: /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1.1
* DEVTYPE: usb_device
* DRIVER: usb
* ID_BUS: usb
* ID_FOR_SEAT: usb-pci-0000_00_14_0-usb-0_1_1
* ID_MODEL: Yubikey_4_U2F+CCID
* ID_MODEL_ENC: Yubikey\x204\x20U2F+CCID
* ID_MODEL_FROM_DATABASE: Yubikey 4 U2F+CCID
* ID_MODEL_ID: 0406
* ID_PATH: pci-0000:00:14.0-usb-0:1.1
* ID_PATH_TAG: pci-0000_00_14_0-usb-0_1_1
* ID_REVISION: 0427
* ID_SERIAL: Yubico_Yubikey_4_U2F+CCID
* ID_SMARTCARD_READER: 1
* ID_SMARTCARD_READER_DRIVER: gnupg
* ID_USB_INTERFACES: :030000:0b0000:
* ID_VENDOR: Yubico
* ID_VENDOR_ENC: Yubico
* ID_VENDOR_FROM_DATABASE: Yubico.com
* ID_VENDOR_ID: 1050
* MAJOR: 189
* MINOR: 285
* PRODUCT: 1050/406/427
* SEQNUM: 3746
* SUBSYSTEM: usb
* SYSTEMD_WANTS: smartcard.target
* TAGS: :uaccess:systemd:seat:
* TYPE: 0/0/0
* USEC_INITIALIZED: 359396531717

You can now create rules in the config file based on the above attributes and
their values. Values are matched against regular expressions to provide more
felxibility.

To have the screen locked when a YubiKey is disconnected and
to activate the password prompt to unlock the screen once it is reconnected, use
the following rule in `~/.config/cinnamon-udev-locker/config.yml`:

---
- devices:
- ID_VENDOR: ^Yubico$
ID_MODEL: ^Yubikey.*
add: wakeup
remove: lock

It is possible to define more than one rule with different behaviours. To have a
second device that only activates the password prompt on connect but does not
lock the screen on disconnect just append to the YAML list of rules:

---
- devices:
- ID_VENDOR: ^Yubico$
ID_MODEL: ^Yubikey.*
add: wakeup
remove: lock
- devices:
- ID_VENDOR: ^ACME$
ID_MODEL_FROM_DATABASE: ^Detonator$
add: wakeup

Afterwards make sure to have `cinnamon-udev-locker` automatically started for
your Cinnamon session.

Installation
------------

pip install cinnamon-udev-locker

Requirements
^^^^^^^^^^^^

* click
* click-log
* pygobject
* pyxdg

Compatibility
-------------

This script was written for Python3 only.

Licence
-------

Published under MIT/Expat license.

Authors
-------

`cinnamon-udev-locker` was written by `Michael Fladischer <michael@fladi.at>`_.


Metadata

Release files for cinnamon-udev-locker 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cinnamon-udev-locker 0.1.0
File Size Uploaded
cinnamon-udev-locker-0.1.0.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cinnamon-udev-locker 0.1.0
File Interpreter ABI Platform
cinnamon_udev_locker-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / cinnamon-udev-locker-0.1.0.tar.gz

Download URL cinnamon-udev-locker-0.1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6d3464d052e46305e1180454cc27e95b285fdc25538af36bf15ffcccb9d83470
BLAKE2b-256 checksum
How to use checksums
ff5cac0b97ea93aa0c24d241e763e8710fad61f07d24993ee0ad4902b9ad3bcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cinnamon_udev_locker-0.1.0-py3-none-any.whl

Download URL cinnamon_udev_locker-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6562cc070e0997db345f05220af6331c7c567978941e1cfd22a4925956ca3fd3
BLAKE2b-256 checksum
How to use checksums
43ca161d586aa4320ef7aa927a72cbb3b893c4348a484772ee3095e329517631
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page