terml-spawner 0.1.0__tar.gz
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.
- terml_spawner-0.1.0/.gitignore +6 -0
- terml_spawner-0.1.0/.sandbox.cfg +25 -0
- terml_spawner-0.1.0/AGENTS.md +159 -0
- terml_spawner-0.1.0/PKG-INFO +142 -0
- terml_spawner-0.1.0/README.md +133 -0
- terml_spawner-0.1.0/example-session.yaml +36 -0
- terml_spawner-0.1.0/ideas.md +22 -0
- terml_spawner-0.1.0/prompts.md +31 -0
- terml_spawner-0.1.0/pyproject.toml +22 -0
- terml_spawner-0.1.0/src/terml/__init__.py +414 -0
- terml_spawner-0.1.0/tests/test_terml.py +401 -0
- terml_spawner-0.1.0/uv.lock +273 -0
- terml_spawner-0.1.0/worklog.md +150 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# <project>/.sandbox.cfg - project requirements, meant to be tracked in git
|
|
2
|
+
#
|
|
3
|
+
# Sourced (bash) by `sandbox` before `.sandbox-local.cfg`, which overrides it.
|
|
4
|
+
# Every option in `sample.sandbox-local.cfg` is valid here as well; put only
|
|
5
|
+
# what the project needs here, personal preferences go to .sandbox-local.cfg.
|
|
6
|
+
|
|
7
|
+
# feature sets added to the lean base image (default: none), from
|
|
8
|
+
# features/<name>.Dockerfile, `# requires:` dependencies are added implicitly:
|
|
9
|
+
# esp32 ESP-IDF prerequisites, libusb, bluez (requires: native)
|
|
10
|
+
# gui X11/Wayland/Qt libs, fonts, alsa, portaudio, mesa
|
|
11
|
+
# monitoring strace, tshark, iproute2, libcap2-bin
|
|
12
|
+
# multimedia ffmpeg, mpv, socat
|
|
13
|
+
# native autoconf, automake, libtool, cmake, ffi/ssl/zlib/sqlcipher-dev
|
|
14
|
+
# pdf tesseract (eng/deu), poppler-utils
|
|
15
|
+
# node Node.js 22 (added automatically when pi is enabled)
|
|
16
|
+
# rust rustup (stable toolchain), rust-script
|
|
17
|
+
# tauri webkit2gtk/soup/rsvg dev libs (requires: rust node native)
|
|
18
|
+
# web chromium, firefox-esr (requires: node)
|
|
19
|
+
# SANDBOX_FEATURES="gui native"
|
|
20
|
+
|
|
21
|
+
# agents the project is meant to be worked on with
|
|
22
|
+
# SANDBOX_AGENTS="opencode"
|
|
23
|
+
|
|
24
|
+
# forward the host's SSH agent (SSH_AUTH_SOCK) into the sandbox
|
|
25
|
+
# SANDBOX_FORWARD_SSH=1
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# AGENTS.md - background for working on terml
|
|
2
|
+
|
|
3
|
+
`terml` turns YAML session files into Terminator windows. Read `README.md`
|
|
4
|
+
for the user-facing behaviour and `ideas.md` for the task list and its rules.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Layout of the repo
|
|
8
|
+
|
|
9
|
+
| Path | Content |
|
|
10
|
+
|---------------------------|-----------------------------------------------|
|
|
11
|
+
| `src/terml/__init__.py` | the whole tool, entry point `terml:main` |
|
|
12
|
+
| `tests/test_terml.py` | pytest tests for the pure functions |
|
|
13
|
+
| `example-session.yaml` | reference session file, used by the tests |
|
|
14
|
+
| `ideas.md` | task list, one checkable item = one prompt |
|
|
15
|
+
| `worklog.md`, `prompts.md`| per-prompt log, to be updated on every prompt |
|
|
16
|
+
| `.sandbox*.cfg` | config of the container the agents run in |
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## Working environment
|
|
20
|
+
|
|
21
|
+
- Agents run in a container: no `terminator`, no system `python3`, no
|
|
22
|
+
`gsettings`, `$XDG_RUNTIME_DIR` is not writable. `uv` is available and
|
|
23
|
+
downloads Python itself.
|
|
24
|
+
- `uv run pytest` runs the tests, `uv run terml --print-config FILE` shows
|
|
25
|
+
the generated Terminator config without spawning anything.
|
|
26
|
+
- Spawning can be checked with a fake `terminator` script on `PATH` and
|
|
27
|
+
`XDG_RUNTIME_DIR` pointing to a writable folder.
|
|
28
|
+
- Real end-to-end checks need the user's host. Not yet confirmed there:
|
|
29
|
+
Pango accepting `8px` as size, ratios in fullscreen windows, `pos` with
|
|
30
|
+
`force-x11: true`, percentages in `pos` / `size` (real `xrandr` output,
|
|
31
|
+
Wayland, display scaling).
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Workflow
|
|
35
|
+
|
|
36
|
+
- Commit once per prompt, on the current branch, as the last step of the
|
|
37
|
+
prompt (agreed with the user on 2026-12-01). The commit includes the
|
|
38
|
+
`worklog.md` / `prompts.md` entries of that prompt.
|
|
39
|
+
- Never push, never switch branches, never amend.
|
|
40
|
+
- Commit messages: line width 72, no `Co-Authored-By`.
|
|
41
|
+
- The container has no git identity. Don't touch the git config. Pass the
|
|
42
|
+
identity of the existing commits for the one command instead:
|
|
43
|
+
`GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME` and
|
|
44
|
+
`GIT_COMMITTER_EMAIL`, filled from `git log -1 --format=%an` / `%ae`.
|
|
45
|
+
- Run `uv run pytest` before committing.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Design
|
|
49
|
+
|
|
50
|
+
Pipeline, all pure functions except `user_config`, `system_font`, `spawn`,
|
|
51
|
+
`run` and `main`:
|
|
52
|
+
|
|
53
|
+
windows(paths) YAML -> validated trees with inherited values
|
|
54
|
+
layout(wins) trees -> flat dict of Terminator layout items
|
|
55
|
+
config(base, wins) user config + layout `terml` + font profiles
|
|
56
|
+
rendered(cfg) ConfigObj text
|
|
57
|
+
spawn(text, x11) write config, start Terminator detached
|
|
58
|
+
|
|
59
|
+
- `problems()` validates the raw YAML, `resolved()` then applies inheritance
|
|
60
|
+
(`cwd`, `font-size`, `keep`) and guarantees a `children` list and a `keep`
|
|
61
|
+
value on every node.
|
|
62
|
+
- Percentages in `pos` / `size` are resolved in `run()` by `placed()`,
|
|
63
|
+
not in `layout()`: `layout()` expects pixels. The reference is the
|
|
64
|
+
primary monitor from `xrandr --current` (first connected one if none is
|
|
65
|
+
primary), parsed by `monitor()`. `xrandr` is only called if a percentage
|
|
66
|
+
is used. Choosing the primary monitor was the agent's decision, the user
|
|
67
|
+
only asked for percentages.
|
|
68
|
+
- The top level of a file is a list of windows or a map (`ROOT_KEYS`:
|
|
69
|
+
`children`, `disabled` and the inherited keys). `root()` turns a list
|
|
70
|
+
into `{children: list}`, so both forms take the same path. The windows
|
|
71
|
+
are the resolved children of that root, which is how root values get
|
|
72
|
+
inherited.
|
|
73
|
+
- The file name `-` means stdin (`source()`). Its base for a relative
|
|
74
|
+
`cwd` is the current directory, error messages call it `<stdin>`.
|
|
75
|
+
- The distribution is called `pyterml` (`pyproject.toml`), the Python
|
|
76
|
+
package and the command `terml` (there is a `pyterml` command, too).
|
|
77
|
+
`--version` asks `importlib.metadata` for `pyterml`, so the version is
|
|
78
|
+
only maintained in `pyproject.toml`. Renaming the distribution breaks
|
|
79
|
+
`--version`, `test_version` will tell.
|
|
80
|
+
- `enabled()` drops entries with `disabled: true` at every level. It is
|
|
81
|
+
applied before validation, so disabled entries are neither checked nor
|
|
82
|
+
counted for ratios. It keeps the original index for error messages.
|
|
83
|
+
- `cwd: ~` in YAML is `null`, not a string. `resolved()` maps a `null` cwd
|
|
84
|
+
to home on purpose.
|
|
85
|
+
- YAML `maximize` becomes Terminator's `maximised` (British spelling).
|
|
86
|
+
- Windows are grouped by `force-x11`. Each group becomes one Terminator
|
|
87
|
+
process, the X11 group gets `GDK_BACKEND=x11`.
|
|
88
|
+
- Coding style: functions start with `return` and have no side effects,
|
|
89
|
+
procedures are named after verbs. Avoid if/else branching.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## Terminator facts (from its source, master, December 2026)
|
|
93
|
+
|
|
94
|
+
Why a generated config and a separate process:
|
|
95
|
+
|
|
96
|
+
- A layout can only come from the config file. There is no way to hand one
|
|
97
|
+
over at runtime.
|
|
98
|
+
- A second `terminator` call talks to the running instance via DBus
|
|
99
|
+
(`new_window_cmdline`). That instance honours `--layout` but never reloads
|
|
100
|
+
its config, so a layout from another `--config` file is unknown to it.
|
|
101
|
+
- `--no-dbus` makes the new process independent, so it loads the generated
|
|
102
|
+
config. Downside: `remotinator` and `--new-tab` cannot reach it.
|
|
103
|
+
- Terminator does not fork. Its process lives until the last window closes,
|
|
104
|
+
hence `Popen(..., start_new_session=True)`.
|
|
105
|
+
|
|
106
|
+
Layout items (`[layouts] [[name]] [[[item]]]`), linked by `parent`:
|
|
107
|
+
|
|
108
|
+
| Type | Keys read |
|
|
109
|
+
|------------|--------------------------------------------------------------|
|
|
110
|
+
| `Window` | `position` (`x:y`), `size` (`w, h`), `title`, `fullscreen` |
|
|
111
|
+
| | and `maximised` (only the string `True` counts), `parent=""` |
|
|
112
|
+
| `VPaned` | children on top of each other, `ratio`, `order` |
|
|
113
|
+
| `HPaned` | children side by side, `ratio`, `order` |
|
|
114
|
+
| `Terminal` | `command`, `directory`, `profile`, `title`, `group`, `uuid` |
|
|
115
|
+
|
|
116
|
+
- A pane has exactly two children, `order` 0 and 1. `ratio` is the fraction
|
|
117
|
+
of the first child. N children need a chain of nested panes, see `paned()`.
|
|
118
|
+
- terml's `ratio` means "share of the rest" (decided by the user on
|
|
119
|
+
2026-12-01), which is exactly the `ratio` of the pane in that chain. A
|
|
120
|
+
child without `ratio` gets 1/n, n being the children not yet placed. The
|
|
121
|
+
`ratio` of the last child is ignored. It used to mean "share of the
|
|
122
|
+
parent" - don't bring that back.
|
|
123
|
+
- Terminator's menu wording is the opposite of the widget names: "split
|
|
124
|
+
horizontally" creates a `VPaned`. terml's `split: vertical` is a `VPaned`.
|
|
125
|
+
- There is no font or zoom key for terminals. A different font size needs a
|
|
126
|
+
different `profile`.
|
|
127
|
+
- Profiles do not inherit from the user's `default` profile but from the
|
|
128
|
+
built-in defaults. Hence terml copies `default` into `terml-<size>`.
|
|
129
|
+
- With `use_system_font = True` (default) the font comes from gsettings
|
|
130
|
+
`org.gnome.desktop.interface monospace-font-name`.
|
|
131
|
+
- The font string is parsed by `Pango.FontDescription`. Errors are swallowed
|
|
132
|
+
silently.
|
|
133
|
+
- A `command` runs as `$SHELL -c <command>`, a non-interactive shell which
|
|
134
|
+
does not source `.bashrc` / `.zshrc`. Functions and aliases from there
|
|
135
|
+
are "not found". Hence `command()` wraps everything into
|
|
136
|
+
`exec ${SHELL:-sh} -ic '<command>'` (quoted with `shlex.quote`).
|
|
137
|
+
`${SHELL:-sh}` is unquoted on purpose: with double quotes ConfigObj has
|
|
138
|
+
to use triple quotes for nearly every command.
|
|
139
|
+
- When a command exits, the profile key `exit_action` decides: `close`
|
|
140
|
+
(default), `restart` or `hold`.
|
|
141
|
+
- `window.move()` is not guarded for Wayland. It is simply ignored there,
|
|
142
|
+
which is why `force-x11` exists.
|
|
143
|
+
|
|
144
|
+
DBus API (`remotinator`), relevant for the `--reuse` task:
|
|
145
|
+
|
|
146
|
+
- `hsplit` / `vsplit` return the new terminal's UUID and accept only
|
|
147
|
+
`execute` and `title`. The new terminal inherits the cwd.
|
|
148
|
+
- Not possible via DBus: split ratio, cwd, font size or zoom, feeding text
|
|
149
|
+
into a terminal, moving or resizing windows, applying a layout to an
|
|
150
|
+
existing window. `switch_profile` exists.
|
|
151
|
+
- `$TERMINATOR_UUID` identifies the calling terminal.
|
|
152
|
+
- Suspected naming trap: `hsplit` with options seems to stack terminals
|
|
153
|
+
(`VPaned`). Verify with a live test before relying on it.
|
|
154
|
+
|
|
155
|
+
ConfigObj:
|
|
156
|
+
|
|
157
|
+
- Read and write with `interpolation=False`, so `%` in commands survives.
|
|
158
|
+
- Values containing commas or quotes get quoted on write. The round trip is
|
|
159
|
+
covered by `test_rendered_config_survives_configobj`.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: terml-spawner
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: YAML based spawner for Terminator
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: configobj>=5.0.8
|
|
7
|
+
Requires-Dist: pyyaml>=6
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# terml
|
|
11
|
+
|
|
12
|
+
YAML based spawner for [Terminator](https://github.com/gnome-terminator/terminator):
|
|
13
|
+
describe windows, splits, ratios, font sizes, working directories and commands
|
|
14
|
+
in a YAML file and let `terml` open them all at once.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
terml FILE [FILE ...] # open all windows, return immediately
|
|
20
|
+
terml - # read the session from stdin
|
|
21
|
+
terml --print-config FILE ... # show the generated Terminator config
|
|
22
|
+
terml --version
|
|
23
|
+
|
|
24
|
+
Run it from the project folder without installing:
|
|
25
|
+
|
|
26
|
+
uv run terml example-session.yaml
|
|
27
|
+
|
|
28
|
+
Or install it:
|
|
29
|
+
|
|
30
|
+
uv tool install .
|
|
31
|
+
|
|
32
|
+
With `terml` on your `PATH` a session file starting with
|
|
33
|
+
`#!/usr/bin/env terml` can be made executable and started directly.
|
|
34
|
+
|
|
35
|
+
`-` instead of a file reads from stdin, which goes well with a here-document.
|
|
36
|
+
A relative `cwd` is then relative to the current directory:
|
|
37
|
+
|
|
38
|
+
terml - <<'EOF'
|
|
39
|
+
- {command: htop}
|
|
40
|
+
- {cwd: ~/src, children: [{}, {}]}
|
|
41
|
+
EOF
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Session files
|
|
45
|
+
|
|
46
|
+
The top level is a list. Every entry is a window. An entry with `children`
|
|
47
|
+
is split, an entry without is a terminal. See `example-session.yaml`.
|
|
48
|
+
|
|
49
|
+
The top level may also be a map with the windows as `children`. Next to
|
|
50
|
+
`children` it takes the inherited keys (see below) and `disabled`, which then
|
|
51
|
+
apply to all windows of the file:
|
|
52
|
+
|
|
53
|
+
font-size: 20
|
|
54
|
+
cwd: ~/src
|
|
55
|
+
children:
|
|
56
|
+
- name: first window
|
|
57
|
+
- name: second window
|
|
58
|
+
|
|
59
|
+
- name: projects
|
|
60
|
+
size: [400, 800]
|
|
61
|
+
cwd: ~/src
|
|
62
|
+
children:
|
|
63
|
+
- command: htop
|
|
64
|
+
ratio: 30%
|
|
65
|
+
- split: horizontal
|
|
66
|
+
children:
|
|
67
|
+
- command: git status
|
|
68
|
+
- font-size: 8px
|
|
69
|
+
|
|
70
|
+
| Key | Where | Meaning |
|
|
71
|
+
|-------------|-----------|--------------------------------------------------|
|
|
72
|
+
| `name` | window | window title |
|
|
73
|
+
| `pos` | window | `[x, y]` in pixels or percent (see limitations) |
|
|
74
|
+
| `size` | window | `[width, height]` in pixels or percent |
|
|
75
|
+
| `fullscreen`| window | `true` makes the window fullscreen |
|
|
76
|
+
| `maximize` | window | `true` maximizes the window |
|
|
77
|
+
| `force-x11` | window | `true` starts Terminator with `GDK_BACKEND=x11` |
|
|
78
|
+
| `children` | anywhere | list of nested entries |
|
|
79
|
+
| `split` | anywhere | how `children` are arranged: `vertical` stacks |
|
|
80
|
+
| | | them top to bottom (default), `horizontal` puts |
|
|
81
|
+
| | | them side by side |
|
|
82
|
+
| `ratio` | child | share of the space left over by the children |
|
|
83
|
+
| | | before it, e.g. `40%` |
|
|
84
|
+
| `command` | terminal | command to run in an interactive `$SHELL` |
|
|
85
|
+
| `cwd` | inherited | working directory |
|
|
86
|
+
| `font-size` | inherited | `8` means points, `8px` means pixels |
|
|
87
|
+
| `keep` | inherited | `true` (default): drop into a shell after the |
|
|
88
|
+
| | | command. `false`: Terminator decides, by default |
|
|
89
|
+
| | | the terminal closes |
|
|
90
|
+
| `disabled` | anywhere | `true` ignores the entry and all its children |
|
|
91
|
+
|
|
92
|
+
Details:
|
|
93
|
+
|
|
94
|
+
- "inherited" keys apply to all children unless a child overrides them.
|
|
95
|
+
- Children are placed in the order they are written. `ratio` is a share of
|
|
96
|
+
what the children before left over: `50%`, `50%`, rest gives 50%, 25% and
|
|
97
|
+
25% of the parent. The last child always takes the rest, its `ratio` is
|
|
98
|
+
ignored.
|
|
99
|
+
- A child without `ratio` takes an equal share: one third of the rest if
|
|
100
|
+
three children are still to be placed (itself included). So children
|
|
101
|
+
without any `ratio` split their parent equally.
|
|
102
|
+
- A relative `cwd` is relative to the parent's `cwd`, or to the session file
|
|
103
|
+
at the top level. `cwd: ~` means home.
|
|
104
|
+
- Note that `vertical` and `horizontal` name the direction in which the
|
|
105
|
+
children are laid out. Terminator's menu names it the other way round.
|
|
106
|
+
- Commands run via `$SHELL -ic`, so `.bashrc` / `.zshrc` are sourced and
|
|
107
|
+
your functions and aliases are available.
|
|
108
|
+
- `pos` and `size` accept percentages, also mixed with pixels:
|
|
109
|
+
`size: [300, 100%]`. They refer to the primary monitor as reported by
|
|
110
|
+
`xrandr`, to its full size including panels and docks. A `pos` in
|
|
111
|
+
percent starts at the top left corner of that monitor, a `pos` in pixels
|
|
112
|
+
at the top left corner of the whole desktop.
|
|
113
|
+
- A `disabled` entry is treated as if it wasn't there: it takes no space,
|
|
114
|
+
and its content isn't even checked.
|
|
115
|
+
- Unknown keys are errors.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## How it works
|
|
119
|
+
|
|
120
|
+
`terml` copies your Terminator config (`~/.config/terminator/config`), adds a
|
|
121
|
+
layout `terml` plus one profile per font size (copies of your `default`
|
|
122
|
+
profile), writes the result to `$XDG_RUNTIME_DIR/terml/` and starts
|
|
123
|
+
|
|
124
|
+
terminator --no-dbus --config <generated config> --layout terml
|
|
125
|
+
|
|
126
|
+
Your own config is never modified.
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## Limitations
|
|
130
|
+
|
|
131
|
+
- `pos` is ignored on Wayland unless `force-x11: true` is set for the window.
|
|
132
|
+
- Percentages need `xrandr`. With display scaling the pixels reported by
|
|
133
|
+
`xrandr` may not be the pixels Terminator counts in.
|
|
134
|
+
- Windows opened by `terml` run in their own Terminator process without DBus.
|
|
135
|
+
`remotinator` and `terminator --new-tab` don't reach them.
|
|
136
|
+
- Preferences saved from within such a window end up in the generated config
|
|
137
|
+
and are gone after logout.
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
## Development
|
|
141
|
+
|
|
142
|
+
uv run pytest
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# terml
|
|
2
|
+
|
|
3
|
+
YAML based spawner for [Terminator](https://github.com/gnome-terminator/terminator):
|
|
4
|
+
describe windows, splits, ratios, font sizes, working directories and commands
|
|
5
|
+
in a YAML file and let `terml` open them all at once.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
terml FILE [FILE ...] # open all windows, return immediately
|
|
11
|
+
terml - # read the session from stdin
|
|
12
|
+
terml --print-config FILE ... # show the generated Terminator config
|
|
13
|
+
terml --version
|
|
14
|
+
|
|
15
|
+
Run it from the project folder without installing:
|
|
16
|
+
|
|
17
|
+
uv run terml example-session.yaml
|
|
18
|
+
|
|
19
|
+
Or install it:
|
|
20
|
+
|
|
21
|
+
uv tool install .
|
|
22
|
+
|
|
23
|
+
With `terml` on your `PATH` a session file starting with
|
|
24
|
+
`#!/usr/bin/env terml` can be made executable and started directly.
|
|
25
|
+
|
|
26
|
+
`-` instead of a file reads from stdin, which goes well with a here-document.
|
|
27
|
+
A relative `cwd` is then relative to the current directory:
|
|
28
|
+
|
|
29
|
+
terml - <<'EOF'
|
|
30
|
+
- {command: htop}
|
|
31
|
+
- {cwd: ~/src, children: [{}, {}]}
|
|
32
|
+
EOF
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Session files
|
|
36
|
+
|
|
37
|
+
The top level is a list. Every entry is a window. An entry with `children`
|
|
38
|
+
is split, an entry without is a terminal. See `example-session.yaml`.
|
|
39
|
+
|
|
40
|
+
The top level may also be a map with the windows as `children`. Next to
|
|
41
|
+
`children` it takes the inherited keys (see below) and `disabled`, which then
|
|
42
|
+
apply to all windows of the file:
|
|
43
|
+
|
|
44
|
+
font-size: 20
|
|
45
|
+
cwd: ~/src
|
|
46
|
+
children:
|
|
47
|
+
- name: first window
|
|
48
|
+
- name: second window
|
|
49
|
+
|
|
50
|
+
- name: projects
|
|
51
|
+
size: [400, 800]
|
|
52
|
+
cwd: ~/src
|
|
53
|
+
children:
|
|
54
|
+
- command: htop
|
|
55
|
+
ratio: 30%
|
|
56
|
+
- split: horizontal
|
|
57
|
+
children:
|
|
58
|
+
- command: git status
|
|
59
|
+
- font-size: 8px
|
|
60
|
+
|
|
61
|
+
| Key | Where | Meaning |
|
|
62
|
+
|-------------|-----------|--------------------------------------------------|
|
|
63
|
+
| `name` | window | window title |
|
|
64
|
+
| `pos` | window | `[x, y]` in pixels or percent (see limitations) |
|
|
65
|
+
| `size` | window | `[width, height]` in pixels or percent |
|
|
66
|
+
| `fullscreen`| window | `true` makes the window fullscreen |
|
|
67
|
+
| `maximize` | window | `true` maximizes the window |
|
|
68
|
+
| `force-x11` | window | `true` starts Terminator with `GDK_BACKEND=x11` |
|
|
69
|
+
| `children` | anywhere | list of nested entries |
|
|
70
|
+
| `split` | anywhere | how `children` are arranged: `vertical` stacks |
|
|
71
|
+
| | | them top to bottom (default), `horizontal` puts |
|
|
72
|
+
| | | them side by side |
|
|
73
|
+
| `ratio` | child | share of the space left over by the children |
|
|
74
|
+
| | | before it, e.g. `40%` |
|
|
75
|
+
| `command` | terminal | command to run in an interactive `$SHELL` |
|
|
76
|
+
| `cwd` | inherited | working directory |
|
|
77
|
+
| `font-size` | inherited | `8` means points, `8px` means pixels |
|
|
78
|
+
| `keep` | inherited | `true` (default): drop into a shell after the |
|
|
79
|
+
| | | command. `false`: Terminator decides, by default |
|
|
80
|
+
| | | the terminal closes |
|
|
81
|
+
| `disabled` | anywhere | `true` ignores the entry and all its children |
|
|
82
|
+
|
|
83
|
+
Details:
|
|
84
|
+
|
|
85
|
+
- "inherited" keys apply to all children unless a child overrides them.
|
|
86
|
+
- Children are placed in the order they are written. `ratio` is a share of
|
|
87
|
+
what the children before left over: `50%`, `50%`, rest gives 50%, 25% and
|
|
88
|
+
25% of the parent. The last child always takes the rest, its `ratio` is
|
|
89
|
+
ignored.
|
|
90
|
+
- A child without `ratio` takes an equal share: one third of the rest if
|
|
91
|
+
three children are still to be placed (itself included). So children
|
|
92
|
+
without any `ratio` split their parent equally.
|
|
93
|
+
- A relative `cwd` is relative to the parent's `cwd`, or to the session file
|
|
94
|
+
at the top level. `cwd: ~` means home.
|
|
95
|
+
- Note that `vertical` and `horizontal` name the direction in which the
|
|
96
|
+
children are laid out. Terminator's menu names it the other way round.
|
|
97
|
+
- Commands run via `$SHELL -ic`, so `.bashrc` / `.zshrc` are sourced and
|
|
98
|
+
your functions and aliases are available.
|
|
99
|
+
- `pos` and `size` accept percentages, also mixed with pixels:
|
|
100
|
+
`size: [300, 100%]`. They refer to the primary monitor as reported by
|
|
101
|
+
`xrandr`, to its full size including panels and docks. A `pos` in
|
|
102
|
+
percent starts at the top left corner of that monitor, a `pos` in pixels
|
|
103
|
+
at the top left corner of the whole desktop.
|
|
104
|
+
- A `disabled` entry is treated as if it wasn't there: it takes no space,
|
|
105
|
+
and its content isn't even checked.
|
|
106
|
+
- Unknown keys are errors.
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
## How it works
|
|
110
|
+
|
|
111
|
+
`terml` copies your Terminator config (`~/.config/terminator/config`), adds a
|
|
112
|
+
layout `terml` plus one profile per font size (copies of your `default`
|
|
113
|
+
profile), writes the result to `$XDG_RUNTIME_DIR/terml/` and starts
|
|
114
|
+
|
|
115
|
+
terminator --no-dbus --config <generated config> --layout terml
|
|
116
|
+
|
|
117
|
+
Your own config is never modified.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## Limitations
|
|
121
|
+
|
|
122
|
+
- `pos` is ignored on Wayland unless `force-x11: true` is set for the window.
|
|
123
|
+
- Percentages need `xrandr`. With display scaling the pixels reported by
|
|
124
|
+
`xrandr` may not be the pixels Terminator counts in.
|
|
125
|
+
- Windows opened by `terml` run in their own Terminator process without DBus.
|
|
126
|
+
`remotinator` and `terminator --new-tab` don't reach them.
|
|
127
|
+
- Preferences saved from within such a window end up in the generated config
|
|
128
|
+
and are gone after logout.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
## Development
|
|
132
|
+
|
|
133
|
+
uv run pytest
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env terml
|
|
2
|
+
|
|
3
|
+
# simple window
|
|
4
|
+
- name: disk usage
|
|
5
|
+
pos: [0, 0]
|
|
6
|
+
size: [300, 200]
|
|
7
|
+
# force-x11: true # makes `pos` work on Wayland (runs via XWayland)
|
|
8
|
+
cwd: ~
|
|
9
|
+
command: gdu
|
|
10
|
+
keep: false # window closes when gdu quits (default: drop into a shell)
|
|
11
|
+
|
|
12
|
+
# simple vertical split into three equal parts
|
|
13
|
+
- name: projects
|
|
14
|
+
# split: vertical (split mode for children, vertical is default)
|
|
15
|
+
pos: [500, 0]
|
|
16
|
+
size: [400, 800] # percentages of the primary monitor work too: [400, 100%]
|
|
17
|
+
cwd: ~/_HEAP # applies to all children
|
|
18
|
+
children:
|
|
19
|
+
- command: project-meta
|
|
20
|
+
- command: worklog-from-fs
|
|
21
|
+
font-size: 8px
|
|
22
|
+
- {} # just starts a sub-terminal running the shell
|
|
23
|
+
|
|
24
|
+
# more complex screen setup
|
|
25
|
+
- name: fred
|
|
26
|
+
fullscreen: true
|
|
27
|
+
cwd: ~/_HEAP/mark
|
|
28
|
+
children:
|
|
29
|
+
- split: horizontal # split mode for children only
|
|
30
|
+
ratio: 40% # takes 40% of vertical space
|
|
31
|
+
children:
|
|
32
|
+
- ratio: 30% # uses 30% of available space
|
|
33
|
+
command: banner fred
|
|
34
|
+
- command: ls -alF
|
|
35
|
+
- ratio: 50% # takes 50% of the rest (30% of the window)
|
|
36
|
+
- {} # takes the rest of the available vertical space, starts the shell
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## terml future ideas
|
|
2
|
+
|
|
3
|
+
All checkable elements in here should be treated as single independent tasks
|
|
4
|
+
(prompts) and get entries in prompts.md/worklog.md, updates to documentation
|
|
5
|
+
and readme and should be checked and put to the `done` section (not nested but
|
|
6
|
+
with a date). If an item is already done, consider adding tests, move to `done`
|
|
7
|
+
section adding the most likely date of implementation.
|
|
8
|
+
Don't implement items marked with `[?]` automatically - skip them or stop.
|
|
9
|
+
Items marked with `[!]` should be planned carefully, ask questions, skip them
|
|
10
|
+
for now if other more obvious items exist.
|
|
11
|
+
|
|
12
|
+
## tasks
|
|
13
|
+
|
|
14
|
+
- [ ] `terml --reuse <FILE>*` uses current terminal window (if given)
|
|
15
|
+
- needs Terminator's DBus API (`remotinator`), which cannot set ratios,
|
|
16
|
+
cwd, font size, window position or size - see AGENTS.md
|
|
17
|
+
- [ ] virtual desktop support
|
|
18
|
+
- [ ] convenient tmux support (`tmux: true` runs a tmux session for element)
|
|
19
|
+
|
|
20
|
+
## done
|
|
21
|
+
|
|
22
|
+
- [x] 2026-12-01: project scaffolding: YAML based spawner for `terminator`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# terml prompts
|
|
2
|
+
|
|
3
|
+
* 2026.12.01-10:30: read @ideas.md and @example-session.yaml, ask questions and
|
|
4
|
+
make a plan
|
|
5
|
+
* 2026.12.01-10:54: make sure bashrc zshrc are being executed as they would
|
|
6
|
+
normally - e.g. I have a function `banner` defined which currently can't be
|
|
7
|
+
executed (not found). also: add 'maximize' (same rules as 'fullscreen',
|
|
8
|
+
applicable on top elements only), which maximizes the window (without
|
|
9
|
+
fullscreen)
|
|
10
|
+
* 2026.12.01-11:10: commit your changes separately
|
|
11
|
+
* 2026.12.01-11:12: Committing per prompt it is!
|
|
12
|
+
* 2026.12.01-11:50: add an `disabled: <bool>` attribute (which plainly ignores
|
|
13
|
+
the whole item and it's sub-items)
|
|
14
|
+
* 2026.12.01-11:56: read items in the order found in the yaml and treat `ratio`
|
|
15
|
+
as 'part of the rest', so ratio 50% / ratio 50% will give the first element
|
|
16
|
+
50% of the space, the second 50% of the rest (25%) if there are further
|
|
17
|
+
elements (ignored if thre are none)
|
|
18
|
+
* 2026.12.01-11:58: accept percentages in pos/size (even mixed), so
|
|
19
|
+
`size: [300, 100%]` will result in width 300px horizontally, and 100%
|
|
20
|
+
vertically
|
|
21
|
+
* 2026.12.01-12:01: allow a top level map, too: `children: [..]` at top-level
|
|
22
|
+
would make it the same as a top level list. top level
|
|
23
|
+
`{font: 20, children: [..]}` would apply font to all windows then
|
|
24
|
+
* 2026.12.01-12:03: add support for reading from stdin:
|
|
25
|
+
```
|
|
26
|
+
terml - <<'EOF'
|
|
27
|
+
- {..}
|
|
28
|
+
- {..}
|
|
29
|
+
EOF
|
|
30
|
+
```
|
|
31
|
+
* 2026.12.01-12:11: implement --version
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "terml-spawner"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "YAML based spawner for Terminator"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
dependencies = ["configobj>=5.0.8", "pyyaml>=6"]
|
|
8
|
+
|
|
9
|
+
[project.scripts]
|
|
10
|
+
terml = "terml:main"
|
|
11
|
+
pyterml = "terml:main"
|
|
12
|
+
|
|
13
|
+
[dependency-groups]
|
|
14
|
+
dev = ["pytest>=8"]
|
|
15
|
+
|
|
16
|
+
[build-system]
|
|
17
|
+
requires = ["hatchling"]
|
|
18
|
+
build-backend = "hatchling.build"
|
|
19
|
+
|
|
20
|
+
[tool.hatch.build.targets.wheel]
|
|
21
|
+
packages = ["src/terml"]
|
|
22
|
+
|