22 |
from Xlib.protocol import event |
from Xlib.protocol import event |
23 |
from circus import module |
from circus import module |
24 |
from util import KeyBinding |
from util import KeyBinding |
|
from CircusExample import example |
|
25 |
|
|
26 |
class MyModule(module.Module): |
class MyModule(module.Module): |
27 |
|
|
32 |
def load(self): |
def load(self): |
33 |
#foo = KeyBinding(XK.string_to_keysym("F")) |
#foo = KeyBinding(XK.string_to_keysym("F")) |
34 |
foo = KeyBinding(XK.XK_Alt_L) |
foo = KeyBinding(XK.XK_Alt_L) |
|
foo.action = example.MyModule().test |
|
35 |
self.keys.append(foo) |
self.keys.append(foo) |
36 |
|
|
37 |
def handle_event(self,event): |
def handle_event(self,event): |
48 |
|
|
49 |
|
|
50 |
def key_press(self, event): |
def key_press(self, event): |
|
|
|
|
|
|
51 |
|
|
52 |
keysym = self.display.keycode_to_keysym(event.detail, event.state) |
keysym = self.display.keycode_to_keysym(event.detail, event.state) |
53 |
|
|
54 |
for i in range(len(self.keys)): |
for i in range(len(self.keys)): |
55 |
if self.keys[i].keysym == keysym: |
if self.keys[i].keysym == keysym: |
56 |
sys.stderr.write("Keymatch\n") |
sys.stderr.write("Keymatch\n") |
57 |
self.keys[i].action() |
self.wm_actions.call_action('exec', "/usr/bin/rxvt", "-fg", "red") |
58 |
|
|
59 |
|
|