Skip to content

feat: drag panes to move/swap, plus a clearer tab-drag affordance #93

Description

@GeneralD

type scope complexity AI part of

Part of #77 (mouse-interaction tracking).

Motivation

The minimap already supports point interactions — click a pane to focus it (#74), click a tab to switch (#8), scroll to walk tabs/panes (#80), and drag a tab block to reorder it (#10). The natural next step is drag-to-move: grab a pane in the minimap and drop it where you want, the same way you'd rearrange windows in a tiling WM — directly and spatially, without memorizing a keybind chord.

Proposal

Roughly in order of ambition:

1. Drag a pane to move/swap it within its tab

Press on a minimap pane cell, drag, release on another pane cell → move/swap those panes within the tab's layout. This builds directly on the position→pane hit-test from #74 (minimap::pane_at_cell, TabPaneGeom) and the grab/hold/release state machine from #10 (DragState, grab_at / mark_dragging / commit_drag_at).

Open question: zellij's pane-move primitives are direction-based (MovePane, MovePaneBackwards), not "swap pane A with pane B". We need to verify whether an arbitrary drop target can be reached deterministically by emitting a sequence of directional moves, or whether a swap-/move-by-id API is usable from a plugin. Like reorder, this needs RunActionsAsUser (already gated behind the reorder flag, #23).

2. Drag a pane across tabs

Drop a pane onto a different tab's block → move the pane out of its current tab into the target. Conceptually adjacent to #80's "pane mode walks across tab boundaries". zellij has break-pane / move-pane-to-tab style actions to investigate (BreakPane*).

3. Tab-reorder vs pane-drag — disambiguate the gesture (UI under discussion)

Today any drag on a tab block reorders the tab (#10). Once pane cells become draggable, that gesture is overloaded: does dragging inside a tab mean "move this pane" or "reorder this tab"? We want to keep drag-to-reorder for tabs but give it a dedicated affordance so the two never collide. Two candidates:

  • (a) Top-row grab — dragging the tab's top row (the title/header strip, above the pane minimap) reorders the tab; dragging a pane cell moves the pane.
  • (b) Drag-handle icon — a small grip glyph placed next to the close button (mouse: an 'x' close button on each tab block (click hit-test) #86), grabbed explicitly for tab reordering.

Note

This is the main open design question. Sketch of the trade-offs:

  • (a) costs no horizontal space and is discoverable ("grab the header"), but the top row is thin (1 cell), so the hit target is small, and it competes with the close button / any future header controls.
  • (b) is explicit and unambiguous, but consumes a column per tab and couples to mouse: an 'x' close button on each tab block (click hit-test) #86's close-button layout.

4. (Stretch) animation-like feedback during drag

A plugin only repaints on events and zellij pushes no frame clock, so true tweened animation isn't really on the table. But cheap "animation-ish" cues are: lift/shadow the grabbed pane (reuse the perspective depth effect from #66), highlight the drop target, or slide the insertion gap. Lowest priority — explicitly optional.

Relevant Code

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestinteractionMouse / keyboard interaction

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions