summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Porte <microjoe@microjoe.org>2019-01-21 22:30:28 +0100
committerRomain Porte <microjoe@microjoe.org>2019-01-21 22:30:28 +0100
commit45d401968b35c6aaa89fa326c7088dcbcee52b82 (patch)
tree88929c07bd58a7c4d3dea3565d22b28405739ba9
parent8dafdb64e39368ccf52652db4f309fbebbb4cc66 (diff)
downloadsuperbar-45d401968b35c6aaa89fa326c7088dcbcee52b82.tar.gz
superbar-45d401968b35c6aaa89fa326c7088dcbcee52b82.zip
item_brightness: disable degraded on failed update
-rw-r--r--src/item_brightness.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/item_brightness.rs b/src/item_brightness.rs
index 6e29d80..c4fde66 100644
--- a/src/item_brightness.rs
+++ b/src/item_brightness.rs
@@ -84,10 +84,14 @@ impl BarItem for Brightness {
/// Update the updates count if necessary
fn item_update(&mut self) {
+ // Use previous state if the detection has failed (happens quite often)
+ // so that the bar does not blink with "degraded" status when we miss
+ // one process check
self.idle_running = is_swayidle_running().unwrap_or_else(|e| {
- eprintln!("could not check idle process run state: {}", e);
- false
+ warn!("could not check idle process run state: {}", e);
+ self.idle_running
});
+
self.value = get_brightness().expect("could not get brightness value");
}
}