2

I have a problem with the tmux 2.1 status bar. As the manual explains I'd write in ~/.tmux.conf it:

set -g status-right "#(/bin/pwd) %R %d/%m/%g"
set -g status-interval 1

After I start tmux in status bar is /home/conformist. But if I change cwd (like cd /) — status bar is still $HOME.

Everything works perfect if I change conf to:

set -g status-right "#{pane_current_path} %R %d/%m/%g"

I'd like to look in status bar $HOME like ~ and cannot do this, because pwd doesn't change (and pwd | perl -pne s-$HOME-~- doesn't work too).

1

Calling /bin/pwd like that will not work because the program is run by the same process (it is not your shell). If you are using bash, you can modify your prompt to send an escape sequence to tmux to change the window name using the escape sequence shown as an example:

printf '\033kWINDOW_NAME\033\\'

Here is a separate shell script to demonstrate the escape sequence:

#!/bin/sh
printf '\033k%s\033\\' $(pwd)

It is not the same escape sequence used for xterm titles, but you can apply the advice in the Bash Prompt HOWTO in the same way.

Further reading:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.