Skip to content

Add session restore, sidebar tabs, overlay maximise, and pane chrome - #1127

Open
TIIEHenry wants to merge 211 commits into
gnome-terminator:masterfrom
TIIEHenry:main
Open

TIIEHenry wants to merge 211 commits into
gnome-terminator:masterfrom
TIIEHenry:main

Conversation

@TIIEHenry

Copy link
Copy Markdown

Summary

This is the full fork delta on top of current master (9f2d0b6c, the same tip as v2.1.6 plus #890). It is 192 commits, 136 files. The new behaviour is on by default, and each piece can be turned off in Preferences or in the config file.

  • Session save and restore. Windows, tabs, splits, working directories, the maximised pane and a manually set window title are saved while Terminator runs. A plain launch restores locked tabs, and any window that has no tab list. A normal exit forgets unlocked tabs. A kill or a crash restores every tab that was still open. --restore, --no-restore and --clear-session select that behaviour. Overlaps the request in Restoring all open terminals on restarting Terminator after graceful shutdown or a crash #1122.
  • Close confirmation only when a program other than the shell is still running. ask_before_closing = always keeps the old prompt.
  • Scrollback cache replays the last lines, with colours, after a restore. Fullscreen-program screens are not cached.
  • Sidebar tabs. Tabs are a tree on the left (tab_position = left). Drag to reorder, nest a tab as a pane, or move a pane out into its own tab. Each tab row has a lock, "Keep for next launch".
  • Window header bar like GNOME Terminal: sidebar toggle, find, and the terminal menu, with the theme's minimise, maximise and close buttons. borderless = True keeps the old undecorated window.
  • Pane chrome. Titlebars appear only when a window is split. The divider is a flat 1px line. A focused pane gets an accent border only while another pane is visible.
  • Overlay maximise. Ctrl+Shift+Return (and Ctrl+Shift+X) maximises one pane as an animated overlay. Shift+Escape restores it.
  • Automatic font scaling for small panes, with a titlebar badge to lock the size.
  • Scrollbar stays hidden until the scrollback can move, and hides while a fullscreen program (vim, less, htop, tmux) is running without resizing that program.
  • Wayland and HiDPI. Window position is not saved on native Wayland. Background images are drawn at native resolution under GDK_SCALE=2.
  • Default colours move to the built-in Deep teal profile and white pane titlebars. Profiles that already set colours are left alone. The old palette and the old red/grey titlebars are documented in CHANGELOG.md.
  • Simplified Chinese translations and updated man pages.

Test plan

  • tests/run_tests.sh on a machine with PyGObject, GTK and VTE
  • Plain launch, split a pane, lock one tab, quit normally, launch again: only the locked tab comes back
  • Kill the process instead of quitting: the next launch restores the tabs that were open
  • Overlay-maximise a pane (Ctrl+Shift+Return) and restore it (Shift+Escape), including a transparent background
  • Open vim or less and confirm the scrollbar hides without the terminal changing width
  • Check both X11 and native Wayland: size and maximised state restore; position is restored only on X11

Made with Cursor

Add ScrollbackCache with gi-free scrollback_text helpers, XDG cache
dir helper, default-on config keys, and Terminal hooks for dirty
marking, one-shot restore via vte.feed, close flush/delete, and
reset_clear. Duck-types SessionManager APIs so A can land later.
Do not touch preferences.glade (shared with A8+B5).
Add get_state_dir() and get_cache_dir() mirroring get_config_dir for
session.json and scrollback cache paths (no hostname; personal machine).
Implement SessionManager Borg with is_writer/is_owner, debounced
mark_dirty, save_now (is_writer even when final), stringify element-wise,
sanitize, crash marker, D5 closing buffer, will_persist, session_uuids,
and finalize() that flushes ScrollbackCache(sync=True) then stop().
Defaults ON: restore_last_session, session_save_delay_ms, session_file,
close_confirm_ignore. CLI --no-restore/--restore/--clear-session and
layout_from_default. Filter __last_session__ from list_layouts and save.
New close_confirm.request_close_terminal / scope_terminals. Process
rules: pid + descendants minus shells and close_confirm_ignore
(gitstatusd/ssh-agent/...). Wire construct_confirm_close and popup menu;
fix pre-existing missing import re in terminal_popup_menu.py.
Wire acquire_lock/set_owner/signals/restore before create_layout and
ScrollbackCache.start(). Idempotent on_destroy_event finalize/D5.
Last-terminal close finalizes before scrollback will_persist. Mark dirty
on split/remove/new_size/tabs/configure/cwd/zoom.
Cover stringify, sanitize, flock, atomic write, will_persist matrix,
save_now writer gate, crash marker, and close_confirm ignore/pid-None.
Add titlebar_buttons (True), titlebar_density ('standard') and
pane_accent_color ('#3fb950') to global_config. Terminator.reconfigure
now appends validated pane chrome CSS (focused border, titlebar buttons,
density) to the shared provider and re-applies titlebar chrome.
- Titlebar: terminal icon on the left; badge/gear/maximise/close on the
  right (flat 24px buttons, a11y names, tooltips with live keybindings).
  Buttons consume their own presses (no DnD, no double-click toggle);
  right-click on a button bubbles to the titlebar menu.
- Right-click anywhere on the titlebar opens the terminal menu through
  Terminal.popup_menu (preventHide) with skip_link_check and returns True;
  the gear opens the same menu anchored below the button.
- Close button -> close_confirm.request_close_terminal (D17 single path,
  same as menu Close).
- D15: EditableLabel(double_click_edit=False) emits 'double-clicked';
  double-click on the titlebar toggles pane maximise. 'Edit Title' menu
  item added (edit_terminal_title keybinding unchanged).
- Window: has_multiple_terms() counts visible terminals of the current
  tab; pane-maximise-changed(terminal, bool) signal + is_maximised_pane()
  shim emitted from legacy zoom/unzoom (module D replaces, same
  signature). Maximise icon/sensitivity only follow that signal,
  hierarchy changes and focus-in refresh (never optimistic on click).
- Menu: maximise sensitivity uses has_multiple_terms (fixes single
  terminal in a tab being enabled); labels 'Maximize pane'/'Restore pane'.
- Focused-pane 1px accent border via terminator-term-focused/unfocused
  classes; cleared on window focus-out.
- Titlebar.set_scale_badge(scale, locked) + scale_badge widget for E;
  'Lock font size for this terminal' menu hook (hidden until E provides
  set/get_auto_font_locked and auto_font_scale).
- Size text shown only ~1s after a resize; narrow titlebars collapse size
  text -> group name -> badge; buttons always stay.
Conflicts resolved (keep both A and B):
- terminal.py close(): finalize session on last terminal BEFORE
  ScrollbackCache.on_terminal_close so will_persist() keeps caches.
- terminal.py VTE hooks: keep A cwd dirty signal and B contents-changed.
- util.py: drop B's duplicate get_cache_dir (identical to A0's).

