Cthulhu is no longer a fork. Now it is a screen reader written in Golang.

This commit is contained in:
Storm Dragon committed 2026-10-14 00:16:34 -04:00
1 parent a998fe67de
commit 069fc674dc
708 files changed
+112482 -532

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
"""Private X11 window that reports physical OCR click events."""
import json
import sys
from Xlib import X, Xatom, display
connection = display.Display()
screen = connection.screen()
root = screen.root
window = root.create_window(20, 20, 240, 140, 0, screen.root_depth,
X.InputOutput, X.CopyFromParent,
event_mask=X.ButtonPressMask | X.ButtonReleaseMask)
window.map()
root.change_property(connection.intern_atom("_NET_ACTIVE_WINDOW"), Xatom.WINDOW, 32, [window.id])
window.set_input_focus(X.RevertToParent, X.CurrentTime)
connection.sync()
initial_pointer = root.query_pointer()
print(json.dumps({"window": window.id, "width": screen.width_in_pixels,
"height": screen.height_in_pixels,
"pointer": [initial_pointer.root_x, initial_pointer.root_y]}), flush=True)
for line in sys.stdin:
if line.strip() != "events":
break
connection.sync()
events = []
while connection.pending_events():
event = connection.next_event()
if event.type in (X.ButtonPress, X.ButtonRelease):
events.append({"pressed": event.type == X.ButtonPress,
"button": event.detail, "x": event.root_x, "y": event.root_y})
pointer = root.query_pointer()
print(json.dumps({"events": events, "pointer": [pointer.root_x, pointer.root_y]}), flush=True)
connection.close()