resume_file_path -> resume_file
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
This commit is contained in:
parent
2aa75b81e9
commit
fffc9b619c
4 changed files with 7 additions and 7 deletions
|
@ -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"
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue