diff --git a/Cargo.lock b/Cargo.lock index f9a57b5..edea06d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,7 +333,7 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "oxidefetch" -version = "1.1.2" +version = "1.2.0" dependencies = [ "byte-unit", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 73aa723..3315888 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oxidefetch" -version = "1.1.2" +version = "1.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -20,3 +20,6 @@ opt-level = "z" lto = true codegen-units = 1 panic = "abort" + +[features] +field-titles = [] \ No newline at end of file diff --git a/README.md b/README.md index fe31497..7edf0de 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# oxidefetch 1.1.2 +# oxidefetch 1.2.0 Fully cross platform Neofetch clone written in Rust. Up to 25 times faster than Neofetch! ![alt text](image.png "Example output of OxideFetch on a WSL2 Arch Linux host") @@ -74,3 +74,4 @@ Quirk: Multiple GPUs will display strangely. Proposed fix is to replace newlines **1.1.0:** Refactored some poorly written typing, and added support for memory. **1.1.1:** Made sure that linux system detection won't fail if Linux has a capital L. **1.1.2:** Replaced *nix dependency on ```bash``` with dependency on ```sh```. +**1.2.0:** Allowed users to enable field titles as a compile-time feature. Tentative fix for GPU display issues on Linux. diff --git a/src/main.rs b/src/main.rs index b6f06cd..feea9d9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,12 +45,8 @@ fn main() { fn color_print(field_title: &str, icon: char, field: &Option, color: &str) { // If the field is missing, it won't print. if field.is_some() { - //print!("{} ", field_title.bright_white()); - // ^^^ UNCOMMENT THIS LINE TO ENABLE FIELD TITLES! - // Comment it out to disable them. - // TODO: Add configurability to enable or disable this without recompiling. - // AT LEAST make it a crate feature so people can change the setting without - // editing the source code. + #[cfg(feature = "field-titles")] + print!("{} ", field_title.bright_white()); println!( "{}", format!("{} {}", icon, field.as_ref().unwrap()).color(color) @@ -137,16 +133,17 @@ impl InformationStruct { } } _ => { - // On *nix, hopefully, "lspci | grep VGA | cut -d ":" -f3" gives us our GPU name. + // On *nix, hopefully, "lspci | grep VGA | cut -d "VGA compatible controller: "" gives us our GPU name. // Since pipes can't be processed as arguments, we need to do all this in a subshell under SH. let command_output = std::process::Command::new("sh") - .args(["-c", "lspci | grep VGA | cut -d \":\" -f3"]) + .args(["-c", "lspci | grep VGA | cut -d \"VGA compatible controller: \""]) .output(); let gpu = match command_output { Ok(gpu_info) => Some( String::from_utf8(gpu_info.stdout) .unwrap() .trim() + .replace("\n", ", ") .to_owned(), ), Err(_) => None,