Issuing tentative fix for GPU info display on multi-gpu systems
This commit is contained in:
parent
1c2c34e57f
commit
bc9d61ddcb
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -333,7 +333,7 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
|
||||
|
||||
[[package]]
|
||||
name = "oxidefetch"
|
||||
version = "1.1.2"
|
||||
version = "1.2.0"
|
||||
dependencies = [
|
||||
"byte-unit",
|
||||
"chrono",
|
||||
|
@ -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 = []
|
@ -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!
|
||||
|
||||

|
||||
@ -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.
|
||||
|
13
src/main.rs
13
src/main.rs
@ -45,12 +45,8 @@ fn main() {
|
||||
fn color_print(field_title: &str, icon: char, field: &Option<String>, 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,
|
||||
|
Loading…
Reference in New Issue
Block a user