Documentation
¶
Index ¶
- Constants
- func FindClosestSlot(x, y int, state *State) int
- func FindTerminalAtSlot(slotIdx int, state *State) int
- func NavigateSlot(currentIdx int, dir Direction, rows, cols int) int
- func NavigateSlotSpatial(currentIdx int, dir Direction, positions []tiling.Rect, rows, cols int) int
- func NavigateTerminal(currentIdx int, dir Direction, count int) int
- type Action
- type BorderOverlay
- type Direction
- type HintPhase
- type LayoutProvider
- type Mode
- type MoveResult
- type OnMoveCompleteFunc
- type OverlayManager
- type Phase
- type State
- type TerminalActionRunner
- type TerminalSlot
Constants ¶
const ( ColorSelection = 0x3498db // Blue - window selection ColorGrabbed = 0x27ae60 // Green - grabbed window ColorTarget = 0x7f8c8d // Gray - target slot / empty slot preview ColorInactive = 0x95a5a6 // Light gray - non-selected terminals ColorHintText = 0xf5f7fa // Light text for hint overlay ColorHintBg = 0x1f2933 // Dark hint background )
Border colors
const BorderThickness = 4
Border thickness in pixels
const DefaultTimeout = 10
Default timeout for move mode (in seconds)
Variables ¶
This section is empty.
Functions ¶
func FindClosestSlot ¶
FindClosestSlot finds the slot index whose position is closest to the given point. Used when entering grabbed mode to start at the current window's slot.
func FindTerminalAtSlot ¶
FindTerminalAtSlot returns the index of the terminal at the given slot, or -1 if empty.
func NavigateSlot ¶
NavigateSlot calculates the new slot index after moving in a direction. Uses spatial navigation: arrow keys move in the grid based on direction. Wraps around at edges. NOTE: This assumes a uniform grid. For layouts with variable columns per row (like flexible_last_row), use NavigateSlotSpatial instead.
func NavigateSlotSpatial ¶
func NavigateSlotSpatial(currentIdx int, dir Direction, positions []tiling.Rect, rows, cols int) int
NavigateSlotSpatial navigates slots using actual slot positions. This handles layouts with variable columns per row (like flexible_last_row). Falls back to grid math if positions is empty.
Types ¶
type Action ¶
type Action int
Action represents a terminal action from move mode.
const ( // ActionNone means no action is pending. ActionNone Action = iota // ActionDeleteSelected removes the selected slot (requires confirmation). ActionDeleteSelected // ActionInsertAfterSelected inserts a terminal after the selected slot. ActionInsertAfterSelected // ActionAppend appends a terminal at the end. ActionAppend )
type BorderOverlay ¶
type BorderOverlay struct {
Top xproto.Window
Bottom xproto.Window
Left xproto.Window
Right xproto.Window
// contains filtered or unexported fields
}
BorderOverlay represents a rectangular border made of 4 thin windows
type HintPhase ¶
type HintPhase int
HintPhase controls which key legend is shown in the on-screen hint overlay.
type LayoutProvider ¶
type LayoutProvider interface {
GetActiveLayoutName() string
}
LayoutProvider supplies the currently active layout name.
type Mode ¶
type Mode struct {
// OnMoveComplete is called after a successful move/swap operation.
OnMoveComplete OnMoveCompleteFunc
// contains filtered or unexported fields
}
Mode is the main move mode controller
func NewMode ¶
func NewMode(backend platform.Backend, detector *terminals.Detector, cfg *config.Config, layoutProvider LayoutProvider) *Mode
NewMode creates a new move mode controller
func (*Mode) HandleArrowKey ¶
HandleArrowKey processes an arrow key press
func (*Mode) HandleCancel ¶
func (m *Mode) HandleCancel()
HandleCancel processes the Escape key press
func (*Mode) HandleConfirm ¶
func (m *Mode) HandleConfirm()
HandleConfirm processes the Enter key press
func (*Mode) UpdateConfig ¶
UpdateConfig updates the mode's configuration reference
type MoveResult ¶
type MoveResult struct {
// SourceSlot is the original slot index of the moved window.
SourceSlot int
// TargetSlot is the new slot index of the moved window.
TargetSlot int
// IsSwap indicates whether two windows were swapped.
IsSwap bool
}
MoveResult contains information about a completed move operation.
type OnMoveCompleteFunc ¶
type OnMoveCompleteFunc func(result MoveResult)
OnMoveCompleteFunc is called after a move operation completes. It receives the move result for post-processing (e.g., renaming tmux sessions).
type OverlayManager ¶
type OverlayManager struct {
// contains filtered or unexported fields
}
OverlayManager manages overlay windows for move mode
func NewOverlayManager ¶
func NewOverlayManager(xu *xgbutil.XUtil, root xproto.Window) *OverlayManager
NewOverlayManager creates a new overlay manager
func (*OverlayManager) Cleanup ¶
func (m *OverlayManager) Cleanup()
Cleanup destroys all overlay windows
func (*OverlayManager) HideAll ¶
func (m *OverlayManager) HideAll()
HideAll hides all overlays without destroying them.
func (*OverlayManager) Render ¶
func (m *OverlayManager) Render(terminalRects []tiling.Rect, terminalColors []uint32, slotRects []tiling.Rect, slotColors []uint32, allSlotRects []tiling.Rect, hintPhase HintPhase) error
Render draws borders for all terminals and all grid slots.
Slots are rendered first and terminals after, so terminal borders appear on top.
type Phase ¶
type Phase int
Phase represents the current phase of move mode
const ( // PhaseInactive means move mode is not active PhaseInactive Phase = iota // PhaseSelecting means user is choosing which window to move PhaseSelecting // PhaseGrabbed means a window is grabbed and user is choosing target slot PhaseGrabbed // PhaseConfirmDelete means user must confirm terminal deletion PhaseConfirmDelete )
type State ¶
type State struct {
Phase Phase
SelectedIndex int // Index of highlighted terminal in Terminals slice
GrabbedWindow platform.WindowID // Window ID of grabbed window (0 if none)
TargetSlotIndex int // Target slot index for grabbed window
PendingAction Action // Pending action awaiting confirmation
PendingSlot int // Slot index targeted by the pending action (-1 if none)
Terminals []TerminalSlot // Windows with slot assignments
SlotPositions []tiling.Rect // Grid slot geometries
GridRows int // Number of rows in the grid
GridCols int // Number of columns in the grid
}
State holds the current move mode state
func (*State) BeginDeleteConfirmation ¶
BeginDeleteConfirmation transitions state into delete-confirm mode.
func (*State) ClearPendingAction ¶
func (s *State) ClearPendingAction()
ClearPendingAction clears any pending in-mode action.
func (*State) SelectedTerminal ¶
func (s *State) SelectedTerminal() *TerminalSlot
SelectedTerminal returns the currently selected terminal, or nil if none
func (*State) TargetSlotRect ¶
TargetSlotRect returns the rect for the current target slot, or nil if invalid
type TerminalActionRunner ¶
TerminalActionRunner executes existing terminal CLI subcommands.
type TerminalSlot ¶
type TerminalSlot struct {
Window terminals.TerminalWindow
SlotIdx int // Index in the grid (0-based)
SlotRect tiling.Rect
}
TerminalSlot represents a terminal window with its assigned slot