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

display local command or ssh hostname in window format #179

Open
divansantana opened this issue Aug 11, 2018 · 4 comments
Open

display local command or ssh hostname in window format #179

divansantana opened this issue Aug 11, 2018 · 4 comments

Comments

@divansantana
Copy link

Now that #178 is sorted, a separate much more minor issue 😬

How does one achieve something like this:

1 htop 2 remotehost1 3 remotehost2 4 zsh

IE display the command if local, else display the ssh hostname. This almost works.

tmux_conf_theme_window_status_format='#I #W #{hostname_ssh}'
tmux_conf_theme_window_status_current_format='#I #W #{hostname_ssh}'

The above results in something like this which is a little less ideal because of screen estate:

1 htop 2 ssh remotehost1 3 ssh remotehost2 4 zsh
@gpakosz
Copy link
Owner

gpakosz commented Aug 11, 2018

$ tmux setw automatic-rename-format '#{?pane_in_mode,[tmux],#{?#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D),#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D),#{pane_current_command}}}#{?pane_dead,[dead],}'

This mostly does what you want but

  • is overkill
  • sometimes lags behind

I'm not sure how to achieve it efficiently for now

@divansantana
Copy link
Author

@gpakosz Cool this is minor. It doesn't really bother me too much.

Thanks!

@gpakosz
Copy link
Owner

gpakosz commented Sep 14, 2018

Hi @divansantana

The following should be less heavy

tmux setw -g automatic-rename-format "#{?pane_in_mode,[tmux],#{?#{m:*ssh,#{pane_current_command}},#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D),#{pane_current_command}}}#{?pane_dead,[dead],}"

@mattboy9921
Copy link

Hi @gpakosz,
Can you tell me where to run this? I tried it just in bash on the machine running tmux and also putting it in my .tmux.conf.local file but it doesn't do anything for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants