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