B's SessionManager duck-typed helpers now resolve to the real
session.py APIs (is_owner/restored_this_run/will_persist/session_uuids);
kept as-is since they are exception-safe.
- config.connect_gsetting_callbacks: only create Gio.Settings for schemas
  that exist. Gio.Settings.new() g_error-aborts (SIGTRAP, exit 133) when
  org.gnome.desktop.interface is not installed, which crashed any
  Config() construction (seen in tests on minimal boxes).
- config.get_system_focus: check wm.preferences schema (was checking
  desktop.interface, then instantiating wm.preferences). Pre-existing bug.
- Rename close_confirm.has_multiple_terms -> window_has_multiple_terminals
  to avoid confusion with the new Window.has_multiple_terms() from C.
- Creates/uses a venv with system site-packages (gi) and installs
  pytest/configobj/psutil if missing; VENV= overrides.
- Compiles a repo-local GSettings stub (tests/fixtures/schemas) into a
  temp dir only when org.gnome.desktop.interface/wm.preferences are not
  installed, so Gio.Settings never aborts (SIGTRAP 133).
- Starts Xvfb on a free display when DISPLAY is unset; cleans up on exit.
- Isolates XDG_CONFIG/STATE/CACHE_HOME in a temp dir, sets PYTHONPATH=.
- Auto-ignores ipc.py / plugins/command_notify.py only when dbus / Notify
  are unavailable. Extra args pass through to pytest.
Add terminatorlib/autofont.py (parse_tiers, select_font_tier with
hysteresis, cols_rows_from_base, validate) plus headless unit tests
covering the §E.1 example table. Register auto_font_scale* /
reading_measure_* defaults (ON) and document them; extend configspec
keymap with float.
Wire Terminal state machine (run/freeze/scaled_zoom), base-cell cache,
debounce, lock API for C's menu, compute/apply helpers for D, titlebar
set_scale_badge + popover + in-Terminal toast. Pause scaled_zoom before
get_zoom_data; schedule on paned split/remove/release. Skip preferences.glade
(serialized with A8/B5/C).
- preferences.glade: new Session tab between Layouts and Keybindings
  (restore toggle, read-only session info, save as layout, use previous
  session, clear session+cache, legacy plugin hint; scrollback cache
  toggle + lines spin + info). Global > Tabs grid gains titlebar_buttons,
  titlebar_density and pane_accent_color.
