Feature Request - Configure Command to set launch directory for profiles #3543

Open
opened 2026-01-30 23:23:39 +00:00 by claunia · 0 comments
Owner

Originally created by @chorman0773 on GitHub (Aug 24, 2019).

Originally assigned to: @bitcrazed on GitHub.

Description of the new feature/enhancement

I have mostly switched to using Windows Terminal (due to the ability to have all of my shells in one place), however, I primarily use cygwin bash. This has a problem that, despite the value of the
startingDirectory option in the profile (and possibly overriden by a directory option from #607), it always starts in $HOME (which expands to /home/<userdir>), rather than the cygwin equivalent of the starting directory (which for <Drive-Letter>:\<path\...> is /cygdrive/<Drive-Letter (in lowercase)>/<path/...>). I propose that to fix this, and any similar issues that may arise with other shells, it be possible (though optional), to specify a command to executed in the new shell that will switch to the starting directory.

Proposed technical implementation details (optional)

In profile settings, there is an optional field called dirCommand which can be anything. If present, the shell is started by running the shell commandline, then immediately after, the command specified by dirCommand is run by the newly started command processor, substituting each occurance of a properly named variable, say $StartingDir with the starting directory, then (possibly) removing the command from history. An example of this for cygwin bash would be

... (cygwin bash profile)
"dirCommand":"cd `cygpath $StartingDir` && exec /bin/bash"
...

If dirCommand is absent, opening the profile has the exact same effect as opening the profile currently does (without respect to dirCommand).

Originally created by @chorman0773 on GitHub (Aug 24, 2019). Originally assigned to: @bitcrazed on GitHub. # Description of the new feature/enhancement I have mostly switched to using Windows Terminal (due to the ability to have all of my shells in one place), however, I primarily use cygwin bash. This has a problem that, despite the value of the `startingDirectory` option in the profile (and possibly overriden by a directory option from #607), it always starts in $HOME (which expands to `/home/<userdir>`), rather than the cygwin equivalent of the starting directory (which for `<Drive-Letter>:\<path\...>` is `/cygdrive/<Drive-Letter (in lowercase)>/<path/...>`). I propose that to fix this, and any similar issues that may arise with other shells, it be possible (though optional), to specify a command to executed in the new shell that will switch to the starting directory. # Proposed technical implementation details (optional) In profile settings, there is an optional field called `dirCommand` which can be anything. If present, the shell is started by running the shell `commandline`, then immediately after, the command specified by `dirCommand` is run by the newly started command processor, substituting each occurance of a properly named variable, say `$StartingDir` with the starting directory, then (possibly) removing the command from history. An example of this for cygwin bash would be ``` ... (cygwin bash profile) "dirCommand":"cd `cygpath $StartingDir` && exec /bin/bash" ... ``` If `dirCommand` is absent, opening the profile has the exact same effect as opening the profile currently does (without respect to `dirCommand`).
claunia added the Issue-FeatureNeeds-TriageNeeds-Tag-Fix labels 2026-01-30 23:23:39 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3543