From fed3a6d95d9f5e839bf622a53256b7e05b491450 Mon Sep 17 00:00:00 2001
From: Adrian Groh <50576978+Gobidev@users.noreply.github.com>
Date: Tue, 6 Feb 2024 08:19:40 +0100
Subject: [PATCH] feat(logos): add Bazzite logo (#39)
closes #38
* Add bazzite logo
* Fix bazzite os detection
* Add bazzite to logo lists
* chore(logos): re-render all logos
* chore(logos): re-render all logos
---------
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
---
Cargo.lock | 1 +
Cargo.toml | 1 +
README.md | 23 +-
all_logos.md | 3 +
assets/logos/bazzite.svg | 677 ++++++++++++++++++++++++++++++++++++++
pfetch-extractor/logos.sh | 14 +
src/lib.rs | 21 +-
tools/all_logos.txt | 1 +
8 files changed, 725 insertions(+), 16 deletions(-)
create mode 100644 assets/logos/bazzite.svg
diff --git a/Cargo.lock b/Cargo.lock
index 506de66..afb2486 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -827,6 +827,7 @@ dependencies = [
"glob",
"globset",
"libmacchina",
+ "os-release",
"pfetch-extractor",
"pfetch-logo-parser",
"which",
diff --git a/Cargo.toml b/Cargo.toml
index edc85e1..cfbfb22 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,7 @@ glob = "0.3.1"
which = "4.4.0"
libmacchina = "7.2.1"
crossterm = "0.27.0"
+os-release = "0.1.0"
[profile.release]
strip = true
diff --git a/README.md b/README.md
index 6da68ff..ff2e45b 100644
--- a/README.md
+++ b/README.md
@@ -13,15 +13,16 @@ minimalistic look.
**Supported Platforms:** Linux, Android, macOS, Windows, FreeBSD, NetBSD
**Included Logos:** Alma Linux _(new)_, Alpine Linux, Android, AmogOS _(new)_,
-Arch Linux, ArcoLinux, Artix Linux, Bedrock Linux, Buildroot, CelOS, CentOS,
-Crystal Linux, dahliaOS, Debian, Devuan, DietPi _(new)_, DragonflyBSD,
-Elementary OS, EndeavourOS, Fedora, Fiwix _(new)_, FreeBSD, Garuda Linux, Gentoo
-Linux, Gnu, Guix, Haiku, HydroOS, Hyperbola, instantOS, IRIX, KDE neon, Linux
-Lite, Linux, Mint, macOS, Mageia, Manjaro, Minix, MorphOS _(new)_, MX Linux,
-NetBSD, NixOS, Nobara Project _(new)_, OpenBSD, openSUSE Tumbleweed, openSUSE
-Leap, OpenWrt, Oracle Linux _(new)_, Parabola, Pop!\_OS _(updated)_, PureOS,
-Raspbian, Rocky Linux _(new)_, SerenityOS, Slackware, Solus, SteamOS _(new)_,
-Solaris, Ubuntu, Vanilla OS _(new)_, Void Linux, Windows _(new)_, Xeonix Linux
+Arch Linux, ArcoLinux, Artix Linux, Bazzite _(new)_, Bedrock Linux, Buildroot,
+CelOS, CentOS, Crystal Linux, dahliaOS, Debian, Devuan, DietPi _(new)_,
+DragonflyBSD, Elementary OS, EndeavourOS, Fedora, Fiwix _(new)_, FreeBSD, Garuda
+Linux, Gentoo Linux, Gnu, Guix, Haiku, HydroOS, Hyperbola, instantOS, IRIX, KDE
+neon, Linux Lite, Linux, Mint, macOS, Mageia, Manjaro, Minix, MorphOS _(new)_,
+MX Linux, NetBSD, NixOS, Nobara Project _(new)_, OpenBSD, openSUSE Tumbleweed,
+openSUSE Leap, OpenWrt, Oracle Linux _(new)_, Parabola, Pop!\_OS _(updated)_,
+PureOS, Raspbian, Rocky Linux _(new)_, SerenityOS, Slackware, Solus, SteamOS
+_(new)_, Solaris, Ubuntu, Vanilla OS _(new)_, Void Linux, Windows _(new)_,
+Xeonix Linux
You can check out how they look [here](./all_logos.md).
@@ -55,7 +56,9 @@ brew install pfetch-rs
### Nixpkgs
-Install the [pfetch-rs](https://search.nixos.org/packages?channel=unstable&show=pfetch-rs) Nix package.
+Install the
+[pfetch-rs](https://search.nixos.org/packages?channel=unstable&show=pfetch-rs)
+Nix package.
### AUR
diff --git a/all_logos.md b/all_logos.md
index d76ac22..1925b76 100644
--- a/all_logos.md
+++ b/all_logos.md
@@ -21,6 +21,9 @@ Generated using `./tools/render_all.sh`, powered by [typst](https://typst.app)
## artix
+## bazzite
+
+
## bedrock
diff --git a/assets/logos/bazzite.svg b/assets/logos/bazzite.svg
new file mode 100644
index 0000000..ca4f91c
--- /dev/null
+++ b/assets/logos/bazzite.svg
@@ -0,0 +1,677 @@
+
diff --git a/pfetch-extractor/logos.sh b/pfetch-extractor/logos.sh
index 913e9be..3e8bc27 100644
--- a/pfetch-extractor/logos.sh
+++ b/pfetch-extractor/logos.sh
@@ -112,6 +112,20 @@ case ${1:-${PF_ASCII:-${distro:-$os}}} in
EOF
;;
+ [Bb]azzite*)
+ read_ascii 4 <<- EOF
+ ${c26} .==.${c7}##${c26}====.,
+ ${c26}/###|${c7}/\\${c26}|#######=
+ ${c7}__.__##__.____${c93}\`##\\
+ ${c7}""'""##""'""""#.${c93}\\#'
+ ${c26}####'${c7}\\/${c26}'#####/${c7}##${c93}/##
+ ${c26}\\###'${c7}##${c26}'####"${c7}##'${c93}###
+ ${c26} "##,${c7}\\#=..=###${c93}.##'
+ ${c26} \`'#=,${c7}\`'"\`${c93}=###"
+ ${c93} \`'+##='\`
+ EOF
+ ;;
+
[Bb]edrock*)
read_ascii 4 <<- EOF
${c7}__
diff --git a/src/lib.rs b/src/lib.rs
index c1b2c3c..b9f18db 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -202,13 +202,22 @@ pub fn os(general_readout: &GeneralReadout) -> Option {
.unwrap_or_default()
.contains("/bedrock/cross/")
{
- Some("Bedrock Linux".to_string())
- } else {
- match general_readout.distribution() {
- Ok(distribution) => Some(distribution.replace(" TEMPLATE_VERSION_ID", "")),
- Err(_) => None,
- }
+ return Some("Bedrock Linux".to_string());
}
+ let content = os_release::OsRelease::new().ok()?;
+ let version = if !content.version.is_empty() {
+ content.version
+ } else {
+ content.version_id
+ };
+ // check for Bazzite
+ if content.pretty_name.contains("Bazzite") {
+ return Some(format!("Bazzite {version}"));
+ }
+ if !version.is_empty() {
+ return Some(format!("{} {}", content.name, version));
+ }
+ Some(content.name)
}
_ => Some(general_readout.os_name().ok()?.replace("Unknown", "")),
}
diff --git a/tools/all_logos.txt b/tools/all_logos.txt
index e954b52..51184b8 100644
--- a/tools/all_logos.txt
+++ b/tools/all_logos.txt
@@ -5,6 +5,7 @@ amogos
arch
arco
artix
+bazzite
bedrock
buildroot
celos