- prefseditor.py: set_values + handlers; cache toggle calls
  ScrollbackCache().reconfigure(); C options call Terminator().reconfigure().
- session.py: SessionManager.suspend_writes() so clear / use-previous are
  not overwritten by the running instance at exit.
- terminal.py: keybindings shortcut opens page 4 (Session took 3).
- doc: config keys for A/B.
- tests: glade load, defaults ON, round-trip, clear/restore-prev.
Conflict: doc/terminator_config.adoc — kept both the session/scrollback
keys (A/B/prefs) and the auto_font_scale* keys (E).
Auto-merged config.py, terminal.py, window.py, paned.py: verified A
finalize/scrollback close hooks, B contents-changed rebind, A cwd dirty
signal and E autofont hooks coexist; Paned.new_size session dirty kept.
Temporary Gtk.Overlay while maximised (never resident): placeholder in
slot, PaneFrame+DimLayer overlays, optional expand/restore animation.

- util.logical_parent skips Overlay/PaneFrame; enumerate_descendants
  counts via placeholder only (no double-count)
- Paned/Notebook.swap_child; get_visible_terminals maps placeholder→term
- Window: overlay_maximise/restore/transfer, get_child→layout root,
  zoom dispatch (overlay vs _legacy_*), pane-maximise-changed after
  final state, D16 Alt-direction transfer, closeterm snap-restore
- E freeze hooks: pause(freeze) → same-frame apply_font_tier_scale →
  resume (getattr-safe until E merges)
- Config defaults ON; restore_maximised=<Shift>Escape; CSS via
  pane_chrome_css; session maximised_pane save/restore
- No preferences.glade edits

Tests: 11 new pure/unit tests in test_paneoverlay.py
Conflicts:
- config.py: keep both E auto_font_scale* and D pane_overlay_maximise /
  pane_animation_*_ms / reduce_motion defaults.
- window.py _legacy_zoom/_legacy_unzoom: E's scaled_zoom pause/resume and
  D's equivalent getattr form; kept D's (logs failures). Overlay path
  uses E freeze contract: pause('freeze') -> compute_tier_for_size ->
  apply_font_tier_scale(toast=False) -> resume (names verified).

Follow-up in merge: close_confirm recognizes D's PanePlaceholder via
is_pane_placeholder so D17 scope delegates to placeholder.terminal.
Bring prefs+E+M0 onto D. Keep both overlay and autofont config defaults;
align legacy scaled_zoom pause/resume with E's API while retaining dbg.
Global page, below the title bar options (serial glade lane after
A8/B5/C0):
- D: "Maximise panes as an overlay" toggle, reduce motion
  (system/on/off), maximise/restore animation durations (ms).
- E6: auto font scale toggle, badge toggle, reading measure min columns
  (badge/measure insensitive while auto scale is off).
- Terminal.on_auto_font_config_changed(): re-apply after prefs change and
  clear an earlier invalid-config latch; off resets scale to 100%.
- PrefsEditor accepts a page name (PAGE_IDS -> glade page child) via
  resolve_page(); key_preferences_keybindings now opens 'keybindings'
  instead of the hard-coded index 4. Int indices still work.
- restore_maximised already listed in keybindings (config-driven).
… close

- Mark session dirty on custom title, group, and profile changes
- restore_prev_session() always suspends writes (safe for any caller)
- ScrollbackCache.start() refuses to revive after suspend_writes
- Fix exit_action=restart/hold: child-exited no longer sets debugserver
- Pre-existing: describe_layout profile check used layout != "default"
- Close-confirm uses logical_parent under overlay maximise
- Window+Terminal confirm counts real terminals, not is_zoomed alone
- PanePlaceholder maximised_pane uuid compare via str()
- Initialise _overlay before register_callbacks/apply_config so theme
  reconfigure → get_child() cannot AttributeError during Window.__init__
- Harden get_child/get_children/add against missing _overlay via getattr
- Scrollback restore_into/feed_notice encode UTF-8 for VTE 0.80 feed()
- Same encode for the two pre-existing vte.feed(str) error paths
… dirty

- auto_font_scale_min_rows 24 -> 10: reading-measure columns drive the
  decision; rows only shrink very short panes, so two stacked panes stay 100%
- Wave-style subtle titlebar defaults (dark bars, brighter focused title;
  focus cue is the accent border); receive/broadcast blue unchanged
- Titlebar edit-done marks session dirty only when the custom title changed
- Running from source: add data/icons to the icon theme search path
- toggle_zoom keeps upstream default <Shift><Control>x (overlay toggle)
Track the master design doc, A–E sub-plans (incl. M5 min_rows=10),
and the consolidated findings-summary. Skip deprecated impl draft and
raw review transcripts.
TIIEHenry and others added 10 commits October 10, 2026 21:48
…maximise snapshot

