Skip to content

Open new tabs in the current folder (first proposal)

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.

\ESC]6;CURRENT_FOLDER_URI\BELL

This patch achieves this by setting the PROMPT_COMMAND to:

echo -ne "\033]6;file://${PWD}\007"

Notice that VTE expects an URI, not a path; that's why the string includes a "file://" before $PWD.

The \ESC]7;XXXXX\BELL command changes the current folder URI, and the \ESC]6;XXXXX\BELL command changes the current file. Since Console uses both indistinctly, and gives priority to the current file URI, the command used sets the current file, but probably it would be a better idea to remove all the "current file" part and rely only in the "current path" part.

This patch has the problem of being incompatible with the user setting PROMPT_COMMAND in its .bashrc file.

Fix https://launchpad.net/bugs/1973825

Another, different code proposal, is in !99 (closed)

Edited by Sergio Costas

Merge request reports