From fffc9b619ca0754ca9170d42e29aab22f96bea0a Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Sun, 19 Jan 2020 22:33:41 +0200 Subject: [PATCH] resume_file_path -> resume_file Signed-off-by: Marko Korhonen --- Cargo.toml | 2 +- README.md | 2 +- src/config.rs | 2 +- src/main.rs | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3fed685..ae1f000 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,5 +11,5 @@ license = "MIT" [dependencies] clap = "2.33.0" xdg = "2.2.0" -toml = "0.5.6" serde = {version = "1.0.104", features = ["derive"]} +toml = "0.5.6" diff --git a/README.md b/README.md index ea82223..0d028eb 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The configuration file resides at `~/.config/lqsd/config.toml`. There you can se | Key | Explanation | Default | | ---------------- | -------------------------------------------------------------------------------------------- | :-----------------: | -| resume_file_path | The location where the previous brightness is saved | "/tmp/lqsd-resume" | +| resume_file | The location where the previous brightness is saved | "/tmp/lqsd-resume" | | idle_level | The minimum brightness that will be dimmed to. Can be a value between 0-100 | 0 | | dim_speed | This sets the "sleep time" between each backlight command. It's in milliseconds | 50 | | resume_speed | Same as dim_speed, only for the resume operation `-r` | 25 | diff --git a/src/config.rs b/src/config.rs index fac77c0..df90f69 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,7 +7,7 @@ extern crate xdg; fn default_config() -> Config { Config { - resume_file_path: PathBuf::from("/tmp/lqsd-resume"), + resume_file: PathBuf::from("/tmp/lqsd-resume"), idle_level: 0, dim_speed: 50, resume_speed: 25, diff --git a/src/main.rs b/src/main.rs index 1b5ebe1..a15b3b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ use std::{thread, time}; #[derive(Deserialize, Serialize)] pub struct Config { - resume_file_path: PathBuf, + resume_file: PathBuf, idle_level: i32, dim_speed: u64, resume_speed: u64, @@ -71,16 +71,16 @@ fn main() { if args.is_present("dim") { let current_brightness = get_brightness().to_string(); - match fs::write(&conf.resume_file_path, current_brightness) { + match fs::write(&conf.resume_file, current_brightness) { Ok(()) => println!("Current brightness written to resume file"), Err(err) => eprintln!("Error writing brightness to resume file: {}", err), } transition(conf.idle_level, dim_speed); } if args.is_present("resume") { - let old_brightness: i32 = fs::read(&conf.resume_file_path).unwrap().parse().unwrap(); + let old_brightness: i32 = fs::read(&conf.resume_file).unwrap().parse().unwrap(); transition(old_brightness, resume_speed); - match fs::remove(&conf.resume_file_path) { + match fs::remove(&conf.resume_file) { Ok(()) => println!("Resume file removed"), Err(err) => eprintln!("Failed to remove resume file: {}", err), }