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 {