I like to use Console / KGX as a terminal emulator. Recently, I switched from NixOS to Manjaro. On NixOS, KGX was somehow aware of the current working directory, so when I clicked the “new tab” button, KGX would open a shell in the same directory that I was in before. I liked that.
On my current Manjaro setup, something seems to be misconfigured, so that won’t happen. How do I have to configure my system so KGX picks up the working directory and opens new shells in that directory?
You’ll want to look into how vte has been packaged, it should setup a hook to report CWD changes. Debian I believe disables it for philosophical reasons of some sort.
Also: Huh, Discourse didn’t have me subscribed to this topic for some reason? Hopefully that’s fixed now.
No philosophy studies required, on Debian trixie just read /usr/share/doc/libvte-2.91-0/README.Debian and follow the instructions. If your shell is bash, the default /etc/bash.bashrc already sources /etc/profile.d/vte-2.91.sh.
Thanks, I followed the directions in that file and it worked!
For anyone who’s not on Debian, here’s the instructions:
Several vte2.91-based terminal emulators aim to open new tabs in the same
working directory as the current tab, but this does not work automatically
and some extra configuration is needed.
For bash users, add to ~/.bashrc or /etc/bash.bashrc:
if [ -e /etc/profile.d/vte-2.91.sh ]; then
. /etc/profile.d/vte-2.91.sh
fi
For zsh users, add the same code to ~/.zshrc or /etc/zsh/zshrc.
This is needed because of a limitation of Debian’s interactive shells: /etc/profile.d is only loaded by login shells (it is not loaded by
interactive non-login shells such as those that are typically run by
terminal emulators), and there is no similar mechanism for interactive
shell initialization like bashrc.d
Ah thank you, on Manjaro there is /etc/profile.d/vte.sh. I thought that it should have already been sourced by the shell on startup and suspected that its actions were overwritten at some point, so I started searching for where that happens… But the login vs non-login shell thing explains that.