Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tmuxinator sets pane title via .yml file with original tmux manual solution #873

Open
Adelante10k opened this issue Dec 27, 2022 · 0 comments

Comments

@Adelante10k
Copy link

Adelante10k commented Dec 27, 2022

This solution solves: #586 #582 #548

In tmux.conf you must have:

set-option -g allow-rename off
set -g pane-border-status top # or bottom if you like
set -g pane-border-format "#{pane_index}#{?@custom_pane_title,:#{@custom_pane_title},}:#{pane_title}"

According to the tmux manual page, you need to specify the panel number and window name in the .yml file:
man tmux | col -bx | grep -A 4 "^ *target-pane" | head -5

     target-pane (or src-pane or dst-pane) may be a pane ID or takes a similar
     form to target-window but with the optional addition of a period followed
     by a pane index or pane ID, for example: ‘mysession:mywindow.1’.  If the
     pane index is omitted, the currently active pane in the specified window is
     used.  The following special tokens are available for the pane index:

Example tmuxinator set pane title via your .yml file:

# /home/focus/.config/tmuxinator/test2.yml

name: test2
root: ~/

windows:
    - queen:
        layout: tiled
        panes:
          - one:
            - tmux select-pane -T my-first-pane-title -t queen.0 #queen is the window name; .0 is the first pane of window called queen
            - pwd            
          - two:
            - tmux select-pane -T my-second-pane-title -t queen.1 #queen is the window name; .1 is the second pane of window called queen
            - cat etc/os-release
          - three:
            - tmux select-pane -T my-third-pane-title -t queen.2  #queen is the window name; .2 is the third pane of window called queen
            - echo It works
          - four:
            - tmux select-pane -T my-fourth-pane-title -t queen.3 #queen is the window name; .3 is the fourth pane of window called queen
            - whoami
    - king:
        layout: tiled
        panes:
          - one:
            - tmux select-pane -T my-first-pane-title -t king.0 #king is the window name; .0 is the first pane of window called king
            - pwd            
          - two:
            - tmux select-pane -T my-second-pane-title -t king.1 #king is the window name; .1 is the second pane of window called king
            - cat etc/os-release
          - three:
            - tmux select-pane -T my-third-pane-title -t king.2 #king is the window name; .2 is the third pane of window called king
            - echo It works
          - four:
            - tmux select-pane -T my-fourth-pane-title -t king.3 #king is the window name; .3 is the fourth pane of window called king
            - whoami

The window name must be specified because these commands will most likely be run while another window is "active". It's probably a good idea to include the session name too if you don't intend to instantly attach to the new session.

Proof that tmuxinator correctly sets the pane title via the .yml file:

w1

w2

I hope this solution will help others as well.

@Adelante10k Adelante10k changed the title Tmuxinator pane title does not work in any scenario - It doesn't even run "tmux select-pane -T" via yml file Tmuxinator sets pane title via .yml file with original tmux manual solution Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant