-
Notifications
You must be signed in to change notification settings - Fork 689
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
Allow different window-inherit-working-directory
behavior for tabs and windows
#1392
Comments
My recommendation would be to change |
I started working on this. The configuration aspect was straightforward, but I slowed down implementing the actual logic (in const inherit_pwd = switch (config.@"window-inherit-working-directory") {
.true => true,
.false => false,
.tab => is_tab,
.window => !is_tab,
};
if (inherit_pwd) {
if (try p.pwd(alloc)) |pwd| {
copy.@"working-directory" = pwd;
}
} ... but I'm not sure how to derive an Or maybe we should set the new config's I'm happy to finish implementing this with a little more guidance on what other bits should change. |
That's right. I think that the answer is that I'd try to limit the core's actual knowledge about this and keep it within the apprts. I'm not 100% sure that'll work, its hard to say without actually trying to go through it myself, but that's what I'd try first. |
I would second that suggestion; personally, I would like for new tabs to "start fresh", while a split is more like a second "view" on the current context (i.e., should inherit cwd). |
will released soon? |
@mitchellh and I have been talking through an implementation approach in a few places (#1694 and Discord). The most recent thought was to move toward a "surface kind-aware" configuration dimension and then use that to allow per-kind conditional configuration of the Here are my latest thoughts after sitting with that (conditional config) idea for a bit:
Maybe the theme here is that this is all going to be about a surface's "initial" configuration, so I think there shouldn't be an expectation that we'd update e.g. the theme if a surface changes from a split to a window, nor am I sure that would be particularly useful even if we could support it. Maybe? This could become its own discussion. So I think I still have a preference for the simpler "tagged union" approach (e.g. |
(If this isn't helpful, feel free to disregard...) My brain doesn't really consider "splits" or "tabs" to be "windows": This would be my proposal:
I think that's pretty similar to the original proposal, but it actually introduces the word "surface" instead of overloading "window", and it provides a default value for simple configs. |
To add to the "surface kind aware" note, we should also pipe through metadata about the kind of terminal we're looking at, because there is a significant amount of requests for macOS quick terminal specific configuration. |
Yes that's exactly the configuration I'm using in iterm2. I want a split to inherit the working directory of its tab and a new tab/window to open on For example If I have a project running in a tab and I want to see its git log, I just split the tab and do My proposal was to have three separate settings (grouped together in the documentation):
And if |
There's one more configuration axis that hasn't been brought up: the ability for separate keybinds that retain / don't retain the current working directory. As an example, in Kitty, I bind Sometimes I would rather tab back/forth instead of using splits, such as when I'm using a laptop screen instead of a desktop monitor. In that case, Prior art: Kitty's
|
I am facing a peculiar issue and I think it's related to the issue in this thread. Please correct me if it's not. Whenever I do an SSH to a machine in a given tab on ghostty and then do a split using ⌘ + D, the split opens with the present working directory as the Screenshot 1 is when I do a ssh from a specific folder(doesn't matter if its home folder), the split opened with cwd as Screenshot 2 is the normal behaviour. My Ghostty config:
|
So, folks that want separate I think this is a more powerful control than simply adding a setting for each, and it sounds like this may avoid the issue of context that ended up blocking PR-1694. That this would also be personally convenient is a nice bonus. :) |
Personally, I don’t need them to be separate keybindings (as I always want the same behaviour for splits/tabs/windows), but it would not be an issue for me if they were separate, as I’d just bind the correct one for my purposes. So no downsides, and others (including you devs) benefit. I think it’s a very good solution. (In case it’s relevant: I want splits to preserve PWD, and tabs and windows to forget it.) |
Yes! This is what I had with Kitty and it worked well. |
I think this would work for me. If I can configure a keyboard shortcut to open a new tab without the same CWD but configure window splitting to inherit the CWD, that would be awesome. |
Exactly this, i want my split to inherit, and new tab to start in home folder. |
I would like to have different behaviors for the
window-inherit-working-directory
option, either through a new option liketab-inherit-working-directory
or a command that can be bound through akeybind
option.Use case would allow for news tabs to inherit the working directory while a new window would open the home directory, or vice versa.
The text was updated successfully, but these errors were encountered: