From c4cffa0b3ccc4d5052b8b534a389dac16e44f840 Mon Sep 17 00:00:00 2001 From: Shibe Drill <53824200+shibedrill@users.noreply.github.com> Date: Thu, 7 Mar 2024 17:03:37 -0500 Subject: [PATCH] subdevice instead of full name --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 53 ++++++++++++++++++++++++++++++++++++++--------------- src/main.rs | 10 +++++++++- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f50bf7e..b6a1392 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -361,7 +361,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oxidefetch" -version = "2.0.0-beta.2" +version = "2.0.0-beta.3" dependencies = [ "byte-unit", "chrono", diff --git a/Cargo.toml b/Cargo.toml index ca04ad1..5749cfc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "oxidefetch" description = "A fast, cross platform Fetch program for your terminal" -version = "2.0.0-beta.2" +version = "2.0.0-beta.3" edition = "2021" authors = [ "NamedNeon", "shibedrill" ] license = "MIT" diff --git a/README.md b/README.md index 48b246b..a2db9bb 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -# oxidefetch 2.0.0-beta.2 +# oxidefetch 2.0.0-beta.3 + 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") -### Why Oxidefetch? +## Why Oxidefetch + Neofetch, being a BASH script, has a few downsides in my opinion. 1: It's slow. 2: It only works on platforms which have the BASH shell. @@ -11,10 +13,13 @@ Neofetch, being a BASH script, has a few downsides in my opinion. As such, I wrote OxideFetch. How cool is that? It displays your information in a manner that's compact, cross-platform, and BLAZINGLY fast. I've measured speeds of up to 25 times faster than normal Neofetch on WSL2. ### Special Thanks + The most heartfelt of thanks goes out to NamedNeon, who contributed the code to perform terminal detection, and to perform GPU detection on Darwin and Windows. ### Features + OxideFetch can display all of the following information: + - Date, time, and day of week - Username and hostname - Operating system name, symbol, and matching color @@ -28,12 +33,15 @@ OxideFetch can display all of the following information: Also, the field-titles feature can be enabled at compile-time, which will display the name of each field in white before the information within that field. By default, it is disabled. -### Installation +### Installation + Download a binary for your platform, and place it in your `$PATH`. Currently, only Windows (x86_64, gnu/msvc) and Linux (x86_64/aarch64, gnu/musl) have binaries available. If you want a binary for another platform, you will have to follow the instructions to build from source. -### Dependencies +### Dependencies + #### Build/Install + To build Oxidefetch, you need Cargo. If you do not already have Cargo installed on your system, you can do so by installing Rustup- either via the [instructions on their website](https://doc.rust-lang.org/cargo/getting-started/installation.html "instructions on their website") or via your system package manager. You will also probably need a C/C++ compiler and a build system- most likely CMake and Visual Studio Build Tools, or GNU Make and the GNU compiler collection. You will be prompted to install these if they're not found during compilation. You can use Cargo, once it's installed, to automatically build and install Oxidefetch like so: @@ -42,12 +50,15 @@ Alternatively, you can get it from the Crates repos, using `cargo install oxidef From there, it *should* be in your `$PATH`. If not, add `source ~/.cargo/env` to your profile, or add `~/.cargo/bin` to your `$PATH`. #### Runtime + The only runtime dependency for this project is a font with Nerd Fonts Symbols. If this is not used, the symbols in the output will not appear correctly. ### How you can help with the project + I need to verify the output of the OS information detection libraries I'm pulling in. To do this, I need the help of people with varying types of systems. I've tested a few, but there's some I'm unable to test. To help, you can kindly clone this repo, and inside the folder, run `cargo test -- --nocapture`, and send the resultant `test_output.txt` file to my noreply email address, or directly to me on Discord at `@shibedrill`. This program does NOT collect information regarding your real name, IP, location, hardware serial numbers, etc. You can look at the file it generates to be sure- it's all plaintext, babey. Also, consider contributing to [libpci-rs](https://github.com/namedneon/libpci-rs) to improve its functionality, efficiency, and cleanliness. -#### Tested distributions/platforms: +#### Tested distributions/platforms + - Alma Linux - Alpine Linux - Arch Linux @@ -62,26 +73,36 @@ I need to verify the output of the OS information detection libraries I'm pullin - Ubuntu - Windows -### Bugs, Quirks, Unintended Behavior, And Other Shenanigans +### Bugs, Quirks, Unintended Behavior, And Other Shenanigans + No weird quirks to report at this time. -### To Do & Roadmap -#### Semi-urgent fixes: +### To Do & Roadmap + +#### Semi-urgent fixes + - None so far. -#### Very near future: -- Add support for user configurability for entries (whether or not an entry shows, its color, units for memory and time) + +#### Very near future + +- Add support for user configurability for entries (whether or not an entry shows, its color, units for memory and time) - Add process count detection - Refactor logic for cleaner code -#### Future: + +#### Future + - Add host system name detection such as "Windows Subsystem for Linux", "IdeaPad 3", "Dell Optiplex", etc. - Add package count/package manager detection - Crosstest on more distributions to verify `sys.name()` outputs -#### Distant future: + +#### Distant future + - More extensible user configuration for entry formatting - Separate all information-getting logic into a new Fetch crate, allowing people to make their own fetch programs using a unified cross-platform API ### Changelog -**1.0.0:** Official full stable release + +**1.0.0:** Official full stable release **1.0.1:** Fixed distro name for Debian GNU/Linux. Logo & color works now. **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. @@ -100,9 +121,11 @@ No weird quirks to report at this time. **1.4.6:** Cargo formatting applied to all files. Mild string reformatting in print statements. **1.4.7:** Removed several `unwrap()` calls. Changed debug output to serialize to RON. **1.4.8:** Applied Clippy suggestions. Added stuff to README. -**2.0.0-beta.0:** Switch from deprecated, platform-dependent GPU backends to [libpci-rs](https://github.com/namedneon/libpci-rs) +**2.0.0-beta.0:** Switch from deprecated, platform-dependent GPU backends to [libpci-rs](https://github.com/gibsonpil/libpci-rs) **2.0.0-beta.1:** Updated test functionality to include package version in the log file. -**2.0.0-beta.2:** Updated use of `libpci-rs` as its API approaches stability. +**2.0.0-beta.2:** Updated use of `libpci-rs` as its API approaches stability. +**2.0.0-beta.3:** GPU subsystem names will display instead of long names, if available. ### License + This software is covered by the MIT license. See license.txt for details. diff --git a/src/main.rs b/src/main.rs index 561cb65..5c35295 100644 --- a/src/main.rs +++ b/src/main.rs @@ -160,7 +160,15 @@ impl Information { gpu_name_vec.push(format!( "{} {} {}", vendor_entry.name(), - device_entry.name(), + // Get the subdevice name if it's available. Otherwise, use the long device name. + { + if let Some(subsystem_entry) = device_entry.subsystem(device.subsys_device_id, device.subsys_vendor_id) { + subsystem_entry.name() + } else { + device_entry.name() + } + }, + // Only show the revision when it's relevant. { if device.revision_id != 0 { format!(" (rev {:02x})", device.revision_id)