tmux display-menu
Display a menu on target-client.
Syntax
tmux display-menu [-O] [-c target-client] [-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.
-T is a format for the menu title (see
FORMATS).
-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 catalog |
Centered in the client |
popup_centre_y catalog |
Centered in the client |
popup_height catalog |
Height of menu or popup |
popup_mouse_bottom catalog |
Bottom of at the mouse |
popup_mouse_centre_x catalog |
Horizontal centre at the mouse |
popup_mouse_centre_y catalog |
Vertical centre at the mouse |
popup_mouse_top catalog |
Top at the mouse |
popup_mouse_x catalog |
Mouse X position |
popup_mouse_y catalog |
Mouse Y position |
popup_pane_bottom catalog |
Bottom of the pane |
popup_pane_left catalog |
Left of the pane |
popup_pane_right catalog |
Right of the pane |
popup_pane_top catalog |
Top of the pane |
popup_status_line_y catalog |
Above or below the status line |
popup_width catalog |
Width of menu or popup |
popup_window_status_line_x catalog |
At the window position in status line |
popup_window_status_line_y catalog |
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.
The following keys are also available:
| Key | Function |
| Enter | Choose selected item |
| Up | Select previous item |
| Down | Select next item |
| q | Exit menu |
C implementation
Internal declarations in tmux 3.2a:
Use from a library
These methods send display-menu. Each describes its own defaults, errors and execution model.
| Language | Methods |
|---|---|
| Python | Server |
| TypeScript | Pane |
| Rust | Server |
| Go | Server |
| C# | Server |
| Raku | Client Client |
No method in Ruby, Lua, PowerShell, Julia, Erlang, Elixir, Haskell, Common Lisp, Java, Clojure, Kotlin, Scala, F#, C++, Swift, OCaml, or Perl sends this command itself.
tmux sources and license
Syntax comes from tmux 3.2a list-commands. See the global options for sockets and configuration, and command syntax and targets.
Behavior is taken from the tmux 3.2a 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.