cdto
cdto copied to clipboard
cd to appears to open 2 windows, is there something I can do?
Question: "cd to" appears to open 2 windows, is there something I can do?
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.
@jbtule It happens again, The above command no longer works. I use the macOS Catalina.
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.
@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).
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.
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.
I'm seeing multiple windows open on Big Sur