Skip to content

Commit

Permalink
feat: Open new terms in last term's CWD
Browse files Browse the repository at this point in the history
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 a new direct dependency, Rustix, which was already included
transitively. I opted for Rustix instead of libc since I could avoid a
use of `unsafe` with Rustix. Rustix's type guarantees are also stronger
than libc's.
  • Loading branch information
joshuamegnauth54 committed Aug 6, 2024
1 parent c261fb2 commit 1e4ef68
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ pub struct Config {
pub syntax_theme_light: String,
pub focus_follow_mouse: bool,
pub default_profile: Option<ProfileId>,
/// Open new terminal with the current working directory of the focused term
pub current_working_directory: bool,
}

impl Default for Config {
Expand All @@ -262,6 +264,7 @@ impl Default for Config {
syntax_theme_light: COSMIC_THEME_LIGHT.to_string(),
use_bright_bold: false,
default_profile: None,
current_working_directory: true,
}
}
}
Expand Down

0 comments on commit 1e4ef68

Please sign in to comment.