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

feat: Profile option to open new terms in last focused term's CWD [rebased 2024-10-06] #257

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

joshuamegnauth54
Copy link
Contributor

@joshuamegnauth54 joshuamegnauth54 commented Jul 24, 2024

Closes: #251

This patch implements an optional (but enabled by default) feature for opening new terminals using the focused terminal's working directory. The code to retrieve the CWD is largely based on Alacritty's implementation of the same feature.

It works but I have one small change to work on later.

Todo:

  • Add a config option to revert to the old behavior

@joshuamegnauth54 joshuamegnauth54 marked this pull request as ready for review July 25, 2024 05:22
@joshuamegnauth54 joshuamegnauth54 force-pushed the feat-new-tab-open-in-cwd branch 2 times, most recently from b62121c to c261fb2 Compare July 25, 2024 11:12
@leb-kuchen
Copy link
Contributor

I think this should be under profiles.

@joshuamegnauth54
Copy link
Contributor Author

Do you mean as a per profile setting?

@joshuamegnauth54
Copy link
Contributor Author

Alright, I moved the setting over to Profiles.

@joshuamegnauth54 joshuamegnauth54 force-pushed the feat-new-tab-open-in-cwd branch 2 times, most recently from 7a8f93a to e5bcfac Compare August 6, 2024 06:31
@joshuamegnauth54 joshuamegnauth54 changed the title feat: Open new terms in last focused term's CWD feat: Profile option to open new terms in last focused term's CWD [rebased 08-21] Aug 22, 2024
@joshuamegnauth54 joshuamegnauth54 changed the title feat: Profile option to open new terms in last focused term's CWD [rebased 08-21] feat: Profile option to open new terms in last focused term's CWD [rebased 2024-09-03] Sep 3, 2024
Closes: pop-os#251

This patch implements an optional (but enabled by default) feature for
opening new terminals using the focused terminal's working directory.
The code to retrieve the CWD is largely based on Alacritty's
implementation of the same feature.

I added Rustix as a new direct dependency for the working directory
logic. Both libc and Rustix are transitive dependencies of COSMIC Term.
I opted for Rustix over libc to avoid an `unsafe` block as well as for
its stronger type guarantees.

References:
* https://github.com/alacritty/alacritty/blob/6bd1674bd80e73df0d41e4342ad4e34bb7d04f84/alacritty/src/daemon.rs#L85-L108
The option is enabled by default on Unix but settable per profile.

Windows is currently unsupported and defaults to the old behavior.
@joshuamegnauth54 joshuamegnauth54 changed the title feat: Profile option to open new terms in last focused term's CWD [rebased 2024-09-03] feat: Profile option to open new terms in last focused term's CWD [rebased 2024-10-06] Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New tabs should open in the directory of the current tab
2 participants