Sample Header Ad - 728x90

tmux quoting problem within display-menu

0 votes
1 answer
48 views
This command works as expected if I run it in the tmux command line:
list-panes -a -F "pane ID: #{p3:pane_id}  TTY: #{p11:pane_tty}"
Output:
pane ID: %1   TTY: /dev/pts/35
pane ID: %2   TTY: /dev/pts/36
pane ID: %3   TTY: /dev/pts/37
pane ID: %4   TTY: /dev/pts/38
But I fail in getting them to work within display-menu. The problem seems obvious (at least from my shell perspective): An additional level of quoting is required so that list-panes sees the format string and not its resolved value. But obviously I am doing it wrong:
bind-key C-t display-menu -T 'Test' \
    'List panes with tty' '' "list-panes -a -F 'pane ID: \#\{p3:pane_id\}  TTY: \#{p11:pane_tty}"
bind-key C-t display-menu -T 'Test' \
    'List panes with tty' '' {
        list-panes -a -F 'pane ID: #{p3:pane_id}  TTY: #{p11:pane_tty}'
    }
Output:
pane ID: %1   TTY: /dev/pts/35
pane ID: %1   TTY: /dev/pts/35
pane ID: %1   TTY: /dev/pts/35
pane ID: %1   TTY: /dev/pts/35
Asked by Hauke Laging (93688 rep)
Mar 9, 2025, 12:04 AM
Last activity: Mar 9, 2025, 10:40 AM