Created
March 25, 2016 08:07
-
-
Save bigeagle/da9dd84ed85826f429d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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