5a509cbbbb
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
750 B
Python
19 lines
750 B
Python
"""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"
|