diff --git a/Cargo.lock b/Cargo.lock index 412533d..20c8bf8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,14 +8,14 @@ checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" [[package]] name = "alsa" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb213f6b3e4b1480a60931ca2035794aa67b73103d254715b1db7b70dcb3c934" +checksum = "75c4da790adcb2ce5e758c064b4f3ec17a30349f9961d3e5e6c9688b052a9e18" dependencies = [ "alsa-sys", "bitflags", "libc", - "nix 0.15.0", + "nix 0.20.0", ] [[package]] @@ -101,7 +101,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4b624268937c0e0a3edb7c27843f9e547c320d730c610d3b8e6e8e95b2026e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "core-foundation", "lazycell", "libc", @@ -142,7 +142,7 @@ dependencies = [ "async-net", "blocking", "bytemuck", - "cfg-if 1.0.0", + "cfg-if", "cty", "futures-lite", "hashbrown", @@ -183,12 +183,6 @@ version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -312,7 +306,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -369,7 +363,7 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -412,19 +406,6 @@ dependencies = [ "time", ] -[[package]] -name = "nix" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" -dependencies = [ - "bitflags", - "cc", - "cfg-if 0.1.10", - "libc", - "void", -] - [[package]] name = "nix" version = "0.19.1" @@ -433,7 +414,19 @@ checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" dependencies = [ "bitflags", "cc", - "cfg-if 1.0.0", + "cfg-if", + "libc", +] + +[[package]] +name = "nix" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" +dependencies = [ + "bitflags", + "cc", + "cfg-if", "libc", ] @@ -486,7 +479,7 @@ version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fc12d774e799ee9ebae13f4076ca003b40d18a11ac0f3641e6f899618580b7b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "log", "wepoll-sys", @@ -534,7 +527,7 @@ dependencies = [ [[package]] name = "rsblocks" -version = "0.1.15" +version = "0.1.16" dependencies = [ "alsa", "battery", @@ -544,7 +537,7 @@ dependencies = [ "lazy_static", "minreq", "mpd", - "nix 0.19.1", + "nix 0.20.0", "serde", "serde_yaml", ] @@ -714,12 +707,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - [[package]] name = "waker-fn" version = "1.1.0" @@ -738,7 +725,7 @@ version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] diff --git a/Cargo.toml b/Cargo.toml index a8a1ce6..5e8c68e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsblocks" -version = "0.1.15" +version = "0.1.16" authors = ["mustafa salih "] edition = "2018" readme = "README.md" @@ -11,15 +11,15 @@ description = "a multi threaded status bar for dwm window manager for linux" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -alsa = "0.4.3" +alsa = "0.5" chrono = "0.4" -dbus = "0.9.1" -lazy_static = "1.4.0" -minreq = {version = "2.2.1", features = ["https","json-using-serde"]} +dbus = "0.9" +lazy_static = "1.4" +minreq = {version = "2.2", features = ["https","json-using-serde"]} mpd = "0.0.12" -nix = "0.19.1" -serde = {version = "1.0.120", features = ["derive"]} -serde_yaml = "0.8.15" +nix = "0.20" +serde = {version = "1.0", features = ["derive"]} +serde_yaml = "0.8" battery = "0.7" [dependencies.breadx] diff --git a/src/utils/spotify.rs b/src/utils/spotify.rs index 9e5c5da..c48471d 100644 --- a/src/utils/spotify.rs +++ b/src/utils/spotify.rs @@ -3,8 +3,8 @@ use crate::types::ThreadsData; use dbus::blocking::stdintf::org_freedesktop_dbus::Properties; use dbus::{arg, blocking::Connection}; use std::time::Duration; -// getting spotify current artist and title. +// getting spotify current artist and title. pub fn get_spotify() -> ThreadsData { let empty_data = ThreadsData::Spotify(String::from("")); let conn = match Connection::new_session() { @@ -27,13 +27,25 @@ pub fn get_spotify() -> ThreadsData { let artist: Option<&Vec> = arg::prop_cast(&metadata, "xesam:artist"); let title = match title { - Some(title) => title, + Some(title) => { + if title.len() > 30 { + &title[..30] + } else { + title.as_str() + } + } _ => "", }; let artist = match artist { Some(artist_vec) => match artist_vec.first() { - Some(name) => name, + Some(name) => { + if name.len() > 30 { + &name[..30] + } else { + name.as_str() + } + } _ => "", }, None => "",