Files
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

21 lines
1.4 KiB
Python

"""Isolated absolute mouse click on the owned win11 SPICE display; no host focus."""
import argparse,json,pathlib
import gi
gi.require_version('SpiceClientGLib','2.0')
from gi.repository import SpiceClientGLib as S,GLib,GObject
p=argparse.ArgumentParser();p.add_argument('x',type=int);p.add_argument('y',type=int);a=p.parse_args()
if not 0<=a.x<1280 or not 0<=a.y<800:raise SystemExit('Known win11 display bounds required')
r=pathlib.Path(__file__).resolve().parents[1]/'runtime/windows-build-storage-20261022';uri=json.loads((r/'guest-network-display-private.json').read_text())['display_uri'];session=S.Session.new();session.set_property('uri',uri);loop=GLib.MainLoop();channels=[];result={'click_sent':False}
def click():
for c in channels:
if isinstance(c,S.MainChannel):c.request_mouse_mode(2)
for c in channels:
if isinstance(c,S.InputsChannel):
c.position(a.x,a.y,0,0)
def press(channel=c):channel.button_press(1,1);return False
def release(channel=c):channel.button_release(1,0);result['click_sent']=True;GLib.timeout_add(300,lambda:(loop.quit(),False)[1]);return False
GLib.timeout_add(200,press);GLib.timeout_add(400,release)
return False
def added(s,c):channels.append(c);c.connect()
GObject.Object.connect(session,'channel-new',added);session.connect();GLib.timeout_add_seconds(2,click);GLib.timeout_add_seconds(5,lambda:(loop.quit(),False)[1]);loop.run();session.disconnect();print(json.dumps(result))