From 7f1e47fda6d9cc507e628fc63303f510f8a313ca Mon Sep 17 00:00:00 2001 From: Justin Fitzsimmons Date: Mon, 22 Dec 2025 12:48:33 -0500 Subject: [PATCH] Config dir path customized via EVE_NICOTINE_CONFIG_DIR --- README.md | 2 ++ src/config.rs | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c8168c8..95b46d0 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,8 @@ backward_button = 275 # Button 8 minimize_inactive = false # Minimize clients when cycling away (saves resources) ``` +The path to the config directory can be customized by setting the `EVE_NICOTINE_CONFIG_DIR` environment variable. + ## Architecture - **Daemon mode**: Maintains window manager connection and state in memory for instant cycling diff --git a/src/config.rs b/src/config.rs index 70e3b2d..ebc0a66 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,6 +1,6 @@ use anyhow::{Context, Result}; use serde::{Deserialize, Serialize}; -use std::fs; +use std::{env, fs}; use std::path::PathBuf; #[derive(Debug, Serialize, Deserialize, Clone)] @@ -58,9 +58,14 @@ fn default_minimize_inactive() -> bool { impl Config { fn config_dir() -> PathBuf { - let mut path = dirs::config_dir().unwrap_or_else(|| PathBuf::from(".")); - path.push("nicotine"); - path + match env::var("EVE_NICOTINE_CONFIG_DIR") { + Ok(path) => PathBuf::from(path), + Err(_) => { + let mut path = dirs::config_dir().unwrap_or_else(|| PathBuf::from(".")); + path.push("nicotine"); + path + } + } } fn config_path() -> PathBuf {