summaryrefslogtreecommitdiff
path: root/testing.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing.py')
-rw-r--r--testing.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing.py b/testing.py
new file mode 100644
index 0000000..dd6f3f8
--- /dev/null
+++ b/testing.py
@@ -0,0 +1,34 @@
+from Xlib.display import Display
+from Xlib import X
+import time
+import signal
+import sys
+
+disp=Display()
+screen=disp.screen()
+root=screen.root
+
+def handle_event(evt):
+ print(evt)
+
+def main():
+ inkscapes = [
+ w for w in screen.root.query_tree().children
+ if w.get_wm_class() and w.get_wm_class()[0] == 'inkscape'
+ ]
+
+ print(inkscapes)
+
+ for inkscape in inkscapes:
+ inkscape.grab_key(10, X.NONE, True,X.GrabModeAsync, X.GrabModeAsync)
+
+ signal.signal(signal.SIGALRM, lambda a,b:sys.exit(1))
+ signal.alarm(10)
+ # grab_key(62, X.NONE)
+ while True:
+ evt=root.display.next_event()
+ if evt.type in [X.KeyPress, X.KeyRelease]: #ignore X.MappingNotify(=34)
+ handle_event(evt)
+
+if __name__ == '__main__':
+ main()