From 7407a83d6f6f0e9b650634382feb58df2874338b Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Sun, 3 Jan 2021 01:56:52 +0300 Subject: [PATCH 01/13] edited lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index aa6a053..1867c5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ [[package]] name = "rsblocks" -version = "0.1.1" +version = "0.1.2" dependencies = [ "chrono", "yaml-rust", From 7eafb04737b4c6920e400addf6e4d0a1526c224b Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Mon, 4 Jan 2021 02:29:01 +0300 Subject: [PATCH 02/13] rsblocks now provides the current weather temerature --- Cargo.lock | 7 +++ Cargo.toml | 5 ++- README.md | 16 +++++-- rsblocks.yml | 27 ++++++++++-- src/lib.rs | 119 +++++++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 155 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1867c5d..6a74754 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,6 +31,12 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +[[package]] +name = "minreq" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466d0a7e6bfcd54f69e4a17d4a4318985aaaf7fe3df4cd3b6f11ff551129ca3" + [[package]] name = "num-integer" version = "0.1.44" @@ -55,6 +61,7 @@ name = "rsblocks" version = "0.1.2" dependencies = [ "chrono", + "minreq", "yaml-rust", ] diff --git a/Cargo.toml b/Cargo.toml index c74fe6b..36889bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsblocks" -version = "0.1.2" +version = "0.1.3" authors = ["mustafa salih "] edition = "2018" readme = "README.md" @@ -12,4 +12,5 @@ description = "a multi threaded status bar for dwm window manager for linux" [dependencies] chrono = "0.4" -yaml-rust = "0.4" \ No newline at end of file +yaml-rust = "0.4" +minreq = "2.2.1" \ No newline at end of file diff --git a/README.md b/README.md index 4077e8c..3b33e2f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # rsblocks -A minimal multi threaded fast status bar for dwm window manager written in **Rust** 🦀 +[github](https://github.com/MustafaSalih1993/rsblocks) +[crates](https://crates.io/crates/rsblocks) +[build](https://github.com/MustafaSalih1993/rsblocks/actions?query=workflow%3ARust) + +A multi threaded fast status bar for dwm window manager written in **Rust** 🦀


@@ -7,9 +11,10 @@ A minimal multi threaded fast status bar for dwm window manager written in **Rus ## Features * Multi Threads * Time/Date -* Used Memory -* Used Disk space -* Sound volume _reads from `alsa-utils` for now_ +* Memory Usage +* Disk Usage +* Weather Temperature +* Sound volume _reads from `alsa-utils`_ * Easy to configure with `rsblocks.yml` file @@ -58,5 +63,8 @@ cp ./rsblocks.yml ~/.config/rsblocks/rsblocks.yml ## Contributions All Contributions are welcome. +## Credits +* [wttr.in](https://github.com/chubin/wttr.in) for using their weather API + ## License [MIT](./LICENSE) diff --git a/rsblocks.yml b/rsblocks.yml index be6939f..76e83f6 100644 --- a/rsblocks.yml +++ b/rsblocks.yml @@ -1,28 +1,47 @@ -# This is the full configuration template available for rsblocks tool -# the names are clearly defines itself. +# This is the full configuration template available for rsblocks. -# NOTE: the (delay) is **seconds** with the float point to update the item in the bar. +# NOTE: the (delay) is in **SECONDS** and the float point "." is required. general: seperator: '┃' + time: icon: '' format: '%d %b, %I:%M:%S %p' delay: 1.0 + memory: enable: true icon: '▦' delay: 2.0 + disk: enable: true icon: '' delay: 120.0 -# reads from alsa-utils + +# reads from alsa, alsa-utils package should +# be installed on the system to make it work. volume: enable: false icon: '' delay: 0.18 + + +# weather format options is available on +# https://github.com/chubin/wttr.in +# NOTES: +# - if the city field set to empty, it will try to read location automatically. +# - if you have multiple formats and want to insert space between them use '+' instead. +# - giving (city) a value is recommended. +weather: + enable: true + icon: '' + city: '' + format: '%l:+%t' + delay: 7200.0 # 7200 seconds = 2 hours + diff --git a/src/lib.rs b/src/lib.rs index 786d4cf..edb30f7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ use chrono::prelude::*; +use minreq; use std::env; use std::fs::File; use std::io::Error; @@ -15,6 +16,7 @@ pub enum ThreadsData { Disk(String), Memory(String), Time(String), + Weather(String), } #[derive(Clone)] @@ -24,6 +26,7 @@ pub struct Config { pub memory: Memory, pub disk: Disk, pub volume: Volume, + pub weather: Weather, } #[derive(Clone)] @@ -53,6 +56,24 @@ pub struct Volume { pub delay: f64, } +#[derive(Clone)] +pub struct Weather { + pub city: String, + pub format: String, + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +/* +// TODO: error handling required if rsblocks.yml file is empty + +this function is responsible to check if the rsblocks.yml file +exists to call parse_config to read it OTHERWISE +it will call load_defaults to load a hardcoded default configuration + +it will always return a valid configuration inside a Result. +*/ pub fn load_config() -> Result { let yml_source = env::var("HOME").unwrap() + "/.config/rsblocks/rsblocks.yml"; let mut data = String::new(); @@ -64,12 +85,14 @@ pub fn load_config() -> Result { } }; file.read_to_string(&mut data)?; - let yml_content = &YamlLoader::load_from_str(&data).unwrap()[0]; let config = parse_config(yml_content); Ok(config) } +/* +this is simply returns a hardcoded configuration as default +*/ fn load_defaults() -> Config { Config { seperator: String::from("|"), @@ -93,28 +116,47 @@ fn load_defaults() -> Config { enabled: false, delay: 0.17, }, + weather: Weather { + city: String::from(""), + format: String::from("+%t"), + icon: String::from(""), + enabled: false, + delay: 7200.0, //7200 seconds = 2 hours + }, } } +/* +it will read and parse the rsblocks.yml file content and return a valid configuration +IF some content is missing in the rsblocks.yml file, it will set +a default values to that +*/ fn parse_config(doc: &yaml::Yaml) -> Config { // parsing icons and set default if not exist in the config file let seperator = get_or_set_string(doc, "general", "seperator", "|"); let time_icon = get_or_set_string(doc, "time", "icon", ""); - let time_format = get_or_set_string(doc, "time", "format", "%T"); let mem_icon = get_or_set_string(doc, "memory", "icon", ""); let disk_icon = get_or_set_string(doc, "disk", "icon", ""); let volume_icon = get_or_set_string(doc, "volume", "icon", ""); + let weather_icon = get_or_set_string(doc, "weather", "icon", ""); + + //parsing formats and city weather + let time_format = get_or_set_string(doc, "time", "format", "%T"); + let weather_format = get_or_set_string(doc, "weather", "format", "%l:+%t"); + let weather_city = get_or_set_string(doc, "weather", "city", ""); // parsing enabled state (everything false by default) let disk_enabled = get_or_set_bool(doc, "disk", "enable"); let memory_enabled = get_or_set_bool(doc, "memory", "enable"); let volume_enabled = get_or_set_bool(doc, "volume", "enable"); + let weather_enabled = get_or_set_bool(doc, "weather", "enable"); // parsing update_delay state (should be all seconds in f64 type) let time_delay = get_or_set_f32(doc, "time", "delay", 1.0); - let disk_delay = get_or_set_f32(doc, "disk", "delay", 60.0); + let disk_delay = get_or_set_f32(doc, "disk", "delay", 120.0); let memory_delay = get_or_set_f32(doc, "memory", "delay", 2.0); let volume_delay = get_or_set_f32(doc, "volume", "delay", 0.17); + let weather_delay = get_or_set_f32(doc, "weather", "delay", 7200.0); Config { seperator, @@ -138,6 +180,13 @@ fn parse_config(doc: &yaml::Yaml) -> Config { enabled: volume_enabled, delay: volume_delay, }, + weather: Weather { + city: weather_city, + format: weather_format, + icon: weather_icon, + enabled: weather_enabled, + delay: weather_delay, + }, } } @@ -222,6 +271,19 @@ pub fn run(config: Config) { }); } + // Weather thread + if config.weather.enabled { + let weather_tx = tx.clone(); + let configcp = config.clone(); + let weather_data = get_weather(&configcp); + let mut weather_data = ThreadsData::Weather(weather_data); + thread::spawn(move || loop { + weather_tx.send(weather_data).unwrap(); + weather_data = ThreadsData::Weather(get_weather(&configcp)); + thread::sleep(Duration::from_secs_f64(configcp.weather.delay)) + }); + } + // Time thread { let time_tx = tx; @@ -238,14 +300,15 @@ pub fn run(config: Config) { { // NOTE: order matters to the final format - let mut bar: Vec = vec!["".to_string(); 4]; + let mut bar: Vec = vec!["".to_string(); 5]; //iterating the values recieved from the threads for data in rx { match data { ThreadsData::Sound(x) => bar[0] = x, - ThreadsData::Disk(x) => bar[1] = x, - ThreadsData::Memory(x) => bar[2] = x, - ThreadsData::Time(x) => bar[3] = x, + ThreadsData::Weather(x) => bar[1] = x, + ThreadsData::Disk(x) => bar[2] = x, + ThreadsData::Memory(x) => bar[3] = x, + ThreadsData::Time(x) => bar[4] = x, } // match ends here @@ -254,6 +317,9 @@ pub fn run(config: Config) { } } +/* +this will call the command 'xsetroot -name ' +*/ pub fn update(bar: &Vec) { // TODO: FIX ME, this solution sucks let mut x = String::new(); @@ -276,6 +342,7 @@ pub fn update(bar: &Vec) { ############################# HELPER FUNCTIONS BELOW ################################### */ + pub fn get_time(config: &Config) -> String { let now = Local::now(); @@ -287,6 +354,30 @@ pub fn get_time(config: &Config) -> String { ) } +/* +CREDIT: thanks for wttr.in to use their API +will make a GET request from wttr.in +*/ +fn get_weather(config: &Config) -> String { + let format = if config.weather.format.is_empty() { + String::from("%l:+%t") + } else { + config.weather.format.clone() + }; + + let url = format!("http://wttr.in/{}?format=\"{}", config.weather.city, format); + let err_string = String::from("Error"); + let res = match minreq::get(url).send() { + Ok(resp) => match resp.as_str() { + Ok(res_str) => res_str.trim_matches('"').to_string(), + Err(_) => err_string, + }, + Err(_) => err_string, + }; + + format!(" {} {} {}", config.weather.icon, res, config.seperator) +} + pub fn get_disk(config: &Config) -> String { let cmd = Command::new("sh") .arg("-c") @@ -308,7 +399,7 @@ pub fn get_disk(config: &Config) -> String { ) } -// TODO: what a horrible solution to get the sound, i dont like it +// FIX ME: what a horrible solution to get the sound, i dont like it // find another way pub fn get_volume(config: &Config) -> String { @@ -331,6 +422,11 @@ pub fn get_volume(config: &Config) -> String { format!(" {} {} {}", config.volume.icon, vol, config.seperator) } +/* +mem_used = (mem_total + shmem - mem_free - mem_buffers - mem_cached - mem_srecl +thanks for htop's developer on stackoverflow for providing this algorithm to +calculate used memory. +*/ pub fn get_memory(config: &Config) -> Result { let mut buf = String::new(); @@ -392,7 +488,12 @@ pub fn get_memory(config: &Config) -> Result { } Ok(result) } -// helper function for the get_memory function + +/* +this helper function will split the line(first argument) by the character(:) +and then parse the right splited item as u32 +then assign that to the "assignable"(2nd argument). +*/ fn assign_val(line: &str, assignable: &mut u32) { let parsed: u32 = line.split(':').collect::>()[1] .trim() From 8d4666b64eb22b132f7cb05da57aed5c115575b4 Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Mon, 4 Jan 2021 02:30:43 +0300 Subject: [PATCH 03/13] cargo.lock updated --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 6a74754..64b6a19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,7 +58,7 @@ dependencies = [ [[package]] name = "rsblocks" -version = "0.1.2" +version = "0.1.3" dependencies = [ "chrono", "minreq", From 90f6944da4cff411fa28755339b242775fbb4d7d Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Mon, 4 Jan 2021 02:43:17 +0300 Subject: [PATCH 04/13] updated screenshot --- screenshots/1.png | Bin 6093 -> 6878 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/screenshots/1.png b/screenshots/1.png index 67bff904e53f53ed079826f9a8db651be48e4f27..495c216cfa2ba8e9079fea93022a7559fe8bb3a5 100644 GIT binary patch literal 6878 zcmV<48X@J0P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1b@k}SCi{I65^2m*va$3b5azJZVLq`Ify%-glS z8{w|$s%n)AK_(=ca{l$tTmFF$nby+OypP^1K5ewYfg7){&v?#M+jD;Xpvv#jALE7O z{Ssp+@87>I-Y*8m_16nuYtZ~TUi|%p{cVUohM$k*%6Y%PJBe|AjZ=FY8s~M>hue2o z=iAVFPkdZ?f7{2c*Cl_K9|H!IwqhY+K7y#9v%fr${E`H&uXDq^91Cf}1s4)}8v`Ie z!uz_``W>JjAb;JJ-_ieo@EiCX?-}wNmi>(pZvONE>2KrmS)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`g~M}UJJ&8&=d-4IQO%==MKevTs8r>_^#~6E0Myl1AqdaL&bjQtJpceQs28K# z@*Le9o}QYVpPhg-?O@rur_ z-uH6T$W-OYq`>a&##oO?JKvF+euYFLM@Gkx$mD0u4JVF%#^(#Pbw?Or-hROWK@n{& z&x#AP000g3HTk)>Hh#FTw}(|;R+w@7vYCZFre5HkT)YbM(!0A^*pW!|b$0P8%)9fl zvt61?SonJM)B}svk#*-Stvvv69g`@kU^5S716FNIy*g3cr}(DeQP><7O&PbO1;`2O?SC*@$;LKYU`ky~|V7+~yN z{&?cRRHk5PY+-5bC{0T47iMB7t&@yRAMQJI>dPq=($wi$1$m=PeOyX9KCR<#Y^WK> zV>J_vr}foxu^6BA$dp3Sy$l#8q92XqEaVi%3*v{z{%;}Pv(tDzB8MDuOfvop$k8Ua T3k0US00000NkvXXu0mjfvU$e$ From 279a2947026f9fe576ed51c88b00ee33558c3b38 Mon Sep 17 00:00:00 2001 From: Mustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com> Date: Mon, 4 Jan 2021 02:51:14 +0300 Subject: [PATCH 05/13] Delete 1.png --- screenshots/1.png | Bin 6878 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 screenshots/1.png diff --git a/screenshots/1.png b/screenshots/1.png deleted file mode 100644 index 495c216cfa2ba8e9079fea93022a7559fe8bb3a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6878 zcmV<48X@J0P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1b@k}SCi{I65^2m*va$3b5azJZVLq`Ify%-glS z8{w|$s%n)AK_(=ca{l$tTmFF$nby+OypP^1K5ewYfg7){&v?#M+jD;Xpvv#jALE7O z{Ssp+@87>I-Y*8m_16nuYtZ~TUi|%p{cVUohM$k*%6Y%PJBe|AjZ=FY8s~M>hue2o z=iAVFPkdZ?f7{2c*Cl_K9|H!IwqhY+K7y#9v%fr${E`H&uXDq^91Cf}1s4)}8v`Ie z!u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{nk07*qoM6N<$f}PApxBvhE From afa9ce984e9388d8b6a4a3fb8536563d4d7f764e Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Mon, 4 Jan 2021 03:00:27 +0300 Subject: [PATCH 06/13] updated screenshot --- screenshots/1.png | Bin 0 -> 6843 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 screenshots/1.png diff --git a/screenshots/1.png b/screenshots/1.png new file mode 100644 index 0000000000000000000000000000000000000000..cac7e46f8d569f056b4cd0ebae9358594b184ed5 GIT binary patch literal 6843 zcmV;s8bsxZP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3vbvgEi8ME|)8FM%Kl0$dKC5#E89??aXPcHf?{ zJrm(ll%%3qB#@a%DC~dz^Mrr!5z8qQHLtDK$fvZ@Qs>6w=hL3E#PXa!pB2+P`fWT& zekUY`?*04Q`sXU0asBy+AA897J|6silKfprz7~Ey`R<&aNPY>D@$?y&@-Ec&=cYEd zUqc=5Li3&Ygz|pNS6H9R{T;py7$_}eqny&tWc{4|6G6UT$(`%xT$mSge(qyyT<#`D+y>DP_(S48Ri178oR z-_v=&=PW;Gf3oYPf@pme^?)rumSN%m^8Ea*au{Fb-kzgzcA|{I`dH=LqM_3z0m4wg)TXN>|r}ahbbkW9IoA{{dAfV^ACqTp(p1wO#+x8QbIk@fEqBN&MbVEHM?+n+7FDfk>Oq_Knro?A zYqfe!u3NTZYSql#nsv`!T)n!vd-L8>%Xpx++N^nNt@ji<8+F#|%nPuv%)27ch`${V>Y+}`A%U4@{OV~KYE?alqwtctV4_Z62x%n{msltnC%v9gW z)%yx0T~AzdSUkobXkfj@BXQ^3C2L-Gx|TuGR(B(RaG82zOvUn8K7g=RY^1a)d*EJb z#G!;LGPtj;+gvqoTYXrodx)pm%dySGMx(mh?$LEL)o_1!$$KiTb~vH!JN2kHwXNs0 zm~=dmnt~#`timL*l}(Z8gzMc#Fo{zMQueMV)6pw^Po@(i`_6FydBlZ}p3zp0)|OHH zYh?l3Rg#~T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emTwT9uH4nti8T&HQbu~hI8)2e z6`M{)?8W18I2=Klp++Q;Ev+3bZ5(S*vN1GDJRZL=WL-jBG)IbaP3^2!GYdOrYm?~& z>zTg6*u+CvZD+N%wlvQ44T`&Vn#bi*sWhQT1TXeEo$VE+1rC$lCRj|o5_=NnDsah$ z+cz&tu4@XOWDPzEE)6o$;=OzpwKO->R+S2c0*Ip6+uJ>o6Pei$?>RWRO1A48m;!_6 z0i&mzQ-YNA)K-^n|LR}AEWBndl+~Zc zlSw{7AmA4*-jEO%!)CLd7U#Nq1$4ACx!k_VQ#||odRc8vqbI`4)|~(VkFrv{eS%tB z8aW)cyXQO}pIcs*ClClR#$UYUrlP80U^qVW{%s7iLIa|?Au@yJ@cUDYm~Nks&^h4*;krE8_Ecmevlx{=5SKz<(YmAlbwTI8>yk+`u3ht7oLGqpz)_ zZ(;2yZru6JDtK{fYv>`PS`o;=Vc9UX=aGg{a>TE(l!p-JTO95}DJw~o0k`r3` zijx?3?_2{oFv~AQLtRTK5_NId*Dn82nD_8MYy4bP__?TX@M;l%;{uJQv~0x|9*P~2@fuw{>ii*_G<(n0$)Q0-%V@JM|^2EHGm%oo+NJ~>g)`MgWvqFy(2!jGh6q z$Ls0lpqa+70uqTN?0XR%>9GEaOeXXBTmS%{&)vW0lYc9ad>#OROn$k10{0gEUGeV^ zo}p6dzx}+U>}lSx#3T~r?X%F($PEADc?OY4^z2z}LR<`-lfJRo@ae8Uj{gs~M=w6eYf^qVoCNn}45wd-<=bEP1`NRzZO}Z{dfXovb$@NW5>jaPH_^&3|omsSLl1 zdLPW~4aeK`|4%4V>CYOf%bw;*o@0CWfc?GLE5J@7q*&l0yzT Date: Fri, 8 Jan 2021 02:15:02 +0100 Subject: [PATCH 07/13] Squashed commit of the following: commit 89ec61f2cc24238dbccf2890235fab7a66efdc5b Author: AdaShoelace Date: Fri Jan 8 01:49:19 2021 +0100 Support pulseaudio commit b4bc05538b22d86a53e4461bbee2c8c4d33b0f80 Author: AdaShoelace Date: Fri Jan 8 01:06:32 2021 +0100 Display volume in percent commit 14570efeebeb127494509534886dd521a23f24f0 Author: AdaShoelace Date: Thu Jan 7 14:22:34 2021 +0100 Programmatically rename root and get alsa volume commit 391b2ec7360fd9ae462a87c0a3ae86d39f695c3f Author: AdaShoelace Date: Mon Jan 4 22:26:57 2021 +0100 Remove usage of 'Command' from get_disk commit 0625be6e822e18cf4e2fd212695ddd1592161a97 Author: AdaShoelace Date: Mon Jan 4 22:25:01 2021 +0100 Add nix dependency commit c66e1cc09031f0a7ddf40016855a6d7457d9d65f Author: AdaShoelace Date: Mon Jan 4 16:14:55 2021 +0100 ignore commit 32dbdc5f3d636551c64e2f303365a5a5e3d94994 Author: AdaShoelace Date: Mon Jan 4 02:21:51 2021 +0100 Add breadx to dependencies commit 4d23c36552b461b06127705964e1a16dd395e658 Author: AdaShoelace Date: Mon Jan 4 01:13:55 2021 +0100 Add exclusion to gitignore --- Cargo.lock | 367 +++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 8 +- rsblocks.yml | 3 +- src/lib.rs | 125 ++++++++++-------- src/main.rs | 3 +- 5 files changed, 451 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 64b6a19..0391af8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,11 +1,165 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + +[[package]] +name = "alsa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb213f6b3e4b1480a60931ca2035794aa67b73103d254715b1db7b70dcb3c934" +dependencies = [ + "alsa-sys", + "bitflags", + "libc", + "nix 0.15.0", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "async-channel" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59740d83946db6a5af71ae25ddf9562c2b176b2ca42cf99a455f09f4a220d6b9" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-io" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9315f8f07556761c3e48fec2e6b276004acf426e6dc068b2c2251854d65ee0fd" +dependencies = [ + "concurrent-queue", + "fastrand", + "futures-lite", + "libc", + "log", + "nb-connect", + "once_cell", + "parking", + "polling", + "vec-arena", + "waker-fn", + "winapi", +] + +[[package]] +name = "async-net" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06de475c85affe184648202401d7622afb32f0f74e02192857d0201a16defbe5" +dependencies = [ + "async-io", + "blocking", + "fastrand", + "futures-lite", +] + +[[package]] +name = "async-task" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" + +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "blocking" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9" +dependencies = [ + "async-channel", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "once_cell", +] + +[[package]] +name = "breadx" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bff92e2ec549fe3f20386d73efb30263be7467463def0c2a780d7cee5dbf5e3" +dependencies = [ + "async-io", + "async-net", + "blocking", + "bytemuck", + "cfg-if 1.0.0", + "cty", + "futures-lite", + "hashbrown", + "log", + "memchr", + "nix 0.19.1", + "ref_slice", + "tinyvec", +] + +[[package]] +name = "bytemuck" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" + +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + +[[package]] +name = "cc" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "chrono" version = "0.4.19" @@ -19,6 +173,81 @@ dependencies = [ "winapi", ] +[[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +dependencies = [ + "cache-padded", +] + +[[package]] +name = "cty" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3" + +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] +name = "fastrand" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3" +dependencies = [ + "instant", +] + +[[package]] +name = "futures-core" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" + +[[package]] +name = "futures-io" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" + +[[package]] +name = "futures-lite" +version = "1.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash", +] + +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "libc" version = "0.2.81" @@ -31,12 +260,62 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +[[package]] +name = "log" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +dependencies = [ + "cfg-if 0.1.10", +] + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + [[package]] name = "minreq" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2466d0a7e6bfcd54f69e4a17d4a4318985aaaf7fe3df4cd3b6f11ff551129ca3" +[[package]] +name = "nb-connect" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8123a81538e457d44b933a02faf885d3fe8408806b23fa700e8f01c6c3a98998" +dependencies = [ + "libc", + "winapi", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" +dependencies = [ + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -56,12 +335,58 @@ dependencies = [ "autocfg", ] +[[package]] +name = "once_cell" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "pin-project-lite" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "polling" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a7bc6b2a29e632e45451c941832803a18cce6781db04de8a04696cdca8bde4" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "log", + "wepoll-sys", + "winapi", +] + +[[package]] +name = "ref_slice" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e1b7878800220a76a08f32c057829511440f65528b63b940f2f2bc145d7ac68" + [[package]] name = "rsblocks" version = "0.1.3" dependencies = [ + "alsa", + "breadx", "chrono", "minreq", + "nix 0.19.1", "yaml-rust", ] @@ -76,12 +401,54 @@ dependencies = [ "winapi", ] +[[package]] +name = "tinyvec" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "vec-arena" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +[[package]] +name = "wepoll-sys" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff" +dependencies = [ + "cc", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 36889bd..9e8e631 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,10 @@ description = "a multi threaded status bar for dwm window manager for linux" [dependencies] chrono = "0.4" yaml-rust = "0.4" -minreq = "2.2.1" \ No newline at end of file +minreq = "2.2.1" +alsa = "0.4.3" +nix = "0.19.1" + +[dependencies.breadx] +version = "0.1.11" +features = ["async"] diff --git a/rsblocks.yml b/rsblocks.yml index 76e83f6..d02f12c 100644 --- a/rsblocks.yml +++ b/rsblocks.yml @@ -27,9 +27,10 @@ disk: # reads from alsa, alsa-utils package should # be installed on the system to make it work. volume: - enable: false + enable: true icon: '' delay: 0.18 + card: 'PULSE' # weather format options is available on diff --git a/src/lib.rs b/src/lib.rs index edb30f7..ed11c9c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,13 +1,13 @@ +use breadx::{display::*, window::Window}; use chrono::prelude::*; use minreq; -use std::env; use std::fs::File; use std::io::Error; use std::io::Read; -use std::process::Command; use std::sync::mpsc; use std::thread; use std::time::Duration; +use alsa::mixer::{Mixer, SelemChannelId, SelemId}; use yaml_rust::{yaml, YamlLoader}; #[derive(Debug)] @@ -54,6 +54,7 @@ pub struct Volume { pub icon: String, pub enabled: bool, pub delay: f64, + pub card: String } #[derive(Clone)] @@ -75,7 +76,7 @@ it will call load_defaults to load a hardcoded default configuration it will always return a valid configuration inside a Result. */ pub fn load_config() -> Result { - let yml_source = env::var("HOME").unwrap() + "/.config/rsblocks/rsblocks.yml"; + let yml_source = std::env::var("HOME").unwrap() + "/.config/rsblocks/rsblocks.yml"; let mut data = String::new(); let mut file = match File::open(&yml_source) { Ok(file) => file, @@ -115,6 +116,7 @@ fn load_defaults() -> Config { icon: String::from(""), enabled: false, delay: 0.17, + card: String::from("ALSA") }, weather: Weather { city: String::from(""), @@ -157,6 +159,9 @@ fn parse_config(doc: &yaml::Yaml) -> Config { let memory_delay = get_or_set_f32(doc, "memory", "delay", 2.0); let volume_delay = get_or_set_f32(doc, "volume", "delay", 0.17); let weather_delay = get_or_set_f32(doc, "weather", "delay", 7200.0); + + // parsing card for volume, ALSA or PULSE + let volume_card = get_or_set_string(doc, "volume", "card", "ALSA"); Config { seperator, @@ -179,6 +184,7 @@ fn parse_config(doc: &yaml::Yaml) -> Config { icon: volume_icon, enabled: volume_enabled, delay: volume_delay, + card: volume_card }, weather: Weather { city: weather_city, @@ -231,18 +237,37 @@ fn get_or_set_string(doc: &yaml::Yaml, parent: &str, child: &str, default_val: & TODO: this is sucks, repeated code in threads below, fix me you fucking asshole */ -pub fn run(config: Config) { - let (tx, rx) = mpsc::channel(); +pub struct Blocks { + disp: Display, + root: Window, +} +impl Blocks { + pub fn new() -> Self { + let disp = Display::create(None, None).expect("Failed to create x11 connection"); + let root = disp.default_screen().root; + Self { + disp, + root, + } + } +} + +pub fn run(config: Config, mut blocks: Blocks) { + let (tx, rx) = mpsc::channel(); // volume thread if config.volume.enabled { let volume_tx = tx.clone(); let configcp = config.clone(); - let mut vol_data = ThreadsData::Sound(get_volume(&configcp)); - thread::spawn(move || loop { - let _ = volume_tx.send(vol_data); - vol_data = ThreadsData::Sound(get_volume(&configcp)); - thread::sleep(Duration::from_secs_f64(configcp.volume.delay)) + thread::spawn(move || { + let mut vol_data = + ThreadsData::Sound(get_volume(&configcp)); + loop { + let _ = volume_tx.send(vol_data); + vol_data = + ThreadsData::Sound(get_volume(&configcp)); + thread::sleep(Duration::from_secs_f64(configcp.volume.delay)) + } }); } @@ -299,7 +324,6 @@ pub fn run(config: Config) { //Main { // NOTE: order matters to the final format - let mut bar: Vec = vec!["".to_string(); 5]; //iterating the values recieved from the threads for data in rx { @@ -312,25 +336,22 @@ pub fn run(config: Config) { } // match ends here - update(&bar); + update(&bar, &mut blocks); } } } -/* -this will call the command 'xsetroot -name ' -*/ -pub fn update(bar: &Vec) { +pub fn update(bar: &Vec, blocks: &mut Blocks) { // TODO: FIX ME, this solution sucks let mut x = String::new(); for i in bar.iter() { x.push_str(i.as_str()); } - Command::new("xsetroot") - .arg("-name") - .arg(x) - .output() - .unwrap(); + + blocks + .root + .set_title(&mut blocks.disp, &x) + .expect("Failed to set title of root"); } /*############################ RUNNING THE PROGRAM ENDS HERE ###########################################*/ @@ -379,47 +400,47 @@ fn get_weather(config: &Config) -> String { } pub fn get_disk(config: &Config) -> String { - let cmd = Command::new("sh") - .arg("-c") - .args(&["df -h"]) - .output() - .unwrap(); - let output = String::from_utf8_lossy(&cmd.stdout); + const GB: u64 = (1024 * 1024) * 1024; + let statvfs = nix::sys::statvfs::statvfs("/").unwrap(); let mut disk_used = String::new(); - for line in output.lines() { - if line.ends_with('/') { - let splited = line.split_whitespace().collect::>(); - disk_used = splited[2].to_string(); - break; - } - } + + let total = (statvfs.blocks() * statvfs.fragment_size()) / GB; + let available = (statvfs.blocks_free() * statvfs.fragment_size()) / GB; + let used = total - available; + + disk_used.push_str(&format!("{}GB", used)); format!( " {} {} {}", config.disk.icon, disk_used, config.seperator ) } -// FIX ME: what a horrible solution to get the sound, i dont like it -// find another way - pub fn get_volume(config: &Config) -> String { - let cmd_content = Command::new("amixer") - .args(&["-D", "pulse", "get", "Master"]) - .output() - .expect("Make sure that you have alsa-utils installed on your system"); + let card = if config.volume.card == "PULSE" { + "pulse" + } else { + "default" + }; - let vol: String = String::from_utf8_lossy(&cmd_content.stdout) - .lines() - .last() - .expect("failed to get sound volume") - .split('[') - .collect::>()[1] - .split(']') - .collect::>()[0] - .trim() - .to_string(); + let mixer = Mixer::new(card, false).expect("Failed to open mixer"); + let selem_id = SelemId::new("Master", 0); + let selem = mixer.find_selem(&selem_id).expect("Couldn't find selem"); + let selem_chan_id = SelemChannelId::FrontLeft; + + let (min, max) = selem.get_playback_volume_range(); + let mut raw_volume = selem + .get_playback_volume(selem_chan_id) + .expect("Failed to get raw_volume"); + + let range = max - min; + let vol = if range == 0 { + 0 + } else { + raw_volume -= min; + ((raw_volume as f64 / range as f64) * 100.) as u64 + }; - format!(" {} {} {}", config.volume.icon, vol, config.seperator) + format!(" {} {}% {}", config.volume.icon, vol, config.seperator) } /* diff --git a/src/main.rs b/src/main.rs index 2211cb9..c3a542d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,5 +2,6 @@ use rsblocks; fn main() { let config = rsblocks::load_config().unwrap(); - rsblocks::run(config); + let blocks = rsblocks::Blocks::new(); + rsblocks::run(config, blocks); } From 3fa52e145a40262e2a02977594973f031b6e9e30 Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Fri, 8 Jan 2021 05:48:39 +0300 Subject: [PATCH 08/13] updated version in cargo config file and removed the build status since the workflow does not have sound card --- .github/workflows/rust.yml | 20 -------------------- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 4 ++-- 4 files changed, 4 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 75959c5..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Rust - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose diff --git a/Cargo.lock b/Cargo.lock index 0391af8..43bd5a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -380,7 +380,7 @@ checksum = "4e1b7878800220a76a08f32c057829511440f65528b63b940f2f2bc145d7ac68" [[package]] name = "rsblocks" -version = "0.1.3" +version = "0.1.4" dependencies = [ "alsa", "breadx", diff --git a/Cargo.toml b/Cargo.toml index 9e8e631..5ac12cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsblocks" -version = "0.1.3" +version = "0.1.4" authors = ["mustafa salih "] edition = "2018" readme = "README.md" diff --git a/README.md b/README.md index 3b33e2f..2cffd71 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # rsblocks [github](https://github.com/MustafaSalih1993/rsblocks) [crates](https://crates.io/crates/rsblocks) -[build](https://github.com/MustafaSalih1993/rsblocks/actions?query=workflow%3ARust) + A multi threaded fast status bar for dwm window manager written in **Rust** 🦀

@@ -14,7 +14,7 @@ A multi threaded fast status bar for dwm window manager written in **Rust** 🦀 * Memory Usage * Disk Usage * Weather Temperature -* Sound volume _reads from `alsa-utils`_ +* Sound volume * Easy to configure with `rsblocks.yml` file From 14405523bc95f44f3dd4bcd22ae8c08dee8bfffa Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Sat, 9 Jan 2021 03:40:14 +0300 Subject: [PATCH 09/13] Added cpu temperature and battery --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 6 +- rsblocks.yml | 12 +++ screenshots/1.png | Bin 6843 -> 0 bytes screenshots/2.png | Bin 0 -> 7810 bytes src/lib.rs | 203 ++++++++++++++++++++++++++++++++++++++-------- 7 files changed, 185 insertions(+), 40 deletions(-) delete mode 100644 screenshots/1.png create mode 100644 screenshots/2.png diff --git a/Cargo.lock b/Cargo.lock index 43bd5a6..a6681e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -380,7 +380,7 @@ checksum = "4e1b7878800220a76a08f32c057829511440f65528b63b940f2f2bc145d7ac68" [[package]] name = "rsblocks" -version = "0.1.4" +version = "0.1.5" dependencies = [ "alsa", "breadx", diff --git a/Cargo.toml b/Cargo.toml index 5ac12cd..ef392be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsblocks" -version = "0.1.4" +version = "0.1.5" authors = ["mustafa salih "] edition = "2018" readme = "README.md" diff --git a/README.md b/README.md index 2cffd71..217937d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A multi threaded fast status bar for dwm window manager written in **Rust** 🦀

- +


## Features @@ -14,7 +14,9 @@ A multi threaded fast status bar for dwm window manager written in **Rust** 🦀 * Memory Usage * Disk Usage * Weather Temperature -* Sound volume +* Sound Volume +* Battery Percentage +* Cpu Temperature * Easy to configure with `rsblocks.yml` file diff --git a/rsblocks.yml b/rsblocks.yml index d02f12c..6d0786c 100644 --- a/rsblocks.yml +++ b/rsblocks.yml @@ -46,3 +46,15 @@ weather: format: '%l:+%t' delay: 7200.0 # 7200 seconds = 2 hours + +battery: + source: 'BAT0' + icon: '' + enable: false + delay: 120.0 + + +cpu_temperature: + icon: '' + enable: true + delay: 120.0 diff --git a/screenshots/1.png b/screenshots/1.png deleted file mode 100644 index cac7e46f8d569f056b4cd0ebae9358594b184ed5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6843 zcmV;s8bsxZP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3vbvgEi8ME|)8FM%Kl0$dKC5#E89??aXPcHf?{ zJrm(ll%%3qB#@a%DC~dz^Mrr!5z8qQHLtDK$fvZ@Qs>6w=hL3E#PXa!pB2+P`fWT& zekUY`?*04Q`sXU0asBy+AA897J|6silKfprz7~Ey`R<&aNPY>D@$?y&@-Ec&=cYEd zUqc=5Li3&Ygz|pNS6H9R{T;py7$_}eqny&tWc{4|6G6UT$(`%xT$mSge(qyyT<#`D+y>DP_(S48Ri178oR z-_v=&=PW;Gf3oYPf@pme^?)rumSN%m^8Ea*au{Fb-kzgzcA|{I`dH=LqM_3z0m4wg)TXN>|r}ahbbkW9IoA{{dAfV^ACqTp(p1wO#+x8QbIk@fEqBN&MbVEHM?+n+7FDfk>Oq_Knro?A zYqfe!u3NTZYSql#nsv`!T)n!vd-L8>%Xpx++N^nNt@ji<8+F#|%nPuv%)27ch`${V>Y+}`A%U4@{OV~KYE?alqwtctV4_Z62x%n{msltnC%v9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*qoM6N<$g8ghc$N&HU literal 0 HcmV?d00001 diff --git a/src/lib.rs b/src/lib.rs index ed11c9c..60a4c37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +use alsa::mixer::{Mixer, SelemChannelId, SelemId}; use breadx::{display::*, window::Window}; use chrono::prelude::*; use minreq; @@ -7,7 +8,6 @@ use std::io::Read; use std::sync::mpsc; use std::thread; use std::time::Duration; -use alsa::mixer::{Mixer, SelemChannelId, SelemId}; use yaml_rust::{yaml, YamlLoader}; #[derive(Debug)] @@ -17,6 +17,8 @@ pub enum ThreadsData { Memory(String), Time(String), Weather(String), + Battery(String), + CpuTemp(String), } #[derive(Clone)] @@ -27,6 +29,8 @@ pub struct Config { pub disk: Disk, pub volume: Volume, pub weather: Weather, + pub battery: Battery, + pub cpu_temperature: CpuTemp, } #[derive(Clone)] @@ -54,7 +58,7 @@ pub struct Volume { pub icon: String, pub enabled: bool, pub delay: f64, - pub card: String + pub card: String, } #[derive(Clone)] @@ -66,10 +70,37 @@ pub struct Weather { pub delay: f64, } -/* -// TODO: error handling required if rsblocks.yml file is empty +#[derive(Clone)] +pub struct Battery { + pub source: String, + pub icon: String, + pub enabled: bool, + pub delay: f64, +} -this function is responsible to check if the rsblocks.yml file +#[derive(Clone)] +pub struct CpuTemp { + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +/* TODOS + + TODO 1: Error handling required if rsblocks.yml file is empty. + + TODO 2: This lib file growing and soon it will be annoying to move + arround, need fix soon. + + TODO 3: Need a better comments in code, or no one will understand what happens. + + TODO 4: Need a documentation. + + TODO 5: Fix repeated code for threads in `run` function. + +*/ + +/*this function is responsible to check if the rsblocks.yml file exists to call parse_config to read it OTHERWISE it will call load_defaults to load a hardcoded default configuration @@ -116,7 +147,7 @@ fn load_defaults() -> Config { icon: String::from(""), enabled: false, delay: 0.17, - card: String::from("ALSA") + card: String::from("ALSA"), }, weather: Weather { city: String::from(""), @@ -125,6 +156,17 @@ fn load_defaults() -> Config { enabled: false, delay: 7200.0, //7200 seconds = 2 hours }, + battery: Battery { + source: String::from("BAT0"), + icon: String::from(""), + enabled: false, + delay: 120.0, + }, + cpu_temperature: CpuTemp { + icon: String::from(""), + enabled: false, + delay: 120.0, + }, } } @@ -141,6 +183,8 @@ fn parse_config(doc: &yaml::Yaml) -> Config { let disk_icon = get_or_set_string(doc, "disk", "icon", ""); let volume_icon = get_or_set_string(doc, "volume", "icon", ""); let weather_icon = get_or_set_string(doc, "weather", "icon", ""); + let battery_icon = get_or_set_string(doc, "battery", "icon", ""); + let cpu_temperature_icon = get_or_set_string(doc, "cpu_temperature", "icon", ""); //parsing formats and city weather let time_format = get_or_set_string(doc, "time", "format", "%T"); @@ -152,17 +196,24 @@ fn parse_config(doc: &yaml::Yaml) -> Config { let memory_enabled = get_or_set_bool(doc, "memory", "enable"); let volume_enabled = get_or_set_bool(doc, "volume", "enable"); let weather_enabled = get_or_set_bool(doc, "weather", "enable"); + let battery_enabled = get_or_set_bool(doc, "battery", "enable"); + let cpu_temperature_enabled = get_or_set_bool(doc, "cpu_temperature", "enable"); // parsing update_delay state (should be all seconds in f64 type) - let time_delay = get_or_set_f32(doc, "time", "delay", 1.0); - let disk_delay = get_or_set_f32(doc, "disk", "delay", 120.0); - let memory_delay = get_or_set_f32(doc, "memory", "delay", 2.0); - let volume_delay = get_or_set_f32(doc, "volume", "delay", 0.17); - let weather_delay = get_or_set_f32(doc, "weather", "delay", 7200.0); - + let time_delay = get_or_set_f64(doc, "time", "delay", 1.0); + let disk_delay = get_or_set_f64(doc, "disk", "delay", 120.0); + let memory_delay = get_or_set_f64(doc, "memory", "delay", 2.0); + let volume_delay = get_or_set_f64(doc, "volume", "delay", 0.17); + let weather_delay = get_or_set_f64(doc, "weather", "delay", 7200.0); + let battery_delay = get_or_set_f64(doc, "battery", "delay", 120.0); + let cpu_temperature_delay = get_or_set_f64(doc, "cpu_temperature", "delay", 120.0); + // parsing card for volume, ALSA or PULSE let volume_card = get_or_set_string(doc, "volume", "card", "ALSA"); + // parsing battery source name + let battery_source = get_or_set_string(doc, "battery", "source", "BAT0"); + Config { seperator, time: Time { @@ -184,7 +235,7 @@ fn parse_config(doc: &yaml::Yaml) -> Config { icon: volume_icon, enabled: volume_enabled, delay: volume_delay, - card: volume_card + card: volume_card, }, weather: Weather { city: weather_city, @@ -193,11 +244,22 @@ fn parse_config(doc: &yaml::Yaml) -> Config { enabled: weather_enabled, delay: weather_delay, }, + battery: Battery { + source: battery_source, + icon: battery_icon, + enabled: battery_enabled, + delay: battery_delay, + }, + cpu_temperature: CpuTemp { + icon: cpu_temperature_icon, + enabled: cpu_temperature_enabled, + delay: cpu_temperature_delay, + }, } } // getting a f32 value from rsblocks.yml file or set default (last argument) -fn get_or_set_f32(doc: &yaml::Yaml, parent: &str, child: &str, default: f64) -> f64 { +fn get_or_set_f64(doc: &yaml::Yaml, parent: &str, child: &str, default: f64) -> f64 { let val: f64 = if doc[parent][child].is_badvalue() { default } else { @@ -233,9 +295,7 @@ fn get_or_set_string(doc: &yaml::Yaml, parent: &str, child: &str, default_val: & */ -/* Running the program: -TODO: this is sucks, repeated code in threads below, fix me you fucking asshole - */ +// Running the program: pub struct Blocks { disp: Display, @@ -246,10 +306,7 @@ impl Blocks { pub fn new() -> Self { let disp = Display::create(None, None).expect("Failed to create x11 connection"); let root = disp.default_screen().root; - Self { - disp, - root, - } + Self { disp, root } } } @@ -259,15 +316,11 @@ pub fn run(config: Config, mut blocks: Blocks) { if config.volume.enabled { let volume_tx = tx.clone(); let configcp = config.clone(); - thread::spawn(move || { - let mut vol_data = - ThreadsData::Sound(get_volume(&configcp)); - loop { - let _ = volume_tx.send(vol_data); - vol_data = - ThreadsData::Sound(get_volume(&configcp)); - thread::sleep(Duration::from_secs_f64(configcp.volume.delay)) - } + let mut vol_data = ThreadsData::Sound(get_volume(&configcp)); + thread::spawn(move || loop { + volume_tx.send(vol_data).unwrap(); + vol_data = ThreadsData::Sound(get_volume(&configcp)); + thread::sleep(Duration::from_secs_f64(configcp.volume.delay)) }); } @@ -309,6 +362,32 @@ pub fn run(config: Config, mut blocks: Blocks) { }); } + // Battery thread + if config.battery.enabled { + let battery_tx = tx.clone(); + let configcp = config.clone(); + let battery_data = get_battery(&configcp).unwrap(); + let mut battery_data = ThreadsData::Battery(battery_data); + thread::spawn(move || loop { + battery_tx.send(battery_data).unwrap(); + battery_data = ThreadsData::Battery(get_battery(&configcp).unwrap()); + thread::sleep(Duration::from_secs_f64(configcp.battery.delay)) + }); + } + + // Cpu temperature thread + if config.cpu_temperature.enabled { + let cpu_temp_tx = tx.clone(); + let configcp = config.clone(); + let cpu_temp_data = get_cpu_temp(&configcp).unwrap(); + let mut cpu_temp_data = ThreadsData::CpuTemp(cpu_temp_data); + thread::spawn(move || loop { + cpu_temp_tx.send(cpu_temp_data).unwrap(); + cpu_temp_data = ThreadsData::CpuTemp(get_cpu_temp(&configcp).unwrap()); + thread::sleep(Duration::from_secs_f64(configcp.cpu_temperature.delay)) + }); + } + // Time thread { let time_tx = tx; @@ -324,7 +403,7 @@ pub fn run(config: Config, mut blocks: Blocks) { //Main { // NOTE: order matters to the final format - let mut bar: Vec = vec!["".to_string(); 5]; + let mut bar: Vec = vec!["".to_string(); 7]; //iterating the values recieved from the threads for data in rx { match data { @@ -332,7 +411,9 @@ pub fn run(config: Config, mut blocks: Blocks) { ThreadsData::Weather(x) => bar[1] = x, ThreadsData::Disk(x) => bar[2] = x, ThreadsData::Memory(x) => bar[3] = x, - ThreadsData::Time(x) => bar[4] = x, + ThreadsData::CpuTemp(x) => bar[4] = x, + ThreadsData::Battery(x) => bar[5] = x, + ThreadsData::Time(x) => bar[6] = x, } // match ends here @@ -399,6 +480,7 @@ fn get_weather(config: &Config) -> String { format!(" {} {} {}", config.weather.icon, res, config.seperator) } +// getting disk usage pub fn get_disk(config: &Config) -> String { const GB: u64 = (1024 * 1024) * 1024; let statvfs = nix::sys::statvfs::statvfs("/").unwrap(); @@ -408,7 +490,7 @@ pub fn get_disk(config: &Config) -> String { let available = (statvfs.blocks_free() * statvfs.fragment_size()) / GB; let used = total - available; - disk_used.push_str(&format!("{}GB", used)); + disk_used.push_str(&format!("{}G", used)); format!( " {} {} {}", config.disk.icon, disk_used, config.seperator @@ -426,15 +508,15 @@ pub fn get_volume(config: &Config) -> String { let selem_id = SelemId::new("Master", 0); let selem = mixer.find_selem(&selem_id).expect("Couldn't find selem"); let selem_chan_id = SelemChannelId::FrontLeft; - + let (min, max) = selem.get_playback_volume_range(); let mut raw_volume = selem .get_playback_volume(selem_chan_id) .expect("Failed to get raw_volume"); - + let range = max - min; let vol = if range == 0 { - 0 + 0 } else { raw_volume -= min; ((raw_volume as f64 / range as f64) * 100.) as u64 @@ -524,3 +606,52 @@ fn assign_val(line: &str, assignable: &mut u32) { .unwrap(); *assignable = parsed; } + +// getting battery percentage +pub fn get_battery(config: &Config) -> Result { + let battery_full_cap_file = format!( + "/sys/class/power_supply/{}/charge_full_design", + config.battery.source + ); + let battery_charge_now_file = format!( + "/sys/class/power_supply/{}/charge_now", + config.battery.source + ); + + let mut buf = String::new(); + + // FIXME: ugly error handling AGAIN fixing later, im lazy + match File::open(&battery_full_cap_file) { + Ok(mut file) => file.read_to_string(&mut buf)?, + Err(_) => return Ok(String::from("check your battery source name")), + }; + let full_design = buf.trim().parse::().unwrap(); + buf.clear(); + + // NOTE: no need to error check if passed the above match + File::open(&battery_charge_now_file)?.read_to_string(&mut buf)?; + + let charge_now = buf.trim().parse::().unwrap(); + + let battery_percentage = (charge_now as f32 / full_design as f32) * 100.0; + let result = format!( + " {} {:.0}% {}", + config.battery.icon, battery_percentage, config.seperator + ); + Ok(result) +} + +// getting cpu temperature +pub fn get_cpu_temp(config: &Config) -> Result { + let mut buf = String::new(); + File::open("/sys/class/thermal/thermal_zone0/temp")?.read_to_string(&mut buf)?; + let value = buf.trim().parse::().unwrap(); + + let result = format!( + " {} {}° {}", + config.cpu_temperature.icon, + value / 1000.0, + config.seperator + ); + Ok(result) +} From fc334d6905b6ec6400929f1a96e78b629ebdb4f1 Mon Sep 17 00:00:00 2001 From: Mustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com> Date: Sat, 9 Jan 2021 03:55:35 +0300 Subject: [PATCH 10/13] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..c2ade3b --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at mustafasalih1991@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq From d30253a1e5a92f78b81a1e1507e08549426d2fe1 Mon Sep 17 00:00:00 2001 From: Mustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com> Date: Sat, 9 Jan 2021 03:57:27 +0300 Subject: [PATCH 11/13] Create CONTRIBUTING.md --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..445e9bc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ +All Contributions are welcome. From 974563011c478a348fc0fcce6e8c921f60ad99dd Mon Sep 17 00:00:00 2001 From: mustafa salih Date: Sat, 9 Jan 2021 04:06:01 +0300 Subject: [PATCH 12/13] Added cpu temperature and battery --- .github/workflows/rust.yml | 20 -- CODE_OF_CONDUCT.md | 76 ++++++++ CONTRIBUTING.md | 1 + Cargo.lock | 371 ++++++++++++++++++++++++++++++++++++- Cargo.toml | 10 +- README.md | 8 +- rsblocks.yml | 15 +- screenshots/1.png | Bin 6878 -> 0 bytes screenshots/2.png | Bin 0 -> 7810 bytes src/lib.rs | 276 ++++++++++++++++++++------- src/main.rs | 3 +- 11 files changed, 689 insertions(+), 91 deletions(-) delete mode 100644 .github/workflows/rust.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md delete mode 100644 screenshots/1.png create mode 100644 screenshots/2.png diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 75959c5..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Rust - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..c2ade3b --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at mustafasalih1991@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..445e9bc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ +All Contributions are welcome. diff --git a/Cargo.lock b/Cargo.lock index 64b6a19..a6681e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,11 +1,165 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "ahash" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" + +[[package]] +name = "alsa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb213f6b3e4b1480a60931ca2035794aa67b73103d254715b1db7b70dcb3c934" +dependencies = [ + "alsa-sys", + "bitflags", + "libc", + "nix 0.15.0", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "async-channel" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59740d83946db6a5af71ae25ddf9562c2b176b2ca42cf99a455f09f4a220d6b9" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-io" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9315f8f07556761c3e48fec2e6b276004acf426e6dc068b2c2251854d65ee0fd" +dependencies = [ + "concurrent-queue", + "fastrand", + "futures-lite", + "libc", + "log", + "nb-connect", + "once_cell", + "parking", + "polling", + "vec-arena", + "waker-fn", + "winapi", +] + +[[package]] +name = "async-net" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06de475c85affe184648202401d7622afb32f0f74e02192857d0201a16defbe5" +dependencies = [ + "async-io", + "blocking", + "fastrand", + "futures-lite", +] + +[[package]] +name = "async-task" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" + +[[package]] +name = "atomic-waker" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" + [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "blocking" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9" +dependencies = [ + "async-channel", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "once_cell", +] + +[[package]] +name = "breadx" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bff92e2ec549fe3f20386d73efb30263be7467463def0c2a780d7cee5dbf5e3" +dependencies = [ + "async-io", + "async-net", + "blocking", + "bytemuck", + "cfg-if 1.0.0", + "cty", + "futures-lite", + "hashbrown", + "log", + "memchr", + "nix 0.19.1", + "ref_slice", + "tinyvec", +] + +[[package]] +name = "bytemuck" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" + +[[package]] +name = "cache-padded" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" + +[[package]] +name = "cc" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "chrono" version = "0.4.19" @@ -19,6 +173,81 @@ dependencies = [ "winapi", ] +[[package]] +name = "concurrent-queue" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +dependencies = [ + "cache-padded", +] + +[[package]] +name = "cty" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3" + +[[package]] +name = "event-listener" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" + +[[package]] +name = "fastrand" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5faf057445ce5c9d4329e382b2ce7ca38550ef3b73a5348362d5f24e0c7fe3" +dependencies = [ + "instant", +] + +[[package]] +name = "futures-core" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" + +[[package]] +name = "futures-io" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" + +[[package]] +name = "futures-lite" +version = "1.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4481d0cd0de1d204a4fa55e7d45f07b1d958abcb06714b3446438e2eff695fb" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +dependencies = [ + "ahash", +] + +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "libc" version = "0.2.81" @@ -31,12 +260,62 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +[[package]] +name = "log" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +dependencies = [ + "cfg-if 0.1.10", +] + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + [[package]] name = "minreq" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2466d0a7e6bfcd54f69e4a17d4a4318985aaaf7fe3df4cd3b6f11ff551129ca3" +[[package]] +name = "nb-connect" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8123a81538e457d44b933a02faf885d3fe8408806b23fa700e8f01c6c3a98998" +dependencies = [ + "libc", + "winapi", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" +dependencies = [ + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", +] + [[package]] name = "num-integer" version = "0.1.44" @@ -57,11 +336,57 @@ dependencies = [ ] [[package]] -name = "rsblocks" -version = "0.1.3" +name = "once_cell" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "pin-project-lite" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "polling" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a7bc6b2a29e632e45451c941832803a18cce6781db04de8a04696cdca8bde4" dependencies = [ + "cfg-if 0.1.10", + "libc", + "log", + "wepoll-sys", + "winapi", +] + +[[package]] +name = "ref_slice" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e1b7878800220a76a08f32c057829511440f65528b63b940f2f2bc145d7ac68" + +[[package]] +name = "rsblocks" +version = "0.1.5" +dependencies = [ + "alsa", + "breadx", "chrono", "minreq", + "nix 0.19.1", "yaml-rust", ] @@ -76,12 +401,54 @@ dependencies = [ "winapi", ] +[[package]] +name = "tinyvec" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "vec-arena" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +[[package]] +name = "wepoll-sys" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff" +dependencies = [ + "cc", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 36889bd..ef392be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsblocks" -version = "0.1.3" +version = "0.1.5" authors = ["mustafa salih "] edition = "2018" readme = "README.md" @@ -13,4 +13,10 @@ description = "a multi threaded status bar for dwm window manager for linux" [dependencies] chrono = "0.4" yaml-rust = "0.4" -minreq = "2.2.1" \ No newline at end of file +minreq = "2.2.1" +alsa = "0.4.3" +nix = "0.19.1" + +[dependencies.breadx] +version = "0.1.11" +features = ["async"] diff --git a/README.md b/README.md index 3b33e2f..217937d 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # rsblocks [github](https://github.com/MustafaSalih1993/rsblocks) [crates](https://crates.io/crates/rsblocks) -[build](https://github.com/MustafaSalih1993/rsblocks/actions?query=workflow%3ARust) + A multi threaded fast status bar for dwm window manager written in **Rust** 🦀

- +


## Features @@ -14,7 +14,9 @@ A multi threaded fast status bar for dwm window manager written in **Rust** 🦀 * Memory Usage * Disk Usage * Weather Temperature -* Sound volume _reads from `alsa-utils`_ +* Sound Volume +* Battery Percentage +* Cpu Temperature * Easy to configure with `rsblocks.yml` file diff --git a/rsblocks.yml b/rsblocks.yml index 76e83f6..6d0786c 100644 --- a/rsblocks.yml +++ b/rsblocks.yml @@ -27,9 +27,10 @@ disk: # reads from alsa, alsa-utils package should # be installed on the system to make it work. volume: - enable: false + enable: true icon: '' delay: 0.18 + card: 'PULSE' # weather format options is available on @@ -45,3 +46,15 @@ weather: format: '%l:+%t' delay: 7200.0 # 7200 seconds = 2 hours + +battery: + source: 'BAT0' + icon: '' + enable: false + delay: 120.0 + + +cpu_temperature: + icon: '' + enable: true + delay: 120.0 diff --git a/screenshots/1.png b/screenshots/1.png deleted file mode 100644 index 495c216cfa2ba8e9079fea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Y#%G9uBo0O^4 z`nsxPN4}Hs6u!H6fUkdOb7OthgJcY|LXQ~;=7z|Oz9F*5>+a&BnZ}R;5{V@2dl4P! zkp7BHCJO{S0DwTi+rQ_Nf2))NJ^+ABez`mY_m=)G^zRRzp;GC;{k)^}Y2J{;BogG~ zyTHiU9RK3E2(eiF>{(4hTnwDIzOh*U>8?MH{|~n6*98Irzvb&A@qeGs&&zzfwEwnG zW9xa?ae30~dC-$3ZZg27wCB6@03k1BIf1iJQ z`LC>CzTO$Eq(q&&;KPm%_L~qe-Zxx0cl531zox20j^ACq59aoU<8A%_GnA?HXZ2O3 zPxGYD#=U#M{x Ye{nk07*qoM6N<$f}PApxBvhE diff --git a/screenshots/2.png b/screenshots/2.png new file mode 100644 index 0000000000000000000000000000000000000000..958332e22677c5f7277b9c32e13bbab7a5bf5fe8 GIT binary patch literal 7810 zcmV-|9)017P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1Y;vNWj;{Ld+T1SFw_;{bvP-@wOrQeE$T%Z%-r z2zN!-LQx=PrV`5j*FR7B2YzJArKyK?vx;Bqt@FT5)X%R!XR7TvKfksrzpcNt7n1iQ zM$^52pM89;G|;X;KKPo0=CAD~-ZvcYK=eKE^OHOCz0aS6L_2@lsl5aB{kgFo{&T4F z9caBBpHSX^`wr_(7tiIF1_w&1m`IqnAnWHGp9tjsNd~T;b4R}_f_o7vxTw%O7y$Vt zy{~JnKLhj&$X|Emcl5u}{0)2_Zx8tmOM5ZG&7Zy?{jFWT=jWd%mhXu8w-@=4`fEDx z|D23-_9wg142asRs0ZvXgl@+P$mRLWa5(;odw-6OBkHINlxJOa;#ky)!OAJrC~454 z{ahCFtKK8W^UKyhKn~> zH+K*3K0=~}hJ{B&kI}gcJW#uJ@6mf7gUi4~17i*JA8468Wwxo)rq7stjs^LwwshI@ z6|1k2oRYAKwDgSZIX0CIr`T=lw(UE1-{U}QM@~C>?D&b(&-iBTW%Uoo-(Zbi*7#xS z_VaJn&|2KThM;RFdN~7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>4-wY>GbK|*&|r-F2)y!R92v0PZ>V&tVR4u^g3?$y-)XHoA7 zLH>bJElmws8TS-0fP5o|!VIXA7#O1Svvd~I8QM%kQ>LM5|KC8^@Z*9G4jWa4{?lKc z?&nVJ4Gx>T`iETznWU%0<>zH6&#?r;%S~ZIA%EMZucUQ^LID7PKzOrA4*D4X)z0P} zr^#gMAHV&(>{z6k zv6$6A{2KSyxu^M=A6M^xyaPBg`b$G2xz1U4H}~*?O&>)^Fc{i_A+rZW=e5N@bAP0xf@91EE z2o~<2g9~T(e;SH#IPA9$tp8@zR+p;qZQW0v89o+#l>bkTM5aD(s4jb!FT0QS(?jL^ z{$<#S0g-qd?(+FV!dF{H)xED);bYX|6XT6a^>0Qi*UKMex>5}_)KEhWHI%`B0o8>8 UM=SSs4*&oF07*qoM6N<$g8ghc$N&HU literal 0 HcmV?d00001 diff --git a/src/lib.rs b/src/lib.rs index edb30f7..60a4c37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,10 @@ +use alsa::mixer::{Mixer, SelemChannelId, SelemId}; +use breadx::{display::*, window::Window}; use chrono::prelude::*; use minreq; -use std::env; use std::fs::File; use std::io::Error; use std::io::Read; -use std::process::Command; use std::sync::mpsc; use std::thread; use std::time::Duration; @@ -17,6 +17,8 @@ pub enum ThreadsData { Memory(String), Time(String), Weather(String), + Battery(String), + CpuTemp(String), } #[derive(Clone)] @@ -27,6 +29,8 @@ pub struct Config { pub disk: Disk, pub volume: Volume, pub weather: Weather, + pub battery: Battery, + pub cpu_temperature: CpuTemp, } #[derive(Clone)] @@ -54,6 +58,7 @@ pub struct Volume { pub icon: String, pub enabled: bool, pub delay: f64, + pub card: String, } #[derive(Clone)] @@ -65,17 +70,44 @@ pub struct Weather { pub delay: f64, } -/* -// TODO: error handling required if rsblocks.yml file is empty +#[derive(Clone)] +pub struct Battery { + pub source: String, + pub icon: String, + pub enabled: bool, + pub delay: f64, +} -this function is responsible to check if the rsblocks.yml file +#[derive(Clone)] +pub struct CpuTemp { + pub icon: String, + pub enabled: bool, + pub delay: f64, +} + +/* TODOS + + TODO 1: Error handling required if rsblocks.yml file is empty. + + TODO 2: This lib file growing and soon it will be annoying to move + arround, need fix soon. + + TODO 3: Need a better comments in code, or no one will understand what happens. + + TODO 4: Need a documentation. + + TODO 5: Fix repeated code for threads in `run` function. + +*/ + +/*this function is responsible to check if the rsblocks.yml file exists to call parse_config to read it OTHERWISE it will call load_defaults to load a hardcoded default configuration it will always return a valid configuration inside a Result. */ pub fn load_config() -> Result { - let yml_source = env::var("HOME").unwrap() + "/.config/rsblocks/rsblocks.yml"; + let yml_source = std::env::var("HOME").unwrap() + "/.config/rsblocks/rsblocks.yml"; let mut data = String::new(); let mut file = match File::open(&yml_source) { Ok(file) => file, @@ -115,6 +147,7 @@ fn load_defaults() -> Config { icon: String::from(""), enabled: false, delay: 0.17, + card: String::from("ALSA"), }, weather: Weather { city: String::from(""), @@ -123,6 +156,17 @@ fn load_defaults() -> Config { enabled: false, delay: 7200.0, //7200 seconds = 2 hours }, + battery: Battery { + source: String::from("BAT0"), + icon: String::from(""), + enabled: false, + delay: 120.0, + }, + cpu_temperature: CpuTemp { + icon: String::from(""), + enabled: false, + delay: 120.0, + }, } } @@ -139,6 +183,8 @@ fn parse_config(doc: &yaml::Yaml) -> Config { let disk_icon = get_or_set_string(doc, "disk", "icon", ""); let volume_icon = get_or_set_string(doc, "volume", "icon", ""); let weather_icon = get_or_set_string(doc, "weather", "icon", ""); + let battery_icon = get_or_set_string(doc, "battery", "icon", ""); + let cpu_temperature_icon = get_or_set_string(doc, "cpu_temperature", "icon", ""); //parsing formats and city weather let time_format = get_or_set_string(doc, "time", "format", "%T"); @@ -150,13 +196,23 @@ fn parse_config(doc: &yaml::Yaml) -> Config { let memory_enabled = get_or_set_bool(doc, "memory", "enable"); let volume_enabled = get_or_set_bool(doc, "volume", "enable"); let weather_enabled = get_or_set_bool(doc, "weather", "enable"); + let battery_enabled = get_or_set_bool(doc, "battery", "enable"); + let cpu_temperature_enabled = get_or_set_bool(doc, "cpu_temperature", "enable"); // parsing update_delay state (should be all seconds in f64 type) - let time_delay = get_or_set_f32(doc, "time", "delay", 1.0); - let disk_delay = get_or_set_f32(doc, "disk", "delay", 120.0); - let memory_delay = get_or_set_f32(doc, "memory", "delay", 2.0); - let volume_delay = get_or_set_f32(doc, "volume", "delay", 0.17); - let weather_delay = get_or_set_f32(doc, "weather", "delay", 7200.0); + let time_delay = get_or_set_f64(doc, "time", "delay", 1.0); + let disk_delay = get_or_set_f64(doc, "disk", "delay", 120.0); + let memory_delay = get_or_set_f64(doc, "memory", "delay", 2.0); + let volume_delay = get_or_set_f64(doc, "volume", "delay", 0.17); + let weather_delay = get_or_set_f64(doc, "weather", "delay", 7200.0); + let battery_delay = get_or_set_f64(doc, "battery", "delay", 120.0); + let cpu_temperature_delay = get_or_set_f64(doc, "cpu_temperature", "delay", 120.0); + + // parsing card for volume, ALSA or PULSE + let volume_card = get_or_set_string(doc, "volume", "card", "ALSA"); + + // parsing battery source name + let battery_source = get_or_set_string(doc, "battery", "source", "BAT0"); Config { seperator, @@ -179,6 +235,7 @@ fn parse_config(doc: &yaml::Yaml) -> Config { icon: volume_icon, enabled: volume_enabled, delay: volume_delay, + card: volume_card, }, weather: Weather { city: weather_city, @@ -187,11 +244,22 @@ fn parse_config(doc: &yaml::Yaml) -> Config { enabled: weather_enabled, delay: weather_delay, }, + battery: Battery { + source: battery_source, + icon: battery_icon, + enabled: battery_enabled, + delay: battery_delay, + }, + cpu_temperature: CpuTemp { + icon: cpu_temperature_icon, + enabled: cpu_temperature_enabled, + delay: cpu_temperature_delay, + }, } } // getting a f32 value from rsblocks.yml file or set default (last argument) -fn get_or_set_f32(doc: &yaml::Yaml, parent: &str, child: &str, default: f64) -> f64 { +fn get_or_set_f64(doc: &yaml::Yaml, parent: &str, child: &str, default: f64) -> f64 { let val: f64 = if doc[parent][child].is_badvalue() { default } else { @@ -227,20 +295,30 @@ fn get_or_set_string(doc: &yaml::Yaml, parent: &str, child: &str, default_val: & */ -/* Running the program: -TODO: this is sucks, repeated code in threads below, fix me you fucking asshole - */ +// Running the program: -pub fn run(config: Config) { +pub struct Blocks { + disp: Display, + root: Window, +} + +impl Blocks { + pub fn new() -> Self { + let disp = Display::create(None, None).expect("Failed to create x11 connection"); + let root = disp.default_screen().root; + Self { disp, root } + } +} + +pub fn run(config: Config, mut blocks: Blocks) { let (tx, rx) = mpsc::channel(); - // volume thread if config.volume.enabled { let volume_tx = tx.clone(); let configcp = config.clone(); let mut vol_data = ThreadsData::Sound(get_volume(&configcp)); thread::spawn(move || loop { - let _ = volume_tx.send(vol_data); + volume_tx.send(vol_data).unwrap(); vol_data = ThreadsData::Sound(get_volume(&configcp)); thread::sleep(Duration::from_secs_f64(configcp.volume.delay)) }); @@ -284,6 +362,32 @@ pub fn run(config: Config) { }); } + // Battery thread + if config.battery.enabled { + let battery_tx = tx.clone(); + let configcp = config.clone(); + let battery_data = get_battery(&configcp).unwrap(); + let mut battery_data = ThreadsData::Battery(battery_data); + thread::spawn(move || loop { + battery_tx.send(battery_data).unwrap(); + battery_data = ThreadsData::Battery(get_battery(&configcp).unwrap()); + thread::sleep(Duration::from_secs_f64(configcp.battery.delay)) + }); + } + + // Cpu temperature thread + if config.cpu_temperature.enabled { + let cpu_temp_tx = tx.clone(); + let configcp = config.clone(); + let cpu_temp_data = get_cpu_temp(&configcp).unwrap(); + let mut cpu_temp_data = ThreadsData::CpuTemp(cpu_temp_data); + thread::spawn(move || loop { + cpu_temp_tx.send(cpu_temp_data).unwrap(); + cpu_temp_data = ThreadsData::CpuTemp(get_cpu_temp(&configcp).unwrap()); + thread::sleep(Duration::from_secs_f64(configcp.cpu_temperature.delay)) + }); + } + // Time thread { let time_tx = tx; @@ -299,8 +403,7 @@ pub fn run(config: Config) { //Main { // NOTE: order matters to the final format - - let mut bar: Vec = vec!["".to_string(); 5]; + let mut bar: Vec = vec!["".to_string(); 7]; //iterating the values recieved from the threads for data in rx { match data { @@ -308,29 +411,28 @@ pub fn run(config: Config) { ThreadsData::Weather(x) => bar[1] = x, ThreadsData::Disk(x) => bar[2] = x, ThreadsData::Memory(x) => bar[3] = x, - ThreadsData::Time(x) => bar[4] = x, + ThreadsData::CpuTemp(x) => bar[4] = x, + ThreadsData::Battery(x) => bar[5] = x, + ThreadsData::Time(x) => bar[6] = x, } // match ends here - update(&bar); + update(&bar, &mut blocks); } } } -/* -this will call the command 'xsetroot -name ' -*/ -pub fn update(bar: &Vec) { +pub fn update(bar: &Vec, blocks: &mut Blocks) { // TODO: FIX ME, this solution sucks let mut x = String::new(); for i in bar.iter() { x.push_str(i.as_str()); } - Command::new("xsetroot") - .arg("-name") - .arg(x) - .output() - .unwrap(); + + blocks + .root + .set_title(&mut blocks.disp, &x) + .expect("Failed to set title of root"); } /*############################ RUNNING THE PROGRAM ENDS HERE ###########################################*/ @@ -378,48 +480,49 @@ fn get_weather(config: &Config) -> String { format!(" {} {} {}", config.weather.icon, res, config.seperator) } +// getting disk usage pub fn get_disk(config: &Config) -> String { - let cmd = Command::new("sh") - .arg("-c") - .args(&["df -h"]) - .output() - .unwrap(); - let output = String::from_utf8_lossy(&cmd.stdout); + const GB: u64 = (1024 * 1024) * 1024; + let statvfs = nix::sys::statvfs::statvfs("/").unwrap(); let mut disk_used = String::new(); - for line in output.lines() { - if line.ends_with('/') { - let splited = line.split_whitespace().collect::>(); - disk_used = splited[2].to_string(); - break; - } - } + + let total = (statvfs.blocks() * statvfs.fragment_size()) / GB; + let available = (statvfs.blocks_free() * statvfs.fragment_size()) / GB; + let used = total - available; + + disk_used.push_str(&format!("{}G", used)); format!( " {} {} {}", config.disk.icon, disk_used, config.seperator ) } -// FIX ME: what a horrible solution to get the sound, i dont like it -// find another way - pub fn get_volume(config: &Config) -> String { - let cmd_content = Command::new("amixer") - .args(&["-D", "pulse", "get", "Master"]) - .output() - .expect("Make sure that you have alsa-utils installed on your system"); + let card = if config.volume.card == "PULSE" { + "pulse" + } else { + "default" + }; - let vol: String = String::from_utf8_lossy(&cmd_content.stdout) - .lines() - .last() - .expect("failed to get sound volume") - .split('[') - .collect::>()[1] - .split(']') - .collect::>()[0] - .trim() - .to_string(); + let mixer = Mixer::new(card, false).expect("Failed to open mixer"); + let selem_id = SelemId::new("Master", 0); + let selem = mixer.find_selem(&selem_id).expect("Couldn't find selem"); + let selem_chan_id = SelemChannelId::FrontLeft; - format!(" {} {} {}", config.volume.icon, vol, config.seperator) + let (min, max) = selem.get_playback_volume_range(); + let mut raw_volume = selem + .get_playback_volume(selem_chan_id) + .expect("Failed to get raw_volume"); + + let range = max - min; + let vol = if range == 0 { + 0 + } else { + raw_volume -= min; + ((raw_volume as f64 / range as f64) * 100.) as u64 + }; + + format!(" {} {}% {}", config.volume.icon, vol, config.seperator) } /* @@ -503,3 +606,52 @@ fn assign_val(line: &str, assignable: &mut u32) { .unwrap(); *assignable = parsed; } + +// getting battery percentage +pub fn get_battery(config: &Config) -> Result { + let battery_full_cap_file = format!( + "/sys/class/power_supply/{}/charge_full_design", + config.battery.source + ); + let battery_charge_now_file = format!( + "/sys/class/power_supply/{}/charge_now", + config.battery.source + ); + + let mut buf = String::new(); + + // FIXME: ugly error handling AGAIN fixing later, im lazy + match File::open(&battery_full_cap_file) { + Ok(mut file) => file.read_to_string(&mut buf)?, + Err(_) => return Ok(String::from("check your battery source name")), + }; + let full_design = buf.trim().parse::().unwrap(); + buf.clear(); + + // NOTE: no need to error check if passed the above match + File::open(&battery_charge_now_file)?.read_to_string(&mut buf)?; + + let charge_now = buf.trim().parse::().unwrap(); + + let battery_percentage = (charge_now as f32 / full_design as f32) * 100.0; + let result = format!( + " {} {:.0}% {}", + config.battery.icon, battery_percentage, config.seperator + ); + Ok(result) +} + +// getting cpu temperature +pub fn get_cpu_temp(config: &Config) -> Result { + let mut buf = String::new(); + File::open("/sys/class/thermal/thermal_zone0/temp")?.read_to_string(&mut buf)?; + let value = buf.trim().parse::().unwrap(); + + let result = format!( + " {} {}° {}", + config.cpu_temperature.icon, + value / 1000.0, + config.seperator + ); + Ok(result) +} diff --git a/src/main.rs b/src/main.rs index 2211cb9..c3a542d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,5 +2,6 @@ use rsblocks; fn main() { let config = rsblocks::load_config().unwrap(); - rsblocks::run(config); + let blocks = rsblocks::Blocks::new(); + rsblocks::run(config, blocks); } From da1fc34a6ce07f666753916e6954b0875dfbb346 Mon Sep 17 00:00:00 2001 From: Mustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com> Date: Sat, 9 Jan 2021 04:08:16 +0300 Subject: [PATCH 13/13] Revert "Added cpu temperature and battery"