Skip to content

Wire pane/browser control dispatcher to GTK state #22

@mvbmir

Description

@mvbmir

Problem

limux-cli exposes a rich set of control methods (pane.list, browser.open_split, browser.navigate, browser.snapshot, browser.click, browser.fill, screenshots, cookies, storage, tabs, etc.) and limux-core/src/lib.rs has a Dispatcher that handles all of them. But the GTK host's control_bridge.rs only registers workspace.* + surface.send_text, so calling any other method against the running daemon returns -32601: unknown method.

The limux-core Dispatcher operates on an in-memory ControlState that's never connected to the real GTK widgets, so swapping it in as-is wouldn't drive WebKit either. This needs a GTK-facing implementation.

Same gap exists on am-will/main — never been wired upstream. Related: #21.

Scope

Wire the following against real GTK state (workspace → pane tree → tab → webkit6 WebView / ghostty terminal):

Panes/surfaces

  • pane.list, pane.surfaces, pane.focus, pane.create, pane.resize, pane.swap, pane.break, pane.join, pane.last
  • surface.list, surface.current, surface.create, surface.focus, surface.close, surface.read_text, surface.send_key, surface.clear_history, surface.action
  • tab.action

Browser

  • browser.open_split, browser.navigate, browser.url.get, browser.back, browser.forward, browser.reload, browser.focus, browser.screenshot
  • browser.snapshot (accessibility tree via JS), browser.click, browser.fill, browser.wait, browser.highlight, browser.frame, browser.scroll, browser.scroll_into_view, browser.hover, browser.dblclick, browser.press, browser.type, browser.check/uncheck/select
  • browser.get.{text,value,title,html,attr,count,box,styles}, browser.eval
  • browser.cookies.{get,set,clear}, browser.storage.{get,set,clear}, browser.state.{save,load}
  • browser.tab.{list,new,switch,close}, browser.addscript, browser.addinitscript, browser.addstyle, browser.console.{list,clear}, browser.errors.{list,clear}

Implementation notes

  • Need a surface_id → {WebView | TerminalHandle} registry (update on tab create/close)
  • JS-based methods (snapshot, click, fill, get.text, etc.) need webkit6::WebView::evaluate_javascript callback bridged to the control command's mpsc::Sender via the GTK main context
  • browser.screenshot uses WebView::snapshot (async, bridge the same way)
  • Keep error codes aligned with what limux-core/src/lib.rs already uses (-32004 not_found, -32602 invalid_params, etc.)

Plan

  1. Implement on mvbmir/dev first so it ships in daily-driver builds
  2. Cherry-pick onto a clean branch off am-will/main
  3. Open PR in this fork, written to apply cleanly to am-will/main (for Limux browser control commands aren't hooked up upstream #21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions