Skip to content

Add "Move to new tab" option for split terminals - #1146

Open
iam-shanmukha wants to merge 1 commit into
gnome-terminator:masterfrom
iam-shanmukha:feature/move-to-new-tab
Open

iam-shanmukha wants to merge 1 commit into
gnome-terminator:masterfrom
iam-shanmukha:feature/move-to-new-tab

Conversation

@iam-shanmukha

Copy link
Copy Markdown

Overview

Currently, Terminator allows splitting terminals horizontally and vertically, zooming them temporarily, and opening new empty tabs. However, there is no direct option to take an existing split terminal pane and move it into its own full-screen tab while preserving the running shell session, command history, and active processes.

This PR adds a "Move to new tab" option in the terminal context menu (as well as a configurable shortcut action in Preferences) for split terminals.

Details

  • Terminal.can_move_to_new_tab() & Terminal.move_to_new_tab():
    • Checks if the terminal is in a split container (Paned).
    • Detaches the terminal from its parent Paned.
    • Triggers hoover() on the parent Paned so the remaining sibling terminal expands to occupy the full container/tab.
    • Creates a new Notebook if the window is not yet tabbed, or appends a new tab to the existing Notebook.
    • Inserts the extracted terminal into the new tab and focuses it.
    • Keeps all running processes and PTY state intact without restarting the shell.
  • Context Menu:
    • Added Move to _new tab in TerminalPopupMenu directly after Open _Tab.
    • Dynamically set to sensitive/enabled only when the terminal is part of a split container (can_move_to_new_tab()), and greyed out when already alone in a tab or window.
  • Keybindings & Preferences:
    • Registered move_to_new_tab in default keybindings and PrefsEditor so users can assign a keyboard shortcut.
  • Fix in Notebook.remove:
    • Gtk.Notebook.detach_tab takes a Gtk.Widget instance, but page_num (int) was being passed. Fixed to pass widget to prevent TypeError: argument child: Expected Gtk.Widget, but got int.
  • Robustness in Terminator.find_terminal_by_uuid:
    • Added check for uuid attribute on terminal objects before accessing terminal.uuid.urn.

Testing

  • Added unit tests in tests/test_move_to_new_tab.py:
    • test_can_move_to_new_tab_single_terminal
    • test_can_move_to_new_tab_split_terminals
    • test_move_to_new_tab_without_existing_notebook
    • test_move_to_new_tab_with_existing_notebook
    • test_move_to_new_tab_nested_paneds
  • Verified with pytest (all 36 tests passing).
  • Verified script compilation with python3 -m compileall -f terminatorlib/ tests/ remotinator terminator.
  • Tested interactively in a running Terminator session.

- Add move_to_new_tab() and can_move_to_new_tab() in Terminal class
- Add 'Move to new tab' right-click popup menu item
- Add move_to_new_tab keybinding option in preferences and config
- Fix Gtk.Notebook.detach_tab argument in notebook.py
- Add comprehensive unit tests in tests/test_move_to_new_tab.py
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.

1 participant