Fix device detection, tree indentation, and hide Single storage type

- Replace findmnt with lsblk for efficient device name detection
- Fix tree indentation to align consistently with status icon text
- Hide '(Single)' label for single disk storage pools
- Device detection returns actual names (nvme0n1, sda) not UUID paths
This commit is contained in:
2025-10-23 19:06:52 +02:00
parent 9f34c67bfa
commit ad298ac70c
2 changed files with 21 additions and 14 deletions

View File

@@ -254,9 +254,14 @@ impl SystemWidget {
_ => "—% —GB/—GB".to_string(),
};
let pool_label = if pool.pool_type.to_lowercase() == "single" {
format!("{}:", pool.mount_point)
} else {
format!("{} ({}):", pool.mount_point, pool.pool_type)
};
let pool_spans = StatusIcons::create_status_spans(
pool.status.clone(),
&format!("{} ({}):", pool.mount_point, pool.pool_type)
&pool_label
);
lines.push(Line::from(pool_spans));
@@ -280,7 +285,7 @@ impl SystemWidget {
};
let mut drive_spans = vec![
Span::raw(" "),
Span::raw(" "),
Span::raw(tree_symbol),
Span::raw(" "),
];
@@ -292,7 +297,7 @@ impl SystemWidget {
if pool.usage_percent.is_some() {
let tree_symbol = "└─";
let mut usage_spans = vec![
Span::raw(" "),
Span::raw(" "),
Span::raw(tree_symbol),
Span::raw(" "),
];
@@ -429,7 +434,7 @@ impl Widget for SystemWidget {
let freq_text = self.format_cpu_frequency();
lines.push(Line::from(vec![
Span::raw("└─ "),
Span::raw(" └─ "),
Span::styled(format!("Freq: {}", freq_text), Typography::secondary())
]));
@@ -443,7 +448,7 @@ impl Widget for SystemWidget {
let tmp_text = self.format_tmp_usage();
let mut tmp_spans = vec![
Span::raw(" └─ "),
Span::raw(" └─ "),
];
tmp_spans.extend(StatusIcons::create_status_spans(
self.memory_status.clone(),