mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-05 12:54:37 +02:00
force SWAP and RAM labels to show even if at 0
This commit is contained in:
parent
137e3cea5f
commit
ce563542ee
@ -35,6 +35,8 @@ is equivalent to:
|
|||||||
(btm AND cpu > 0) AND (discord AND mem > 0)
|
(btm AND cpu > 0) AND (discord AND mem > 0)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- [#151](https://github.com/ClementTsang/bottom/issues/151) - Fixed an issue where if the drive I/O label didn't match any disk, the entire disk widget would display nothing.
|
||||||
|
|
||||||
## [0.4.1] - 2020-05-05
|
## [0.4.1] - 2020-05-05
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
@ -225,37 +225,37 @@ pub fn convert_swap_data_points(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn convert_mem_labels(current_data: &data_farmer::DataCollection) -> (String, String) {
|
pub fn convert_mem_labels(current_data: &data_farmer::DataCollection) -> (String, String) {
|
||||||
let mem_label = if current_data.memory_harvest.mem_total_in_mb == 0 {
|
let mem_label = "RAM:".to_string()
|
||||||
"".to_string()
|
|
||||||
} else {
|
|
||||||
"RAM:".to_string()
|
|
||||||
+ &format!(
|
+ &format!(
|
||||||
"{:3.0}%",
|
"{:3.0}%",
|
||||||
(current_data.memory_harvest.mem_used_in_mb as f64 * 100.0
|
if current_data.memory_harvest.mem_total_in_mb == 0 {
|
||||||
/ current_data.memory_harvest.mem_total_in_mb as f64)
|
0.0
|
||||||
|
} else {
|
||||||
|
current_data.memory_harvest.mem_used_in_mb as f64 * 100.0
|
||||||
|
/ current_data.memory_harvest.mem_total_in_mb as f64
|
||||||
|
}
|
||||||
)
|
)
|
||||||
+ &format!(
|
+ &format!(
|
||||||
" {:.1}GB/{:.1}GB",
|
" {:.1}GB/{:.1}GB",
|
||||||
current_data.memory_harvest.mem_used_in_mb as f64 / 1024.0,
|
current_data.memory_harvest.mem_used_in_mb as f64 / 1024.0,
|
||||||
(current_data.memory_harvest.mem_total_in_mb as f64 / 1024.0)
|
(current_data.memory_harvest.mem_total_in_mb as f64 / 1024.0)
|
||||||
)
|
);
|
||||||
};
|
|
||||||
|
|
||||||
let swap_label = if current_data.swap_harvest.mem_total_in_mb == 0 {
|
let swap_label = "SWP:".to_string()
|
||||||
"".to_string()
|
|
||||||
} else {
|
|
||||||
"SWP:".to_string()
|
|
||||||
+ &format!(
|
+ &format!(
|
||||||
"{:3.0}%",
|
"{:3.0}%",
|
||||||
(current_data.swap_harvest.mem_used_in_mb as f64 * 100.0
|
if current_data.swap_harvest.mem_total_in_mb == 0 {
|
||||||
/ current_data.swap_harvest.mem_total_in_mb as f64)
|
0.0
|
||||||
|
} else {
|
||||||
|
current_data.swap_harvest.mem_used_in_mb as f64 * 100.0
|
||||||
|
/ current_data.swap_harvest.mem_total_in_mb as f64
|
||||||
|
}
|
||||||
)
|
)
|
||||||
+ &format!(
|
+ &format!(
|
||||||
" {:.1}GB/{:.1}GB",
|
" {:.1}GB/{:.1}GB",
|
||||||
current_data.swap_harvest.mem_used_in_mb as f64 / 1024.0,
|
current_data.swap_harvest.mem_used_in_mb as f64 / 1024.0,
|
||||||
(current_data.swap_harvest.mem_total_in_mb as f64 / 1024.0)
|
(current_data.swap_harvest.mem_total_in_mb as f64 / 1024.0)
|
||||||
)
|
);
|
||||||
};
|
|
||||||
|
|
||||||
(mem_label, swap_label)
|
(mem_label, swap_label)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user