@@ -44,15 +44,33 @@ auto waybar::modules::Disk::update() -> void {
44
44
return ;
45
45
}
46
46
47
- label_.set_markup (fmt::format (format_,
48
- stats.f_bavail * 100 / stats.f_blocks ,
49
- fmt::arg (" free" , pow_format (stats.f_bavail * stats.f_bsize , " B" , true )),
50
- fmt::arg (" percentage_free" , stats.f_bavail * 100 / stats.f_blocks ),
51
- fmt::arg (" used" , pow_format ((stats.f_blocks - stats.f_bavail ) * stats.f_bsize , " B" , true )),
52
- fmt::arg (" percentage_used" , (stats.f_blocks - stats.f_bavail ) * 100 / stats.f_blocks )
53
- ));
47
+ auto free = pow_format (stats.f_bavail * stats.f_bsize , " B" , true );
48
+ auto used = pow_format ((stats.f_blocks - stats.f_bavail ) * stats.f_bsize , " B" , true );
49
+ auto total = pow_format (stats.f_blocks * stats.f_bsize , " B" , true );
50
+
51
+ label_.set_markup (fmt::format (format_
52
+ , stats.f_bavail * 100 / stats.f_blocks
53
+ , fmt::arg (" free" , free)
54
+ , fmt::arg (" percentage_free" , stats.f_bavail * 100 / stats.f_blocks )
55
+ , fmt::arg (" used" , used)
56
+ , fmt::arg (" percentage_used" , (stats.f_blocks - stats.f_bavail ) * 100 / stats.f_blocks )
57
+ , fmt::arg (" total" , total)
58
+ , fmt::arg (" path" , path_)
59
+ ));
54
60
if (tooltipEnabled ()) {
55
- label_.set_tooltip_text (fmt::format (" {} used" , pow_format (stats.f_bavail * stats.f_bsize , " B" , true )));
61
+ std::string tooltip_format = " {used} out of {total} used on ({percentage_used}%)" ;
62
+ if (config_[" tooltip-format" ].isString ()) {
63
+ tooltip_format = config_[" tooltip-format" ].asString ();
64
+ }
65
+ label_.set_tooltip_text (fmt::format (tooltip_format
66
+ , stats.f_bavail * 100 / stats.f_blocks
67
+ , fmt::arg (" free" , free)
68
+ , fmt::arg (" percentage_free" , stats.f_bavail * 100 / stats.f_blocks )
69
+ , fmt::arg (" used" , used)
70
+ , fmt::arg (" percentage_used" , (stats.f_blocks - stats.f_bavail ) * 100 / stats.f_blocks )
71
+ , fmt::arg (" total" , total)
72
+ , fmt::arg (" path" , path_)
73
+ ));
56
74
}
57
75
event_box_.show ();
58
76
}
0 commit comments