diff --git a/i3/terminal.sh b/i3/terminal.sh index 0747fb3..152e7f4 100755 --- a/i3/terminal.sh +++ b/i3/terminal.sh @@ -2,10 +2,10 @@ # If a window with a path in its title is focused, open a terminal with that # location as working directory. Like this, terminals are opened in the same -# directory as the currently focused one, if no command is running. This is -# very hackish, but it works. +# directory as the currently focused one. I modified my oh-my-zsh to always +# also print the directory, even when a command is executing. -if [[ $(xtitle) =~ (^| )(~?)(/.*) ]]; then +if [[ $(xtitle) =~ (in|^.*@.*:)\ (~?)(/.*) ]]; then path="${BASH_REMATCH[3]}" [[ ${BASH_REMATCH[2]} == "~" ]] && path="$HOME$path"