Overview
A window in tmux occupies the entire screen and may be split into rectangular panes. Each window is a full-screen container that belongs to one or more sessions and can display multiple terminal panes. From the man page (tmux.1:48-62):Each session has one or more windows linked to it. A window occupies the entire screen and may be split into rectangular panes, each of which is a separate pseudo terminal.
Window Architecture
Fromwindow.c:36-53, windows are implemented as:
Creating Windows
Fromwindow.c:294-339, window creation involves:
- Assigning a unique window ID (prefixed with
@) - Setting initial dimensions and pixel sizes
- Initializing the panes list
- Creating the options hierarchy
- Recording creation and activity time
Window Identification
Windows can be identified by:- Window ID: Prefixed with
@(e.g.,@0,@1) - unique and unchanging - Window index: Numeric position in session (e.g.,
0,1,2) - Window name: Descriptive name set by user or automatic naming
Special Window Tokens
From tmux.1:835-845:Window Naming
Fromwindow.c:407-412:
- Manual Naming
- Automatic Naming
Window Navigation
Key Bindings
From the man page default key bindings (tmux.1:307-348):Prefix 0-9- Select windows 0 to 9Prefix c- Create a new windowPrefix ,- Rename the current windowPrefix &- Kill the current windowPrefix n- Change to the next windowPrefix p- Change to the previous windowPrefix l- Move to the previously selected windowPrefix w- Choose the current window interactivelyPrefix f- Prompt to search for text in open windows
Switching Windows
Fromsession.c:417-466, window switching maintains a “last window” stack:
Window Linking
Windows can be linked to multiple sessions through thewinlink structure. From window.c:98-133:
Window Resizing
Fromwindow.c:414-431, windows can be resized:
Window Monitoring
Activity Monitoring
Fromwindow.c:288-292:
Window Flags
Fromwindow.c:877-904, windows display flags in the status line:
Window Options
Windows have their own option scope:automatic-rename- Automatically rename windowsaggressive-resize- Resize based on active clientmonitor-activity- Monitor for activitywindow-status-format- Format for window in status linepane-base-index- Starting index for panes
Moving and Swapping Windows
Best Practices
- Use meaningful names: Name windows based on their purpose
- Organize logically: Keep related panes in the same window
- Monitor activity: Enable monitoring for background windows
- Set base index: Start window numbering at 1 for easier keyboard access
- Use window linking: Share windows between sessions when appropriate