jbtule / cdto

Finder Toolbar app to open the current directory in the Terminal
MIT License
2.29k stars 230 forks source link

cd to appears to open 2 windows, is there something I can do? #44

Open jbtule opened 4 years ago

jbtule commented 4 years ago

Question: "cd to" appears to open 2 windows, is there something I can do?

jbtule commented 4 years ago

Answer: Yes. "cd to" isn't actually opening two windows, when the terminal activates, it automatically opens a window if there aren't any open. Before "cd to" became shell agnostic, it used to type "cd ..." into an existing open window, but after it became shell agnostic and would open a new window, but the default window would open first. In "cd to" 3.1 I finally came up with a heuristic to reasonably determine a default window with 99% accuracy in a shell agnostic way, but closing it is not turned on by default.

To turn on auto window closing, on the command line run

defaults write name.tuley.jay.cd-to cdto-close-default-window -bool true

Then it will appear to only open one window in those cases where Terminal.app wants to open a default one.

ngocbh commented 4 years ago

@jbtule It happens again, The above command no longer works. I use the macOS Catalina.

koishi commented 4 years ago

I had the same problem. Recently I updated to Catalina I ran the command that was written, but the problem did not improve. Later, when I changed from terminal to zsh, this problem did not occur.

ngocbh commented 4 years ago

@koishi I used zsh, too. It worked for the first time. But no longer works when I updated macOS (from Catalina to a new update of Catalina).

jbtule commented 4 years ago

I can’t reproduce myself, and there are a lot of different shell configs out there. I can tell you that my heuristic records the number of lines of history the window Cd to opened and checks to see if the other window has the same number of lines of history, and assumes that if it’s the same, then no work has been done in the other window and it can be closed.

jshwrner commented 3 years ago

I'm noticing this happens if I'm completely quit out of Terminal. If Terminal is running in the background but no sessions/windows open, 'cd to' will open one new Terminal window, otherwise it'll open two. I'm using Fish shell and Catalina if that helps.

ddaddy commented 3 years ago

I'm seeing multiple windows open on Big Sur

Angluca commented 6 months ago

Use BigSur, have 2 window when first open ( ~/ and curpath/ )