@termwire/tmux 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/create-tmux.d.ts +3 -1
- package/dist/create-tmux.js +4 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/pane.d.ts +1 -1
- package/dist/session.d.ts +1 -0
- package/dist/session.js +20 -0
- package/dist/window.d.ts +3 -0
- package/dist/window.js +15 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @termwire/tmux
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eec1451: Termwire new sessions now set the outer terminal title from the tmux session name, and the tmux adapter exposes built-in layout selection.
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 6f485f3: Add configurable tmux window and pane layouts for new workspaces.
|
|
14
|
+
|
|
15
|
+
Support optional global and project JSONC configuration, strict Zod validation,
|
|
16
|
+
explicit editor pane selection, and deferred pane command startup with complete
|
|
17
|
+
workspace environment variables.
|
|
18
|
+
|
|
3
19
|
## 0.1.2
|
|
4
20
|
|
|
5
21
|
## 0.1.1
|
package/dist/create-tmux.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { respawnPane, sendKeys, splitPane } from "./pane";
|
|
2
2
|
import { type Exec } from "./process";
|
|
3
3
|
import { newSession } from "./session";
|
|
4
|
-
import { newWindow } from "./window";
|
|
4
|
+
import { newWindow, selectLayout } from "./window";
|
|
5
5
|
export interface CreateTmuxOptions {
|
|
6
6
|
exec?: Exec;
|
|
7
7
|
env?: Record<string, string | undefined>;
|
|
@@ -11,11 +11,13 @@ export declare function createTmux({ exec, env }?: CreateTmuxOptions): {
|
|
|
11
11
|
newSession: (options: Parameters<typeof newSession>[1]) => Promise<import("./command").WindowPaneIds>;
|
|
12
12
|
newWindow: (options: Parameters<typeof newWindow>[1]) => Promise<import("./command").WindowPaneIds>;
|
|
13
13
|
setEnvironment: (session: string, key: string, value: string) => Promise<void>;
|
|
14
|
+
setSessionTitle: (session: string) => Promise<void>;
|
|
14
15
|
killSession: (session: string) => Promise<void>;
|
|
15
16
|
respawnPane: (options: Parameters<typeof respawnPane>[1]) => Promise<void>;
|
|
16
17
|
splitPane: (options: Parameters<typeof splitPane>[1]) => Promise<string>;
|
|
17
18
|
sendKeys: (target: string, keys: readonly string[], options?: Parameters<typeof sendKeys>[3]) => Promise<void>;
|
|
18
19
|
selectWindow: (target: string) => Promise<void>;
|
|
20
|
+
selectLayout: (target: string, layout: Parameters<typeof selectLayout>[2]) => Promise<void>;
|
|
19
21
|
selectPane: (target: string) => Promise<void>;
|
|
20
22
|
attach: (session: string) => Promise<void>;
|
|
21
23
|
};
|
package/dist/create-tmux.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { attach } from "./client";
|
|
2
2
|
import { respawnPane, selectPane, sendKeys, splitPane } from "./pane";
|
|
3
3
|
import { bunExec } from "./process";
|
|
4
|
-
import { hasSession, killSession, newSession, setEnvironment } from "./session";
|
|
5
|
-
import { newWindow, selectWindow } from "./window";
|
|
4
|
+
import { hasSession, killSession, newSession, setEnvironment, setSessionTitle } from "./session";
|
|
5
|
+
import { newWindow, selectLayout, selectWindow } from "./window";
|
|
6
6
|
export function createTmux({ exec = bunExec, env = process.env } = {}) {
|
|
7
7
|
return {
|
|
8
8
|
hasSession: (session) => hasSession(exec, session),
|
|
9
9
|
newSession: (options) => newSession(exec, options),
|
|
10
10
|
newWindow: (options) => newWindow(exec, options),
|
|
11
11
|
setEnvironment: (session, key, value) => setEnvironment(exec, session, key, value),
|
|
12
|
+
setSessionTitle: (session) => setSessionTitle(exec, session),
|
|
12
13
|
killSession: (session) => killSession(exec, session),
|
|
13
14
|
respawnPane: (options) => respawnPane(exec, options),
|
|
14
15
|
splitPane: (options) => splitPane(exec, options),
|
|
15
16
|
sendKeys: (target, keys, options) => sendKeys(exec, target, keys, options),
|
|
16
17
|
selectWindow: (target) => selectWindow(exec, target),
|
|
18
|
+
selectLayout: (target, layout) => selectLayout(exec, target, layout),
|
|
17
19
|
selectPane: (target) => selectPane(exec, target),
|
|
18
20
|
attach: (session) => attach(exec, env, session),
|
|
19
21
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export { CommandError } from "./process";
|
|
|
8
8
|
export type { NewSessionOptions } from "./session";
|
|
9
9
|
export { killSession, setEnvironment } from "./session";
|
|
10
10
|
export { ValidationError } from "./validation";
|
|
11
|
-
export type { NewWindowOptions } from "./window";
|
|
11
|
+
export type { NewWindowOptions, TmuxLayout } from "./window";
|
|
12
|
+
export { selectLayout, tmuxLayouts } from "./window";
|
package/dist/index.js
CHANGED
package/dist/pane.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface SplitPaneOptions {
|
|
|
10
10
|
export interface RespawnPaneOptions {
|
|
11
11
|
target: string;
|
|
12
12
|
cwd?: string;
|
|
13
|
-
command
|
|
13
|
+
command?: readonly string[];
|
|
14
14
|
environment?: Record<string, string | undefined>;
|
|
15
15
|
}
|
|
16
16
|
export declare function respawnPane(exec: Exec, options: RespawnPaneOptions): Promise<void>;
|
package/dist/session.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ export interface NewSessionOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function hasSession(exec: Exec, session: string): Promise<boolean>;
|
|
11
11
|
export declare function setEnvironment(exec: Exec, session: string, key: string, value: string): Promise<void>;
|
|
12
|
+
export declare function setSessionTitle(exec: Exec, session: string): Promise<void>;
|
|
12
13
|
export declare function killSession(exec: Exec, session: string): Promise<void>;
|
|
13
14
|
export declare function newSession(exec: Exec, options: NewSessionOptions): Promise<WindowPaneIds>;
|
package/dist/session.js
CHANGED
|
@@ -21,6 +21,26 @@ export async function setEnvironment(exec, session, key, value) {
|
|
|
21
21
|
throw CommandError.from(command, execution);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
export async function setSessionTitle(exec, session) {
|
|
25
|
+
assertNotEmpty("session", session);
|
|
26
|
+
const setTitlesCommand = ["tmux", "set-option", "-t", `=${session}`, "set-titles", "on"];
|
|
27
|
+
const setTitlesExecution = await execute(exec, setTitlesCommand);
|
|
28
|
+
if (setTitlesExecution.exitCode !== 0) {
|
|
29
|
+
throw CommandError.from(setTitlesCommand, setTitlesExecution);
|
|
30
|
+
}
|
|
31
|
+
const setTitlesStringCommand = [
|
|
32
|
+
"tmux",
|
|
33
|
+
"set-option",
|
|
34
|
+
"-t",
|
|
35
|
+
`=${session}`,
|
|
36
|
+
"set-titles-string",
|
|
37
|
+
"#{session_name}",
|
|
38
|
+
];
|
|
39
|
+
const setTitlesStringExecution = await execute(exec, setTitlesStringCommand);
|
|
40
|
+
if (setTitlesStringExecution.exitCode !== 0) {
|
|
41
|
+
throw CommandError.from(setTitlesStringCommand, setTitlesStringExecution);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
24
44
|
export async function killSession(exec, session) {
|
|
25
45
|
assertNotEmpty("session", session);
|
|
26
46
|
const command = ["tmux", "kill-session", "-t", `=${session}`];
|
package/dist/window.d.ts
CHANGED
|
@@ -7,5 +7,8 @@ export interface NewWindowOptions {
|
|
|
7
7
|
command?: readonly string[];
|
|
8
8
|
environment?: Record<string, string | undefined>;
|
|
9
9
|
}
|
|
10
|
+
export declare const tmuxLayouts: readonly ["even-horizontal", "even-vertical", "main-horizontal", "main-vertical", "tiled"];
|
|
11
|
+
export type TmuxLayout = (typeof tmuxLayouts)[number];
|
|
10
12
|
export declare function newWindow(exec: Exec, options: NewWindowOptions): Promise<WindowPaneIds>;
|
|
11
13
|
export declare function selectWindow(exec: Exec, target: string): Promise<void>;
|
|
14
|
+
export declare function selectLayout(exec: Exec, target: string, layout: TmuxLayout): Promise<void>;
|
package/dist/window.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { appendCommand, appendEnvironment, readWindowPaneIds } from "./command";
|
|
2
2
|
import { CommandError, execute } from "./process";
|
|
3
3
|
import { assertNotEmpty } from "./validation";
|
|
4
|
+
export const tmuxLayouts = [
|
|
5
|
+
"even-horizontal",
|
|
6
|
+
"even-vertical",
|
|
7
|
+
"main-horizontal",
|
|
8
|
+
"main-vertical",
|
|
9
|
+
"tiled",
|
|
10
|
+
];
|
|
4
11
|
export async function newWindow(exec, options) {
|
|
5
12
|
assertNotEmpty("target", options.target);
|
|
6
13
|
if (options.name !== undefined)
|
|
@@ -36,3 +43,11 @@ export async function selectWindow(exec, target) {
|
|
|
36
43
|
throw CommandError.from(command, execution);
|
|
37
44
|
}
|
|
38
45
|
}
|
|
46
|
+
export async function selectLayout(exec, target, layout) {
|
|
47
|
+
assertNotEmpty("target", target);
|
|
48
|
+
const command = ["tmux", "select-layout", "-t", target, layout];
|
|
49
|
+
const execution = await execute(exec, command);
|
|
50
|
+
if (execution.exitCode !== 0) {
|
|
51
|
+
throw CommandError.from(command, execution);
|
|
52
|
+
}
|
|
53
|
+
}
|