remi / teamocil

There's no I in Teamocil. At least not where you think. Teamocil is a simple tool used to automatically create windows and panes in tmux with YAML files.
MIT License
2.35k stars 101 forks source link

Windows' name is not set to its expected value #84

Closed Taluu closed 9 years ago

Taluu commented 9 years ago

Let's say I have the following config:

name: Random session                                                                                                                                                                                                      
windows:
  - name: Common
    root: ~/path/to/root
    layout: tiled
    focus: true
    panes:
      - first-panel
      - second-panel

The session name is correctly set, but the window name seems to be whatever the first panel command line was instead of expected "Common"

remi commented 9 years ago

What is your tmux’s window-status-format and window-status-current-format?

$ tmux show-window-option -g window-status-format
$ tmux show-window-option -g window-status-current-format
Taluu commented 9 years ago
$ tmux show-window-option -g window-status-format
window-status-format "#I:#W#F"
$ tmux show-window-option -g window-status-current-format
window-status-current-format "#I:#W#F"

I think this is the default option (I didn't changed it in my tmux config)

And if I'm doing a :rename-window Common while I'm in my session, the window's name is correctly updated

remi commented 9 years ago

Can you run

$ tmux --debug layout_name

So we can see which commands are sent to tmux by teamocil? Thanks!

Taluu commented 9 years ago
$ teamocil --debug my_layout
tmux rename-session 'Random session'
tmux send-keys -t 0 'cd "~/path/to/root"'
tmux send-keys -t 0 'Enter'
tmux rename-window 'Common'
tmux send-keys -t 0 'first-panel'
tmux send-keys -t 0 'Enter'
tmux split-window -c '~/path/to/root'
tmux send-keys -t 1 'second-panel'
tmux send-keys -t 1 'Enter'
tmux select-layout 'tiled'
tmux select-pane -t 0
tmux select-window -t 0 

This is a bit changed, as I removed the thing that doesn't concert this ticket, but the operation order is the same. As I have mutliple windows, you can also add a tmux new-window -n 'Another window' -c '~/path/to/another-root'

Taluu commented 9 years ago

After some more tests, it seems that tmux is resetting the window name after making a new split panel (but not a new window).

If that is indeed the case, I think the tmux rename-window command should be sent after the splitting is done ?

remi commented 9 years ago

After some more tests, it seems that tmux is resetting the window name after making a new split panel (but not a new window).

What is your tmux version (tmux -V)? It doesn’t make sense for tmux to reset the window name after creating a new pane. This is not the behavior users want when they manually create a new pane in the window anyway.

I also don’t see this behavior when I run a layout with --here on my teamocil/tmux setup.

Taluu commented 9 years ago
$ tmux -V
tmux 1.9a
Taluu commented 9 years ago

something even stranger ; it seems that the window changes its name with the last input on any panel that makes this window... Is it maybe due to my tmux configuration ?

set-option -g default-shell "/usr/bin/zsh"

setw -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window off
set -g mouse-utf8 on

# vi for the win
set-window-option -g mode-keys vi

# vim ftw !
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection

# from http://unix.stackexchange.com/a/16405
# move x clipboard into tmux paste buffer
bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
# move tmux copy buffer into x clipboard
bind-key -t vi-copy y copy-pipe 'xclip -selection clipboard >/dev/null'
remi commented 9 years ago

Does the "last input on any panel" behavior happens even without using teamocil? If so, it looks like this is a tmux bug or something related to your .tmux.conf. You might have better luck trying to solve it with the tmux community :smile:

Taluu commented 9 years ago

seems to be the case ; closing then. :)

remi commented 9 years ago

Alright, good luck!

Taluu commented 9 years ago

Found what was wrong ; it appears to be due to (oh-my-?)zsh which behaves incorrectly. Found the solution in http://superuser.com/questions/306028/tmux-and-zsh-custom-prompt-bug-with-window-name :)