Added grace implementation

This commit is contained in:
2026-03-07 22:06:22 +01:00
parent 88f7833d8d
commit 5b3377a15b
8 changed files with 384 additions and 161 deletions
+4 -4
View File
@@ -57,7 +57,7 @@ pub struct Config {
#[arg(long)]
pub debug: bool,
/// Write verbose logs to ~/.wayrustlock.log
/// Write verbose logs to ~/.rustlock.log
#[arg(long)]
pub log_file: bool,
@@ -69,18 +69,18 @@ pub struct Config {
impl Config {
pub fn load() -> Self {
let cli_config = Config::parse();
// Use path from CLI if provided, otherwise default
let config_path = cli_config.config.clone().unwrap_or_else(|| {
let mut path = std::path::PathBuf::from(std::env::var("HOME").unwrap_or_default());
path.push(".config/wayrustlock/config.toml");
path.push(".config/rustlock/config.toml");
path
});
if config_path.exists() {
if let Ok(file_content) = std::fs::read_to_string(&config_path) {
if let Ok(_file_config) = toml::from_str::<Config>(&file_content) {
return cli_config;
return cli_config;
}
}
}