iTerm tracks the wrong PWD when using a wrapper to launch the shell
I have this wrapper set as my default shell:
#!/bin/dash
export PATH="${HOME}/bin:/usr/local/bin:$PATH"
dis="$(redis-cli --raw get bicon_zsh_disabled)" || true
if test -z "$dis" ; then
BICON_MODE=y bicon.bin zsh "$@"
else
zsh "$@"
fi
(This wraps the shell in bicon
to make it RTL compatible. The issue happens when dis
is non-empty and thus bicon
is not used, so it has nothing to do with bicon
.)
This causes iTerm to no longer track the PWD correctly, and opening new tabs doesn't use the PWD of the shell that opened it.
I tried using
iterm2_set_user_var() {
printf "\033]1337;SetUserVar=%s=%s\007" "$1" $(printf "%s" "$2" | base64 | tr -d '\n')
}
iterm2_set_user_var currentDirectory $PWD
But this did nothing.
The tab title still shows the correct PWD though.
Edited by NightMachinery