usr bin env python -coding utf8- import time subprocess from Xlib impo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#! /usr/bin/env python
#-*-coding:utf8-*-
import time, subprocess
from Xlib import display, X
time.sleep(0.2)
dpy = display.Display()
root = dpy.screen().root
root.grab_keyboard(0, X.GrabModeAsync, X.GrabModeAsync, X.CurrentTime)
root.grab_pointer(0, X.PointerMotionMask|X.ButtonPressMask, X.GrabModeAsync, X.GrabModeAsync, X.NONE, X.NONE, X.CurrentTime)
root.display.next_event()
dpy.close()
subprocess.call('xlock')