Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
from __future__ import print_function, division, unicode_literals
from udevedu.utils import invoke
import os
def init():
print("Monitoring Yubikey Remove Event")
def check(action, device):
return (
action == "remove" and
device.get('ID_VENDOR_ID') == '1050' and
device.get('ID_MODEL_ID') in ('0111', '0407') and
device.get('DEVNAME', '').startswith('/dev/input/event')
)
def react(action, device):
if os.getenv("XDG_SESSION_DESKTOP") == "i3":
cmd = "i3lock -c 000000".split()
invoke(*cmd)
# vim: ts=4 sw=4 sts=4 expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.