Overview
tmux includes a sophisticated terminal feature detection system that automatically identifies and enables advanced terminal capabilities. This allows tmux to provide enhanced functionality when the underlying terminal supports it.Terminal Features System
Feature Detection
tmux detects terminal features through multiple mechanisms:- terminfo capabilities: Standard terminal database entries
- Terminal type identification: Recognizing specific terminal emulators
- Device Attributes (DA): Querying the terminal at runtime
- Manual specification: Using the
terminal-featuresoption
tty-features.c.
Available Terminal Features
tmux supports the following terminal features:Color Support
tty-features.c:116-128, the RGB feature includes:
setrgbf: Set RGB foreground color (\E[38;2;%p1%d;%p2%d;%p3%dm)setrgbb: Set RGB background color (\E[48;2;%p1%d;%p2%d;%p3%dm)- Support for 256-color palette alongside RGB
Text Attributes
Strikethrough
Strikethrough
Enables strikethrough text formatting:Implemented as escape sequence:
\E[9mOverline
Overline
Enables overline text attribute:Sequence:
Smol=\E[53m (from tty-features.c:144-152)Underscore Styles
Underscore Styles
Advanced underscore styling with colors:Supports:
- Different underscore types (single, double, curly, dotted, dashed)
- Underscore colors independent of text color
- RGB colors for underscores
tty-features.c:155-166:Smulx: Set underscore styleSetulc: Set underscore RGB colorSetulc1: Set underscore palette color
Advanced Features
Title Setting
Window title escape sequences:From
tty-features.c:51-60:tsl=\E]0;- To status linefsl=\a- From status line
Clipboard
OSC 52 clipboard integration:Sequence:
Ms=\E]52;%p1%s;%p2%s\a (tty-features.c:86-94)Mouse Support
Xterm-style mouse tracking:Capability:
kmous=\E[M (tty-features.c:75-83)Focus Reporting
Focus in/out events:From
tty-features.c:181-190:- Enable:
Enfcs=\E[?1004h - Disable:
Dsfcs=\E[?1004l
Cursor Customization
Cursor Styles
tty-features.c:193-202:
Ss=\E[%p1%d q- Set cursor styleSe=\E[2 q- Reset cursor style
Cursor Colors
tty-features.c:205-214:
Cs=\E]12;%p1%s\a- Set cursor colorCr=\E]112\a- Reset cursor color
Modern Terminal Features
- Extended Keys
- Synchronized Updates
- Hyperlinks
- Bracketed Paste
Enhanced keyboard protocol support:From
tty-features.c:239-248:- Enable:
Eneks=\E[>4;2m - Disable:
Dseks=\E[>4m
Graphics Features
Sixel Graphics
tty-features.c:350-358, enables sixel image support when compiled with the appropriate libraries.
DECFRA Rectangle Fill
tty-features.c:265-273, enables fast rectangle filling operations:
- Capability:
Rect - Used for optimized screen redraws
DECSLRM Margins
tty-features.c:251-262, scroll region margins:
- Enable:
Enmg=\E[?69h - Disable:
Dsmg=\E[?69l - Set margins:
Cmg=\E[%i%p1%d;%p2%ds
Default Terminal Configurations
tmux includes predefined feature sets for popular terminals (fromtty-features.c:468-514):
Modern Terminals Base Set
Most modern terminals support:- tmux
- iTerm2
- XTerm
- mintty
- foot
- rxvt-unicode
When running tmux inside tmux:
Configuration Examples
Override Terminal Type
Force specific features for all terminals:~/.tmux.conf
Working Directory Tracking
OSC 7 Support
Disable Specific Features
To disable features that cause problems:tty-features.c:276-347, this disables kf0 through kf63 terminal capabilities.
Feature Application
Feature Detection
tmux applies features in this order:
- Default features based on
$TERMenvironment variable - Device Attributes response (if available)
- User-specified
terminal-featuresoption
Best Practices
Let tmux auto-detect features when possible - manual overrides may cause issues
Test feature changes thoroughly - some terminals report capabilities they don’t fully support
Use wildcards carefully -
* matches all terminal typesDebugging Features
Enable tmux logging to see feature detection:Related Configuration
terminal-overrides- Override specific capabilitiesdefault-terminal- Set TERM value inside tmuxallow-passthrough- Control escape sequence passthrough