aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-10-31 14:35:13 +0100
committerGitHub <noreply@github.com>2024-10-31 14:35:13 +0100
commit549cfe02be2f2ce3fff74dd24196e2022cc2eba2 (patch)
tree9b2f3a95c5815f8baa30bbe40049b37390b32397 /zellij-utils/src
parentdocs(readme): add https to curl download (diff)
downloadsl0ppij-549cfe02be2f2ce3fff74dd24196e2022cc2eba2.tar.gz
sl0ppij-549cfe02be2f2ce3fff74dd24196e2022cc2eba2.tar.xz
sl0ppij-549cfe02be2f2ce3fff74dd24196e2022cc2eba2.zip
fix(ux): configuration fixes (#3713)
* fix(startup): try create config folder if it doesn't exist * fix(configuration): tab bar ui * fix(configuration): rebind ctrl-s to ctrl-a * fix(configuration): remove extra rebinding leaders screen
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/home.rs9
-rw-r--r--zellij-utils/src/input/config.rs5
2 files changed, 14 insertions, 0 deletions
diff --git a/zellij-utils/src/home.rs b/zellij-utils/src/home.rs
index e0f12399..9bde367c 100644
--- a/zellij-utils/src/home.rs
+++ b/zellij-utils/src/home.rs
@@ -67,6 +67,15 @@ pub fn home_config_dir() -> Option<PathBuf> {
}
}
+pub fn try_create_home_config_dir() {
+ if let Some(user_dirs) = BaseDirs::new() {
+ let config_dir = user_dirs.home_dir().join(CONFIG_LOCATION);
+ if let Err(e) = std::fs::create_dir_all(config_dir) {
+ log::error!("Failed to create config dir: {:?}", e);
+ }
+ }
+}
+
pub fn get_layout_dir(config_dir: Option<PathBuf>) -> Option<PathBuf> {
config_dir.map(|dir| dir.join("layouts"))
}
diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs
index 0e7547d8..8075ea0d 100644
--- a/zellij-utils/src/input/config.rs
+++ b/zellij-utils/src/input/config.rs
@@ -291,6 +291,11 @@ impl Config {
}
// returns true if the config was not previouly written to disk and we successfully wrote it
pub fn write_config_to_disk_if_it_does_not_exist(config: String, opts: &CliArgs) -> bool {
+ if opts.config.is_none() {
+ // if a config file path wasn't explicitly specified, we try to create the default
+ // config folder
+ home::try_create_home_config_dir();
+ }
match Config::config_file_path(opts) {
Some(config_file_path) => {
if config_file_path.exists() {