Currently, each new tab is opened in the $HOME folder (or in the folder where the first instance of kgx was launched).
Although all the piping is already in place to allow to open each new tab in the same folder than the current one, the problem is that VTE neither returns the current folder's URI, nor emits a signal when the user changed the current folder.
This is because VTE requires some help from the shell in order to know in which folder it is at each moment. The shell must emit the string each time the current folder changes or is set.
This can be achieved by setting PROMPT_COMMAND environment variable, like in !98 (closed), but it has the problem of being compatible only with BASH.
This MR, instead, achieves this by reading the CWD path in /proc. This is a trick used in Debian to allow to do this same thing in Gnome Terminal, as seen in:
The problem is that there is no way of detecting a change in the file (a GFileMonitor doesn't seem work), so it requires changes in order to read the path in the precise moment that a new page is created.