GTK 4 host + transparent egui GLArea over WebKitGTK proven hidden (Xvfb + nested niri): pick fall-through, real input and IME, egui menus over video, pacing equal with and without the overlay. Spike fixes: IM client widget, wl-input Y flip, SPIKE_EGUI=0 layout, URL trim. Co-Authored-By: Claude Opus 5.5 <[email protected]>
26 lines
1.9 KiB
Shell
Executable file
26 lines
1.9 KiB
Shell
Executable file
#!/bin/bash
|
|
S=${SPIKE_RUN:-/tmp/webkit-spike}; HERE=$(cd "$(dirname "$0")" && pwd)
|
|
O=$1; shift
|
|
SOFT="LIBGL_ALWAYS_SOFTWARE=1 WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 GTK_A11Y=none GDK_DEBUG=no-portals GSK_RENDERER=gl NO_AT_BRIDGE=1"
|
|
$HERE/spike.sh $O $SOFT SPIKE_URL=https://example.com/ "$@"
|
|
source $S/env; export WL_INPUT_FLIP_Y=1
|
|
W=$HERE/../target/release/wl-input
|
|
c() { echo "$*" >> $O/cmd; }
|
|
xy() { python3 -c "import json,sys;a=json.load(open('$O/$1.json'));a=json.loads(a) if isinstance(a,str) else a;print(int(a[0]),int(a[1])+46)"; }
|
|
rect='(()=>{const i=document.querySelector(SEL);const r=i.getBoundingClientRect();return JSON.stringify([r.x+r.width/2,r.y+r.height/2])})()'
|
|
sleep 8
|
|
c "js link ${rect/SEL/\"a\"}"; sleep 1; read X Y < <(xy link)
|
|
$W winit click $X $Y right; sleep 1; c state ctx; c shot ctx_link; sleep 1
|
|
read CX CY < <(python3 -c "import json;s=json.load(open('$O/ctx.json'));print(int(s['ctx_menu']['x'])+60,int(s['ctx_menu']['y'])+14)")
|
|
$W winit click $CX $CY; sleep 3; c state ctx_opened; sleep 0.5
|
|
# IME into the URL field
|
|
$W winit click 600 22; sleep 0.3; wtype -M ctrl a -m ctrl -k BackSpace; sleep 0.3
|
|
$W winit ime 日本 1.5 >$O/ime_url.log 2>&1 & sleep 0.7; c shot ime_preedit_url; c state ime_pre_url; sleep 1.5; c state ime_url; sleep 0.5
|
|
wtype -M ctrl a -m ctrl 'en.wikipedia.org/wiki/Web_browser'; wtype -k Return; sleep 6; c state wiki
|
|
c 'js top0 window.scrollY'; sleep 0.5; $W winit scroll 640 400 5; sleep 1.5; c 'js top1 window.scrollY'; sleep 0.5
|
|
# IME into a page input
|
|
c 'go https://duckduckgo.com/'; sleep 7
|
|
c "js inp ${rect/SEL/\"textarea,input[name=q]\"}"; sleep 1; read X Y < <(xy inp)
|
|
$W winit click $X $Y; sleep 0.5; wtype 'abc '; $W winit ime 日本語 1.5 >$O/ime_page.log 2>&1 & sleep 0.7; c shot ime_preedit_page
|
|
c 'js pagepre document.activeElement.value'; sleep 1.5
|
|
c 'js pageval document.activeElement.tagName+"|"+document.activeElement.value'; sleep 1; c shot ime_page; c quit
|