-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
Feature: Shortcut for opening a new pane in current working directory #102
Comments
I looked into this, we'll need to get the CWD of the active terminal using https://docs.rs/nix/0.11.0/nix/unistd/fn.getcwd.html instead of As I see it we have two implementation paths-
|
Option 2 seems good. Do you want to work on this, or shall I put a |
You can put up the label. I'll prefer working on tabs and persistent sessions first. And since this is relatively easy, this maybe good for new contributors as well. |
Hi, this seems like a good first issue and I would like to help. Can I go for it 😃 ? |
You got it. :) Please feel free to reach out if you have any questions. |
I do need a pointer. I found petty quick how create a new shortcut but what I have not yet found is where to call How do I go from knowing the |
Oops! Looks like I misread the docs for |
Sure I'll look into it !! |
Ok I think I have understood what has to happen. We basically need to know the active pane's child process Fortunately it's already the case as every time the So for each For example, the procinfo crate does this with its cwd(pid: pid_t) function, which does the following: pub fn cwd(pid: pid_t) -> Result<PathBuf> {
fs::read_link(format!("/proc/{}/cwd", pid))
} So with the |
Good find! Just one consideration: if it's possible not to rely on an implementation from the proc filesystem that would be great (mac doesn't have it). But if that's the only way maybe this can be a linux feature for now. |
Good point! But the darwin-libproc crate has an implementation. I have a macos image in my files, I'll spawn a vm and test this. The other solution I found is to call lsof -a -Fn -p $pid -d cwd | sed -e '1d' -e '2s/^n/' But that's probably the last recourse option. |
That's a great find! Though I am sceptical about whether we need the |
You might be right. It'll need to be the correct one to have the correct behavior, so I'll make it work 👍 I have tested a There's one last thing I have troubles with and it is how the PtyBus bus stores the active pane
Basically from from your comment earlier @kunalmohan, I see how implementation 1 can be done, but not 2. |
Yeah, that's part of the issue. You'll have to add an |
Ahah ok 😅, I thought it was already there hence my confusion! |
@kunalmohan you were right I do indeed need the PID from the spawned shell. |
Can we use stdin/stdout to convey the PID instead of establishing a new IPC channel for it? |
This is done! Sorry I took so long. |
It would be great if we have this feature in Zellij. For me, |
This has been implemented by #691 and is now standard behavior. |
The new pane should be opened with the current working directory of the active pane instead of the default directory (
/home/user
in case of Linux)This should be helpful while implementing this feature.
The text was updated successfully, but these errors were encountered: