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]]
|
[[package]]
|
||||||
name = "oxidefetch"
|
name = "oxidefetch"
|
||||||
version = "1.1.2"
|
version = "1.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byte-unit",
|
"byte-unit",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "oxidefetch"
|
name = "oxidefetch"
|
||||||
version = "1.1.2"
|
version = "1.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# 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
|
lto = true
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
panic = "abort"
|
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!
|
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.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.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.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) {
|
fn color_print(field_title: &str, icon: char, field: &Option<String>, color: &str) {
|
||||||
// If the field is missing, it won't print.
|
// If the field is missing, it won't print.
|
||||||
if field.is_some() {
|
if field.is_some() {
|
||||||
//print!("{} ", field_title.bright_white());
|
#[cfg(feature = "field-titles")]
|
||||||
// ^^^ UNCOMMENT THIS LINE TO ENABLE FIELD TITLES!
|
print!("{} ", field_title.bright_white());
|
||||||
// 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.
|
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
format!("{} {}", icon, field.as_ref().unwrap()).color(color)
|
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.
|
// 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")
|
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();
|
.output();
|
||||||
let gpu = match command_output {
|
let gpu = match command_output {
|
||||||
Ok(gpu_info) => Some(
|
Ok(gpu_info) => Some(
|
||||||
String::from_utf8(gpu_info.stdout)
|
String::from_utf8(gpu_info.stdout)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.trim()
|
.trim()
|
||||||
|
.replace("\n", ", ")
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
),
|
),
|
||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
|
Loading…
Reference in New Issue
Block a user