feat: terminal backend abstraction — kitty, tmux, and plain backends
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
"""Kitty terminal backend — native splits via kitty @ remote control."""
|
||||
from __future__ import annotations
|
||||
import subprocess
|
||||
from typing import Union
|
||||
from kitty_workbench.backends import Backend
|
||||
|
||||
class KittyBackend(Backend):
|
||||
name = "kitty"
|
||||
def launch_pane(self, command: list[str], title: str) -> int:
|
||||
result = subprocess.run(
|
||||
["kitty", "@", "launch", "--location=vsplit", "--title", title] + command,
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
return int(result.stdout.strip())
|
||||
def close_pane(self, pane_id: Union[int, str]) -> None:
|
||||
subprocess.run(["kitty", "@", "close-window", f"--match=id:{pane_id}"], capture_output=True)
|
||||
def image_protocol(self) -> str:
|
||||
return "kitty"
|
||||
Reference in New Issue
Block a user