The useful site macosxautomation.com reveals that Terminal.app in Lion can use proxy icons, those document icons to the left of the window title in many apps. Right-clicking on that icon opens a menu and you can open your current directory (or its parents) in the Finder. You can also drag the proxy icon onto the desktop to create an alias to your current directory.
If you don't use bash (the default shell on Mac OS X), you won't see the new proxy icons, though.
Here's how I extended the proxy icons feature to zsh. To work, your shell has to use special escape codes to pass the current directory to Terminal.app. This is the same mechanism used to set custom title bars.
Apple placed code in /etc/bashrc to support proxy icons. With slight modification, that code can go into your ~/.zshrc and do the same thing:
The update_terminal_cwd function is Apple's, taken from /etc/bashrc. The last three lines are mine. They set up the proxy icon at the beginning of the shell session, and cause it to be updated every time you change directory. The code to do that in bash won't work in zsh.
[crarko adds: I haven't tested this one.]
If you don't use bash (the default shell on Mac OS X), you won't see the new proxy icons, though.
Here's how I extended the proxy icons feature to zsh. To work, your shell has to use special escape codes to pass the current directory to Terminal.app. This is the same mechanism used to set custom title bars.
Apple placed code in /etc/bashrc to support proxy icons. With slight modification, that code can go into your ~/.zshrc and do the same thing:
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
autoload add-zsh-hook
add-zsh-hook chpwd update_terminal_cwd
update_terminal_cwd
[crarko adds: I haven't tested this one.]
•
[4,995 views]

