UNPKG

vde-layout

Version:

Terminal multiplexer layout management tool for VDE (Vibe Coding Development Environment)

59 lines 2.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TmuxCommandGenerator = void 0; class TmuxCommandGenerator { splitWindow(direction, targetPane, percentage) { const args = ["split-window"]; args.push(direction === "horizontal" ? "-h" : "-v"); if (targetPane !== undefined) { args.push("-t", targetPane); } if (percentage !== undefined) { args.push("-p", percentage.toString()); } return args; } resizePane(paneId, direction, percentage) { const size = Math.floor(percentage); return ["resize-pane", "-t", paneId, direction === "horizontal" ? "-x" : "-y", `${size}%`]; } sendKeys(paneId, command) { return ["send-keys", "-t", paneId, command, "Enter"]; } selectPane(paneId) { return ["select-pane", "-t", paneId]; } setPaneOption(paneId, option, value) { return ["set-option", "-p", "-t", paneId, option, value]; } setEnvironment(paneId, env) { const commands = []; for (const [key, value] of Object.entries(env)) { const escapedValue = value.replace(/"/g, '\\"'); const exportCommand = `export ${key}="${escapedValue}"`; commands.push(this.sendKeys(paneId, exportCommand)); } return commands; } setPaneTitle(paneId, title) { return ["select-pane", "-t", paneId, "-T", title]; } changeDirectory(paneId, directory) { return this.sendKeys(paneId, `cd "${directory}"`); } newWindow(windowName, workingDirectory) { const args = ["new-window"]; if (windowName !== undefined && windowName !== "") { args.push("-n", windowName); } if (workingDirectory !== undefined && workingDirectory !== "") { args.push("-c", workingDirectory); } return args; } killAllPanes() { return ["kill-pane", "-a"]; } } exports.TmuxCommandGenerator = TmuxCommandGenerator; //# sourceMappingURL=commands.js.map