Tilix: new terminal doesn't inherit directory from active

Created on 23 Jan 2018  路  9Comments  路  Source: gnunn1/tilix

Hi,
I'm a former gnomer-terminal user and (apart from the always useful tabs, that would be nice to navigate through subterminals inside tiles) I miss an important feature that on Tilix seems not to be working: when I create a new terminal/window I'd like for the new terminal to be inheriting the CWD from the former active terminal, ie. I press Ctrl+Alt+D while in a terminal where $CWD is /tmp, I want the new terminal/shell to have the same working directory /tmp
I thought the feature was available (although that setting label is a bit confusing as it seems to be available only for new windows)
image
But enabling or disabling this setting changes nothing in Tilix's behaviour about CWD for new terminals.

Thanks,
P.

question

Most helpful comment

Most likely the VTE configuration issue, please see https://github.com/gnunn1/tilix/wiki/VTE-Configuration-Issue

All 9 comments

Most likely the VTE configuration issue, please see https://github.com/gnunn1/tilix/wiki/VTE-Configuration-Issue

Hi @phw, thanks for the answer. I've already followed those instructions to properly set VTE when Tilix prompted me to, but without success. gnome-terminal uses the same VTE version as Tilix and it works as expected.

I'm pretty sure you still have an issue with vte configuration, what shell are you using, bash? If so what do you see when you run echo $PROMPT_COMMAND?

Here is my output, note the __vte_prompt_command, you should see the same in yours.

echo $PROMPT_COMMAND
_powerline_set_prompt __vte_prompt_command

Hi @gnunn1,
You're right, PROMP_COMMAND was not set, because of this line at the beginning of /etc/profile.d/vte.sh
[ "${VTE_VERSION:-0}" -ge 3405 ] || return 0

It turns out that VTE_VERSION is not set. I can't investigate the issue any further, but the whole thing looks like a bug to me. One thing that bugs me is, why does Tilix need PROMPT_COMMAND, while gnome-terminal's directory inheritance works without it?

BTW Setting PROMPT_COMMAND properly makes directory inheritance work.

I guess the issue is why you don't have VTE_VERSION in your environment variables whereas you do in gnome-terminal, When I run the following in tilix on my system it is there:

env | grep VTE_VERSION
VTE_VERSION=5002

However tilix does use dbus activation which can impact the environment variables that are set, however this variable looks like it is set by VTE itself:

https://github.com/GNOME/vte/blob/bca23e844378e57294c96661b5051ff199736cdc/src/pty.cc#L236

VTE_VERSION seems to be fine at times (I still don't know why it's not always set), but even so PROMPT_COMMAND was empty and I've found out why in ~/.bashrc

if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
   PROMPT_COMMAND=`custom_prompt`
fi

commented out this code everything started working fine

Glad you got it worked out.

It's still not clear why gnome-terminal doesn't need PROMPT_COMMAND though, while Tilix does, to retain CWD across new terminals.

gnome-terminal does need PROMPT_COMMAND in exactly the same way that tilix does since they both use the VTE widget and this widget is what is requiring PROMPT_COMMAND. Both tilix and gnome terminal require that /etc/profile.d/vte.sh be sourced and if you look at that file you can see that it is overriding the prompt command.

Not all distros source vte.sh correctly though and it's been a long standing pain point for terminal emulators based on VTE (gnome-terminal, tilix, terminator, etc). Tilix does try to detect this and warn you about it in a dialog that points you to different ways of resolving the issue.

It's less noticeable in gnome-terminal, because it only inherits CWD when creating new terminals as tabs or windows which carries less expectation of inheriting the CWD.

Hope this helps explain it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gnunn1 picture gnunn1  路  3Comments

huti26 picture huti26  路  3Comments

honze-net picture honze-net  路  3Comments

vaijab picture vaijab  路  3Comments

zsrinivas picture zsrinivas  路  4Comments