From 1e4ef68355af01dfecb33b9b62e06dc0238e79f7 Mon Sep 17 00:00:00 2001 From: Josh Megnauth Date: Wed, 24 Jul 2024 02:48:21 -0400 Subject: [PATCH] feat: Open new terms in last term's CWD 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. 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. --- src/config.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/config.rs b/src/config.rs index e632b2f..773685a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -238,6 +238,8 @@ pub struct Config { pub syntax_theme_light: String, pub focus_follow_mouse: bool, pub default_profile: Option, + /// Open new terminal with the current working directory of the focused term + pub current_working_directory: bool, } impl Default for Config { @@ -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, } } }