aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--README.md4
-rw-r--r--src/utils/weather.rs14
3 files changed, 13 insertions, 7 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 47f1a36..9dfde9a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsblocks"
-version = "0.1.19"
+version = "0.1.20"
authors = ["mustafa salih <mustafasalih1991@gmail.com>"]
edition = "2018"
readme = "README.md"
diff --git a/README.md b/README.md
index 125d58c..e8d8389 100644
--- a/README.md
+++ b/README.md
@@ -3,13 +3,13 @@
[<img alt="crates" src="https://img.shields.io/crates/v/rsblocks?logo=rust&logoColor=a9b1d6&style=flat-square&color=fc8d62" height="20">](https://crates.io/crates/rsblocks)
-A multi threaded fast status bar for dwm window manager written in **Rust** 🦀
+A status bar for dwm window manager written in **Rust** 🦀
<p>
<img align="center" src="./screenshots/2.png"/>
</p><br/>
## Features
-* Multi Threads
+* Async
* Battery Percentage
* Bitcoin Price
* Brightness
diff --git a/src/utils/weather.rs b/src/utils/weather.rs
index 10c887c..b284807 100644
--- a/src/utils/weather.rs
+++ b/src/utils/weather.rs
@@ -12,10 +12,16 @@ pub async fn get_weather() -> ThreadsData {
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,
- },
+ Ok(resp) => {
+ if resp.status_code != 200 {
+ String::from("service error")
+ } else {
+ match resp.as_str() {
+ Ok(res_str) => res_str.trim_matches('"').to_string(),
+ Err(_) => err_string,
+ }
+ }
+ }
Err(_) => err_string,
};