0

I would like tmux to always show a list of the session's windows on the left.

When I click once on a window in the list, it should switch to that window on the right side (no preview - switch straight to it), and also switch focus to that window, but still keep the windows list open on the left with its line for the switched-to window now highlighted. The result would look similar to what mprocs provides.

I thought the choose-tree command might help, perhaps with a custom template. Normally choose-tree goes away after the user chooses a window, so maybe it would have to re-run after the user's choice (maybe in a 'while' loop).

How should I achieve this?

1 Answer 1

0

Create three sessions:

  • menu
  • windows
  • main, containing one window split horizontally into two panes running clients attached to the menu and windows sessions respectively.

In menu, run choose-tree in a loop with:

  • a filter that only shows windows from the windows session, and
  • a template that calls select-window:
while true; do
  tmux choose-tree -f '#{==:windows,#{session_name}}' \
    'select-window -t %%; select-pane -t main:0.1'
done

Attach to the main session.

To-do:

  • The selected window in menu jumps back to the top after selecting a window.
  • Window selection in menu requires a double-click instead of one click.
  • menu shows the windows session at the top (we just want a list of windows, not a tree).
  • menu does not auto-update when a new window is created in the windows session. It does, but with a delay.
  • menu does not auto-resize to the width of the longest window name.
  • menu does not have a 'new window' right-click menu entry.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .