Compare commits

..

No commits in common. "87a657fe81b60f2b0e8c6316fce371d6c33faa6c" and "e33174c0bd425e909bc4fd0c19c566bf0587b4b0" have entirely different histories.

6 changed files with 8 additions and 23 deletions

2
Cargo.lock generated
View File

@ -914,7 +914,7 @@ dependencies = [
[[package]] [[package]]
name = "rsblocks" name = "rsblocks"
version = "0.1.20" version = "0.1.19"
dependencies = [ dependencies = [
"alsa", "alsa",
"async-std", "async-std",

View File

@ -3,9 +3,7 @@ use std::default::Default;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Volume { pub struct Volume {
pub icon_high: String, pub icon: String,
pub icon_low: String,
pub icon_muted: String,
pub enabled: bool, pub enabled: bool,
pub delay: f64, pub delay: f64,
pub card: String, pub card: String,
@ -14,9 +12,7 @@ pub struct Volume {
impl Default for Volume { impl Default for Volume {
fn default() -> Self { fn default() -> Self {
Volume { Volume {
icon_high: String::from("🕪"), icon: String::from(""),
icon_low: String::from("🕩"),
icon_muted: String::from("🔇"),
enabled: false, enabled: false,
delay: 0.17, delay: 0.17,
card: String::from("ALSA"), card: String::from("ALSA"),

View File

@ -60,9 +60,7 @@ pub struct Disk {
} }
#[derive(Clone)] #[derive(Clone)]
pub struct Volume { pub struct Volume {
pub icon_muted: String, pub icon: String,
pub icon_high: String,
pub icon_low: String,
pub enabled: bool, pub enabled: bool,
pub delay: f64, pub delay: f64,
pub card: String, pub card: String,

View File

@ -12,7 +12,7 @@ pub async fn get_cpu_temp() -> ThreadsData {
let value = buf.trim().parse::<f32>().unwrap(); let value = buf.trim().parse::<f32>().unwrap();
let result = format!( let result = format!(
" {} {: <3.1}° {}", " {} {}° {}",
CONFIG.cpu_temperature.icon, CONFIG.cpu_temperature.icon,
value / 1000.0, value / 1000.0,
CONFIG.seperator CONFIG.seperator

View File

@ -18,7 +18,7 @@ pub async fn get_netspeed() -> ThreadsData {
let rx = calculate(rx_bps); let rx = calculate(rx_bps);
let data = format!( let data = format!(
" {}{} {}{} {}", "{}{} {}{} {}",
rx, CONFIG.netspeed.recieve_icon, tx, CONFIG.netspeed.transmit_icon, CONFIG.seperator rx, CONFIG.netspeed.recieve_icon, tx, CONFIG.netspeed.transmit_icon, CONFIG.seperator
); );
ThreadsData::NetSpeed(data) ThreadsData::NetSpeed(data)
@ -36,7 +36,7 @@ fn parse_speed_file(pth: &str) -> u64 {
} }
fn calculate(speed: u64) -> String { fn calculate(speed: u64) -> String {
let lookup = ["b", "kb", "Mb"]; let lookup = ["B", "kB", "MB"];
let mut speed = speed as f64; let mut speed = speed as f64;
let mut idx = 0; let mut idx = 0;
while speed >= 1024.0 && idx < lookup.len() { while speed >= 1024.0 && idx < lookup.len() {

View File

@ -28,15 +28,6 @@ pub async fn get_volume() -> ThreadsData {
((raw_volume as f64 / range as f64) * 100.) as u64 ((raw_volume as f64 / range as f64) * 100.) as u64
}; };
let muted = selem let data = format!(" {} {}% {}", CONFIG.volume.icon, vol, CONFIG.seperator);
.get_playback_switch(selem_chan_id)
.expect("Failed to get playback state");
let icon = match muted {
0 => &CONFIG.volume.icon_muted,
_ => if vol < 50 { &CONFIG.volume.icon_low } else { &CONFIG.volume.icon_high }
};
let data = format!(" {} {}% {}", icon, vol, CONFIG.seperator);
ThreadsData::Sound(data) ThreadsData::Sound(data)
} }