Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use Windows Terminal's Starting Directory #10419

Closed
vaqxai opened this issue Apr 4, 2024 · 4 comments
Closed

Can't use Windows Terminal's Starting Directory #10419

vaqxai opened this issue Apr 4, 2024 · 4 comments
Labels

Comments

@vaqxai
Copy link

vaqxai commented Apr 4, 2024


Fish Version: 3.7.0
uname -a: CYGWIN_NT-10.0-22631 Helios 3.5.1-1.x86_64 2024-02-27 11:54 UTC x86_64 Cygwin
echo $TERM: xterm-256color
third party modifications: NONE

  1. Create a profile in Windows Terminal
  2. Use either fish or fish -C "cd $(cygpath $(pwd))" as the "Command line" parameter
  3. Check "Starting directory" to be "Use parent process directory" (I have no idea how it works - the msdn docs don't say much -- there's no special env var set I could use within fish to cd to that directory)
  4. See that fish always starts in the same directory it was in before, not the one you "Open in terminal" in.
  5. Same applies to e.g. alacritty, when I use the right click menu to "Open here", fish doesn't open the selected dir.

Is there a special variable I can use within fish config that these terminal emulators add when opening from a folder? Is it a command they issue that doesn't work with fish? When starting fish from powershell using fish -C "cd $(cygpath $(pwd)) it correctly opens in the directory of the currently open powershell.


TL;DR: I'd like to be able to "Open Fish here" using Windows Explorer and Windows Terminal or Alacritty, but can't figure out how to do so.


Ad. 1: Using set $Env:WIN_CD=$(cygpath $(pwd)); fish -C "cd $WIN_CD" works within powershell, but when used as a 'Command line' parameter, it generates an error (an issue with Windows Terminal probably): [error 2147942402 (0x80070002) when launching `set $Env:WIN_CD=$(cygpath $(pwd)); fish -C "cd $WIN_CD"'], i think it can only run an executable and not any arbitrary command (I tired a windows command prompt (cmd.exe) format and it also fails similarly.

@vaqxai vaqxai changed the title Can't use Windows Terminal' Starting Directory Can't use Windows Terminal's Starting Directory Apr 4, 2024
@faho
Copy link
Member

faho commented Apr 4, 2024

You'll want to check your config for anything that does cd, possibly just in a login shell.

If that's not it you should ask the Cygwin people, seeing as you appear to use cygwin. Note that it's also possible it cds in Cygwin somewhere, e.g. if that has a different login shell that ends up starting fish.

There is nothing special fish does to support a different startup directory, it just asks the operating system via getcwd(), so the parent process should just change to that directory. So there's nothing really to go wrong here in fish itself.

@faho faho added the question label Apr 4, 2024
@vaqxai
Copy link
Author

vaqxai commented Apr 4, 2024

I don't have any cds in config. Is there any way to diagnose what actually happens? perhaps cwd is messed up because of cygwin, as fish can't read a windows-format path...

@faho
Copy link
Member

faho commented Apr 5, 2024

Ask the cygwin people, who know about cygwin.

I'm afraid we can't be of more assistance because it's a pretty unusual system and I have no idea how it really fits together. I am fairly certain that it isn't a fish issue.

@faho faho closed this as completed Apr 5, 2024
@vaqxai
Copy link
Author

vaqxai commented Apr 5, 2024

It was, I had another hidden config file which overrode the $PWD. No idea how it got there, but totally my fault. Sorry for taking your time with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants