Closed dsboger-zz closed 8 years ago
:+1:
It does for me under bash and that is definitely the intent. What shell are you guys using?
I'm using bash too but it does not work here (using the latest version on Arch)
I'm using bash with Arch latest. Just confirmed every new terminal goes back to home, be it on a split, new window or new session.
Can you post your .bashrc when you get a chance please
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
export LANG=fr_BE.UTF-8
export LC_MESSAGES="C"
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
#Powerline configurations
if [ -f /usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh ]; then
source /usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh
fi
# Thefuck configurations
eval "$(thefuck --alias)"
eval "$(thefuck --alias FUCK)"
I'd just like to mention that gnome-terminal presents the correct behavior, if that is worth noting.
There it goes:
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
[[ -r $HOME/.profile ]] && . $HOME/.profile
alias ls='ls --color=auto'
PS1='\[\e[0;33m\][\u@\h:\w]\n\$\[\e[0m\] '
#
# .profile
#
export EDITOR=vim
export BROWSER=firefox
export STEAM_FRAME_FORCE_CLOSE=1
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
export LESSOPEN="| src-hilite-lesspipe.sh %s"
export LESS=' -R '
export SWT_GTK3=0
export SAL_USE_VCLPLUGIN=gtk
export RUST_SRC_PATH=/usr/src/rust/src
export QT_STYLE_OVERRIDE=adwaita
Thanks for the .bashrc, I see the problem. On my system before terminix was even a glimmer in my eye I noticed that gnome-terminal wasn't creating tabs in the same directory as the current tab anymore. After looking around, I found the solution was to add the following to my .bashrc:
. /etc/profile.d/vte.sh
Once I added this to your bash files the feature started working. I need to do some investigation and see what it would take to get this working without this hack because I'm finding without this VTE no longer returns a directory when I call vte_terminal_get_current_directory_uri and I'm relying on this in a couple of places.
Here's a link to the issue where I got this from:
http://unix.stackexchange.com/questions/93476/gnome-terminal-keep-track-of-directory-in-new-tab
OK after looking at this for awhile I came across this bug report:
https://bugzilla.gnome.org/show_bug.cgi?id=697475
I'll give you the TL;DR; version, apparently the VTE widget which gnome-terminal uses (and a bunch of other terminal emulators including terminix) switched from reading directory information from /proc to getting it via /etc/profile.d/vte.sh settinng a PROMPT_COMMAND to emit a terminal control code. Apparently there were a bunch of issues with the /proc methodology and using vte.sh was more reliable.
On Fedora, /etc/profile.d is used by both login and non-login shells so it works fine there, however on other distributions, such as Ubuntu and apparently Arch, this is only for login shells.
So there are really two possibilities here to fix this issue, either include /etc/profile.d/vte.sh in .bashrc or in your profile set the option to use a login shell in the Command tab. Note that using a login shell currently seems broken for me in terminix, I'll put out a release tonite to fix it.
Finally, I could potentially write some code to fallback to reading /proc myself in terminix if I don't get the current directory from VTE, which indicates this problem. However I'm reluctant to do so based on the comments of VTE upstream developers since they have more experience in this area and if they have been having issues with it I doubt I will magically do a better job.
Instead, what I propose for a fix is to show a message dialog warning of this issue along with the information about how to fix it, maybe a link to a FAQ wiki page in github. Does this seem reasonable?
Closed this in a commit accidentally. I've "fixed" the issue by adding a notification to the user. Could you guys do me a favor and test it before I cut a release. I've tested it on Arch, RHEL 7.2 and Ubuntu 16.04 and it seems to behave as expected but I'd appreciate a double check.
You can download the debug release archive http://www.gexperts.com/files/terminix.zip. Note that you will need to unzip it into your / as per normal release instructions since the glib schema changed to support a new preference. Unzipping is done as follows:
sudo unzip terminix.zip -d /
Yeah of course! I guess you have not pasted the right link as the page is not found :p
Updated the link, thanks.
Works fine here :+1:
Thanks, though your second screenshot is making me double check something. You should only get the dialog when the problem is there, i.e. splitting the terminal should not preserve the directory. However in your second screenshot it looks like you split the terminal and it preserved the directory which is why I'm questioning this?
Did you get the dialog, fixed the issue and then split it to show me that the suggested fix works?
@gnunn1 I got the dialog before activating "Run command as a login shell". sorry i didn't mention that
No worries, thanks for the quick response. I'll roll out a new release in an hour or so.
I have sourced vte.sh
:
$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
source /etc/profile.d/vte.sh
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
alias la='ls -lah --color'
alias vi='vimx'
alias vim='vimx'
And gnome-terminal
works correctly, but tilix do not work:
$ hostnamectl
Static hostname: localhost.localdomain
Transient hostname: fedora
Icon name: computer-laptop
Chassis: laptop
Machine ID: 356e3862198440049e2c8f11f417f138
Boot ID: 7cfe6c6220e047b889de73fcb860faa2
Operating System: Fedora 33 (Workstation Edition)
CPE OS Name: cpe:/o:fedoraproject:fedora:33
Kernel: Linux 5.9.13-200.fc33.x86_64
Architecture: x86-64
$ tilix --version
Versiones
Versión de Tilix: 1.9.1
Versión de VTE: 0.62
Versión de GTK: 32424
Características especiales de Tilix
Notificaciones activadas: 1
Disparadores activados=0
Insignias activadas=1
Any ideas? More info it that helps
$ echo $PROMPT_COMMAND
__vte_prompt_command
$ declare -f __vte_prompt_command
__vte_prompt_command ()
{
local command=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]\+ *//');
command="${command//;/ }";
local pwd='~';
[ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/};
pwd="${pwd//[[:cntrl:]]}";
printf '\033]777;notify;Command completed;%s\033\\\033]777;precmd\033\\\033]0;%s@%s:%s\033\\' "${command}" "${USER}" "${HOSTNAME%%.*}" "${pwd}";
__vte_osc7
}
$ echo $TILIX_ID
5d0261ea-25bf-4889-8f4d-65f8efba1e9c
$ echo $VTE_VERSION
6201
Thanks God. It took me a few months before finding this solution. I feel like having a tumor removed.
Sorry Folks,
I added source /etc/profile.d/vte.sh
to my .bashrc but still doesn't do cd pwd on new instances. Maybe I missed something.
Do we have to do something else ?
Is it possible to make newly created terminals (spit, new session, new window) to inherit the working directory of the terminals they were "created from" (i.e. focused when they were created)?