Link and move windows between sessions
Needs libtmux for PowerShell 0.x Install
A tmux window can sit at different indices in several sessions. Read it through
the session whose placement you want to change: its Window handle captures
that session and index. From an explicit endpoint, choose the source
window and destination session. The examples use $window and $session from
the same server.
Link the window into the destination session at index 5 while leaving that session’s selected window alone:
$window | New-TmuxWindowLink -Session $session -Index 5 -NoSelect -Confirm:$falseThe command emits no placement handle. Read the destination session’s windows and select the new link by physical ID and destination index:
$window = $session | Get-TmuxWindow | Where-Object { $_.Id -eq $window.Id -and $_.Index -eq 5 }-ReplaceExisting lets tmux displace a window already at the index, and that
window is destroyed if this was its last link.
Move the link from index 5 to index 6 in the same session. Keep the returned replacement handle because the original still describes the old placement:
$window = $window | Move-TmuxWindow -Index 6 -PassThru -Confirm:$false-DestinationSession $otherSessionmoves the link to another session on the same endpoint and daemon generation.- Without
-Index, the next free index is used. -Direction BeforeorAfterinserts relative to a destination.-NoSelectkeeps the destination’s current selection.
Remove only this session’s link to the window. Links in other sessions and their panes remain:
$window | Remove-TmuxWindowLink -Confirm:$falseWithout -KillIfLast, tmux refuses to remove a window’s final link. With it,
the final unlink destroys the window and its panes. To destroy a window and
every link on purpose, use Remove-TmuxWindow.
- The three commands ask for confirmation by default, and
-WhatIfpreviews without contacting tmux. - A stale source placement is rejected in tmux’s native queue. Link and cross-session move also reject a destination session from another endpoint or daemon generation before dispatch.
- A failed move readback can follow a successful dispatch. Inspect the topology before retrying.
More: command reference.