diff --git a/.vscode/settings.json b/.vscode/settings.json index 2c88c1a2..a04896e8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,6 +18,7 @@ "GIGA", "Hamberg", "KIBI", + "LUKS", "Lukas", "MEBI", "MEBIBYTE", diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1ca437..3176e72b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#417](https://github.com/ClementTsang/bottom/pull/417): Fixes the sort menu and sort shortcuts not syncing up. +- [#423](https://github.com/ClementTsang/bottom/pull/423): Fixes disk encryption causing the disk widget to fail or not properly map I/O statistics. + ## [0.5.7] - 2021-01-30 ## Bug Fixes diff --git a/src/app/data_harvester/disks.rs b/src/app/data_harvester/disks.rs index 5a67a909..246f5b5d 100644 --- a/src/app/data_harvester/disks.rs +++ b/src/app/data_harvester/disks.rs @@ -4,9 +4,9 @@ use crate::app::Filter; pub struct DiskHarvest { pub name: String, pub mount_point: String, - pub free_space: u64, - pub used_space: u64, - pub total_space: u64, + pub free_space: Option, + pub used_space: Option, + pub total_space: Option, } #[derive(Clone, Debug)] @@ -35,7 +35,6 @@ pub async fn get_io_usage(actually_get: bool) -> crate::utils::error::Result(), - used_space: usage.used().get::(), - total_space: usage.total().get::(), - mount_point, - name, - }); + // The usage line fails in some cases (Void linux + LUKS, see https://github.com/ClementTsang/bottom/issues/419) + if let Ok(usage) = heim::disk::usage(partition.mount_point().to_path_buf()).await { + vec_disks.push(DiskHarvest { + free_space: Some(usage.free().get::()), + used_space: Some(usage.used().get::()), + total_space: Some(usage.total().get::()), + mount_point, + name, + }); + } else { + vec_disks.push(DiskHarvest { + free_space: None, + used_space: None, + total_space: None, + mount_point, + name, + }); + } } } } diff --git a/src/data_conversion.rs b/src/data_conversion.rs index 57698b7f..b3614cf1 100644 --- a/src/data_conversion.rs +++ b/src/data_conversion.rs @@ -116,20 +116,36 @@ pub fn convert_disk_row(current_data: &data_farmer::DataCollection) -> Vec