tmux display-menu
Display a menu on target-client.
Syntax¶
tmux display-menu [-MO] [-b border-lines] [-c target-client] [-C starting-choice] [-H selected-style] [-s style] [-S border-style] [-t target-pane] [-T title] [-x position] [-y position] name [key] [command] ...Alias: menu.
Behavior¶
A menu is passed as a series of arguments: first the menu item name, second the key shortcut (or empty for none) and third the command to run when the menu item is chosen. The name and command are formats, see the FORMATS and STYLES sections. If the name begins with a hyphen (-), then the item is disabled (shown dim) and may not be chosen. The name may be empty for a separator line, in which case both the key and command should be omitted.
-b sets the type of characters used
for drawing menu borders. See popup-border-lines
for possible values for border-lines.
-H sets the style for the selected
menu item (see STYLES).
-s sets the style for the menu and
-S sets the style for the menu border (see
STYLES).
-T is a format for the menu title (see
FORMATS).
-C sets the menu item selected by
default, if the menu is not bound to a mouse key binding.
-x and -y give
the position of the menu. Both may be a row or column number, or one of
the following special values:
| Value | Flag | Meaning |
C |
Both | The centre of the terminal |
R |
-x |
The right side of the terminal |
P |
Both | The bottom left of the pane |
M |
Both | The mouse position |
W |
Both | The window position on the status line |
S |
-y |
The line above or below the status line |
Or a format, which is expanded including the following additional variables:
| Variable name | Replaced with |
popup_centre_x |
Centered in the client |
popup_centre_y |
Centered in the client |
popup_height |
Height of menu or popup |
popup_mouse_bottom |
Bottom of at the mouse |
popup_mouse_centre_x |
Horizontal centre at the mouse |
popup_mouse_centre_y |
Vertical centre at the mouse |
popup_mouse_top |
Top at the mouse |
popup_mouse_x |
Mouse X position |
popup_mouse_y |
Mouse Y position |
popup_pane_bottom |
Bottom of the pane |
popup_pane_left |
Left of the pane |
popup_pane_right |
Right of the pane |
popup_pane_top |
Top of the pane |
popup_status_line_y |
Above or below the status line |
popup_width |
Width of menu or popup |
popup_window_status_line_x |
At the window position in status line |
popup_window_status_line_y |
At the status line showing the window |
Each menu consists of items followed by a key shortcut shown
in brackets. If the menu is too large to fit on the terminal, it is not
displayed. Pressing the key shortcut chooses the corresponding item. If
the mouse is enabled and the menu is opened from a mouse key binding,
releasing the mouse button with an item selected chooses that item and
releasing the mouse button without an item selected closes the menu.
-O changes this behaviour so that the menu does
not close when the mouse button is released without an item selected the
menu is not closed and a mouse button must be clicked to choose an
item.
-M tells tmux
the menu should handle mouse events; by default only menus opened from
mouse key bindings do so.
The following keys are available in menus:
| Key | Function |
Enter |
Choose selected item |
Up |
Select previous item |
Down |
Select next item |
q |
Exit menu |
C implementation¶
Internal declarations in tmux 3.7c:
Use from a library¶
Each API describes its own defaults, errors and execution model.
tmux sources and license
Syntax comes from tmux 3.7c list-commands. See the global options for sockets and configuration, and command syntax and targets.
Behavior is taken from the tmux 3.7c manual.
Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.