On top of m38's alpha capture: an alpha snapshot replaces what is under it
(OPERATOR_SOURCE, EXTEND_PAD) during the opaque phase, exactly like the live
VTE with a see-through background, so the dimmer no longer stacks on the
terminal's own alpha (a near-black pulse mid-flight); fading phase still
blends OVER. The placeholder slot skips its opaque fill in RGBA windows.
Tests: verbatim alpha copy, replace vs OVER, fade never punches holes,
SnapshotArea replace only for alpha snapshots, placeholder fill, reverse
during the expand hand-over re-hides the live frame.
… runs even if hinting fails; one-shot idle callbacks; tests
…eview: no P0/P1; picom probe 0 black frames)
Xft DPI / GNOME text-scaling / font metric changes re-measure the VTE
cell without resetting the cached base cell, so auto font size picked
tiers from stale metrics.  Handle char-size-changed: refresh the size
readout and geometry hints, and update/drop a base cell that no longer
matches (rounding-tolerant at non-1.0 tiers so our own tier changes are
ignored).
… to that list.

Dragging a tab or a child pane reorders it or changes its level. Closing asks only when a program other than the shell is still running.

Co-authored-by: Cursor <cursoragent@cursor.com>
…hile a fullscreen program is running.

Co-authored-by: Cursor <cursoragent@cursor.com>
@TIIEHenry

Copy link
Copy Markdown
Author
image

TIIEHenry and others added 19 commits October 13, 2026 11:23
Co-authored-by: Cursor <cursoragent@cursor.com>
…rome.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…one tier across equal panes.

Recover the unit cell from the live measurement so the grid is not resized under a fullscreen program.

Co-authored-by: Cursor <cursoragent@cursor.com>
The overlay covers the pane area. The left sidebar and a native tab strip stay visible and still take clicks. Margins follow the list width and text direction.
…L export, and let the next plain launch skip restore.
Hiding the bar no longer leaves an empty strip. The width is still recorded so the font tier does not follow those extra columns, and a redraw does not show the bar again.
Closing a pane from the sidebar, titlebar, or menu uses a popover; closing a window or tab still uses a dialog.

Co-authored-by: Cursor <cursoragent@cursor.com>
…hidden when a TUI starts with the bar already off screen.

VTE 0.68 only requests text, so a screenshot used to paste nothing. The image is saved under the cache and its shell-quoted path is pasted. Entering vim or less also latches that hidden width, so one redraw no longer flashes the bar back and resizes the grid.
…axis.

The old scaler gave up if either the width or the height stayed the same, so a normal split filled the window without making the text bigger.
…position when it is shown or hidden.

VTE can report a scrollable buffer for one signal before page_size updates. Showing the bar on that signal resizes the grid and the viewport jumps. The show waits until the adjustment has settled. A real show or hide puts back the position from before the resize.
…ollbar, and record the current behaviour where the next change can find it.

Co-authored-by: Cursor <cursoragent@cursor.com>
…nce a divider once per double-click.

The font tier for the destination is predicted while the pane has no parent, so it could not measure its page and skipped the TX-06.1 rule that keeps a pane of at least 45% at 100%. The arrival recompute then changed the font about 200 ms later. The page size is now passed in, and restore resumes the auto font from the slot size instead of the still-maximised allocation. A divider double-click also cleared its timestamp, so the next drag no longer balanced again.

Docs-Reviewed: terminatorlib The fix applies the existing TX-06.1 rule during overlay prediction; no documented interface or rule changed.
Co-authored-by: Cursor <cursoragent@cursor.com>
…divide splits evenly.

A collapsed alternate screen no longer gets its old offset written back, and automatic font size ignores the width a hidden scrollbar gives the terminal, so the tier does not step up and bring the bar back. Same-direction splits share the space. An optional bell mark and a DBus agent state can stay on a pane until it is read, the menus can turn automatic font size back on, and the about page points at this repository.

Co-authored-by: Cursor <cursoragent@cursor.com>
A tab lock belongs to the logical tab, so promoting a pane, merging
tabs, or restoring from a zoomed state keeps the keep-for-next-launch
locked status. Also add tracing for adjustment metrics and scrollbar
visibility changes.

Docs-Reviewed: terminatorlib preserve tab lock during layout operations without changing requirement semantics
Mock terminals and headless fixtures may not have a vadjustment
instance. Catch missing or non-numeric adjustment attributes so debug
logging does not abort scrollbar synchronization.

Docs-Reviewed: terminatorlib defensive check for vadjustment logging without requirement changes
…lumns change, and publish the font tier with the grid a TUI is drawing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants