For quite a while, I've been using the supplied answers for Resume Zsh-Terminal (OS X Lion) to set the proxy icon for Terminal.app while running under zsh
, and so far, it's been working quite well. However, I recently noticed that running in zsh
under screen
, zsh
can no longer update Terminal.app about the current working directory.
After hunting around, it appears that screen
accepts different escape sequences (or something along those lines) in order to set its titles, and there seems to be some miscommunication between screen
and xterm
, but in all, I haven't been able to find a solution to fix this problem.
I've added the following line to my .screenrc
file, but to no avail:
termcapinfo xterm* 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
I've seen a lot of different 'solutions', but none of them specifically to support this - any help?
To clarify, as per Chris's comments below: previously, I used the following line to update Terminal:
printf '\e]7;%s\a' "${PWD// /%20}"
That doesn't work under screen, either because of how printf
functions, or because of the escape sequences used.
ESC ] 7 ; ... BEL
(set working directory) sequence on to the terminal, but it knows about codes 0 through 2 (set the window and tab titles). The answer to your question would involve figuring out how to get screen to pass code 7 (and 6) through to the terminal.termcapinfo
line posted up there be doing that?ts
is using “ESC ] 2”. If you want it to set the working directory, you’ll need to use “ESC ] 7” (and arrange to set the value to a “file:” scheme URL and percent-encode illegal characters). But I suspect you’ll need to deal with this some other way, becausets
is specifically meant to display a status/title string for human consumption, not to communicate the working directory to the terminal.