updated with custom configuration

This commit is contained in:
2026-03-13 17:07:05 +01:00
parent e19fb69c72
commit 4cf61b6197
11 changed files with 363 additions and 127 deletions
+8 -2
View File
@@ -8,7 +8,7 @@ use sysinfo::Disks;
pub struct BtrfsModule;
impl WaybarModule for BtrfsModule {
fn run(&self, _config: &Config, _state: &SharedState, _args: &[&str]) -> Result<WaybarOutput> {
fn run(&self, config: &Config, _state: &SharedState, _args: &[&str]) -> Result<WaybarOutput> {
let disks = Disks::new_with_refreshed_list();
let mut total_used: f64 = 0.0;
let mut total_size: f64 = 0.0;
@@ -43,8 +43,14 @@ impl WaybarModule for BtrfsModule {
"normal"
};
let text = config.pool.format
.replace("{used:>4.0}", &format!("{:>4.0}", used_gb))
.replace("{total:>4.0}", &format!("{:>4.0}", size_gb))
.replace("{used}", &format!("{:.0}", used_gb))
.replace("{total}", &format!("{:.0}", size_gb));
Ok(WaybarOutput {
text: format!("{:.0}G / {:.0}G", used_gb, size_gb),
text,
tooltip: Some(format!("BTRFS Usage: {:.1}%", percentage)),
class: Some(class.to_string()),
percentage: Some(percentage as u8),