Files
kitty-workbench/src/kitty_workbench/backends/kitty.py
T
2026-03-29 19:08:02 -04:00

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"