diff --git a/.gitignore b/.gitignore index a7c4a7a..b96d0b0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /target PKGBUILD -auto_backlight-*.*.*-x86_64.tar.gz \ No newline at end of file +auto-backlight-*.*.*-x86_64.tar.gz +tar-helper.sh +*.out* +completions \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index db02f33..bbe8302 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,7 @@ version = "1.0.1" dependencies = [ "clap 3.2.20", "clap-verbosity-flag", + "clap_complete", "dbus", "display-info", "fast_image_resize", @@ -100,6 +101,15 @@ dependencies = [ "log", ] +[[package]] +name = "clap_complete" +version = "3.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4179da71abd56c26b54dd0c248cc081c1f43b0a1a7e8448e28e57a29baa993d" +dependencies = [ + "clap 3.2.20", +] + [[package]] name = "clap_derive" version = "3.2.18" diff --git a/Cargo.toml b/Cargo.toml index 4cec459..8806290 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "auto_backlight" -version = "1.0.1" +version = "2.0.0" edition = "2021" authors = ["Supernovatux "] homepage = "https://github.com/Supernovatux/auto_backlight" @@ -8,7 +8,8 @@ repository = "https://github.com/Supernovatux/auto_backlight" description = "A tool to automatically change brightness based on screen contents" keywords = ["brightness-control","rust","linux"] license = "MIT" -include = ["LICENSE", "README.md"] +include = ["LICENSE", "README.md","completions/auto-backlight.fish"] +build = "build.rs" [profile.release] lto = "fat" @@ -34,4 +35,13 @@ glob = "*" ksni = "*" fast_image_resize = "*" futures = "*" -futures-timer = "*" \ No newline at end of file +futures-timer = "*" + +[build-dependencies] +clap = "*" +clap_complete = "*" +clap-verbosity-flag = "*" +log = "*" +[[bin]] +name = "auto-backlight" +path = "src/main.rs" \ No newline at end of file diff --git a/README.md b/README.md index 457ea5e..851f884 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,10 @@ Git clone the repo and do a cargo build. - Multimonitor support - Make it cross platform. +## Features +- System tray + + ## Related Here are some related projects diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..ca22309 --- /dev/null +++ b/build.rs @@ -0,0 +1,33 @@ +use clap::*; +use clap_complete::{ + generate_to, + shells::{Bash, Fish, Zsh}, +}; +use std::io::Error; + +include!("src/cli_parser.rs"); + +fn main() -> Result<(), Error> { + let outdir = "completions"; + let mut cmd = Cli::into_app(); + generate_to( + Bash, + &mut cmd, // We need to specify what generator to use + "auto-backlight", // We need to specify the bin name manually + outdir, // We need to specify where to write to + )?; + generate_to( + Zsh, + &mut cmd, // We need to specify what generator to use + "auto-backlight", // We need to specify the bin name manually + outdir, // We need to specify where to write to + )?; + generate_to( + Fish, + &mut cmd, // We need to specify what generator to use + "auto-backlight", // We need to specify the bin name manually + outdir, // We need to specify where to write to + )?; + + Ok(()) +} diff --git a/src/brightness.rs b/src/brightness.rs index 5b64536..d8a3222 100644 --- a/src/brightness.rs +++ b/src/brightness.rs @@ -27,7 +27,7 @@ impl BrightnessDevices { } pub fn get_brightness(&self) -> i16 { //As of now it averages out. - //Multi-monitor support is to be addeed + //Multi-monitor support is to be addeed let sum: i16 = self .devices .iter() diff --git a/src/sys_tray.rs b/src/sys_tray.rs index 2f6115c..bec3c70 100644 --- a/src/sys_tray.rs +++ b/src/sys_tray.rs @@ -87,4 +87,4 @@ pub fn start_knsi(status: Arc, tx: oneshot::Sender<()>) -> ksni::Han let ret = service.handle(); service.spawn(); ret -} \ No newline at end of file +}