GNU screen dynamic title

453 views Asked by At

I have a setting that works on one computer (Linux mint 18.3 sylvia) and not on another one (Ubuntu 14.04.5 LTS) and I don't really know what to check to find the problem :

I'm using GNU screen and I put the name of each window, which change dynamically while I'm changing directory or running a task.

for example if I prompt cd ~/desktop it will show ~/desktop cd ~/desktop. if then I prompt cd .. it will show ~ cd ...

the problem is, on the second computer, it doesn't work, or rather, it half work, but I don't understand how.

here is how the config should work : one part is in the .screenrc file and the other part in the .zshrc file.

.screnrc :

hardstatus string "%{= KW}%n %t %=%c %D %d-%m-%y"

%t is the part for title, and should be expand with PATH_SPACE_STRING

it works thanks to what I put in the .zshrc file, which make the shell to output a title escape sequence (esc k title esc ) as asked here https://www.gnu.org/software/screen/manual/html_node/Dynamic-Titles.html

.zshrc :

preexec () {                                                               
 if [[ $TERM == screen* ]]; then                                           
   print -Pn '\ek%~ $1\e\\'                                            
 fi                                                                        
}

where %~ stand for the current path, and $1 is the string typed in the prompt

but after several tests, I understand that the computer running Ubuntu does not listen to what I put inside the .zshrc file, but it expand anyway the %t into the path (so I've got the path as a title, and not the path plus the prompt command)

what can give screen the instruction of dynamically put the current path as a title, if not what I wrote in the .zshrc file? and how to overwrite it?

0

There are 0 answers