From 9acfcdcf9d46ee765c2c2ef9e8a3041d336d841f Mon Sep 17 00:00:00 2001 From: Tal <83217276+talwat@users.noreply.github.com> Date: Mon, 29 Dec 2025 10:57:17 +0100 Subject: [PATCH] chore: bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 3 +++ src/ui/environment.rs | 4 ++-- src/ui/mpris.rs | 3 +-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d5f8389..f7a5e54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1311,7 +1311,7 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lowfi" -version = "2.0.1-dev" +version = "2.0.2-dev" dependencies = [ "arc-swap", "bytes", diff --git a/Cargo.toml b/Cargo.toml index c6fad03..d4bf3d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lowfi" -version = "2.0.1-dev" +version = "2.0.2-dev" rust-version = "1.83.0" edition = "2021" description = "An extremely simple lofi player." diff --git a/src/main.rs b/src/main.rs index 67feff6..32eb676 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,6 +89,8 @@ enum Commands { }, } +/// Shorthand to get a boolean environment variable. +#[inline] pub fn env(name: &str) -> bool { std::env::var(name).is_ok_and(|x| x == "1") } @@ -98,6 +100,7 @@ pub fn env(name: &str) -> bool { /// The function returns the platform-specific user data directory with /// a `lowfi` subfolder. Callers may use this path to store config, /// bookmarks, and other persistent files. +#[inline] pub fn data_dir() -> crate::Result { let dir = dirs::data_dir().unwrap().join("lowfi"); diff --git a/src/ui/environment.rs b/src/ui/environment.rs index a0add50..152b7e6 100644 --- a/src/ui/environment.rs +++ b/src/ui/environment.rs @@ -27,7 +27,7 @@ impl Environment { pub fn ready(args: &crate::Args) -> super::Result { let enabled = !crate::env("LOWFI_DISABLE_UI"); if !enabled { - return Ok(Environment { + return Ok(Self { enhancement: false, alternate: args.alternate, enabled, @@ -70,7 +70,7 @@ impl Environment { pub fn cleanup(&self, elegant: bool) -> super::Result<()> { if !self.enabled { return Ok(()); - }; + } let mut lock = stdout().lock(); diff --git a/src/ui/mpris.rs b/src/ui/mpris.rs index a127c97..df0a9f2 100644 --- a/src/ui/mpris.rs +++ b/src/ui/mpris.rs @@ -1,7 +1,6 @@ //! Contains the code for the MPRIS server & other helper functions. use std::{ - env, hash::{DefaultHasher, Hash, Hasher}, process, sync::Arc, @@ -328,7 +327,7 @@ impl Server { sender: mpsc::Sender, receiver: broadcast::Receiver, ) -> ui::Result { - let suffix = if env::var("LOWFI_FIXED_MPRIS_NAME").is_ok_and(|x| x == "1") { + let suffix = if crate::env("LOWFI_FIXED_MPRIS_NAME") { String::from("lowfi") } else { format!("lowfi.{}.instance{}", state.tracklist, process::id())