General clean up

* Option changed: --debug-icons -> --debug-modules
This commit is contained in:
2025-06-06 18:10:43 -07:00
parent 750a2813d3
commit 17ce090ef8
4 changed files with 12 additions and 31 deletions

View File

@@ -121,9 +121,9 @@ impl bar_modules::BarModuleActions for UnibarModuleCpu {
// --------------------
fn generate_data(&mut self) {
self.cpu_times_sample_1 = self.read_cpu_times().expect("REASON");
thread::sleep(Duration::from_millis(1000));
self.cpu_times_sample_2 = self.read_cpu_times().expect("REASON");
self.cpu_times_sample_1 = self.read_cpu_times().expect("Trouble getting CPU times sample 1");
thread::sleep(Duration::from_millis(500));
self.cpu_times_sample_2 = self.read_cpu_times().expect("Trouble getting CPU times sample 2");
if self.opts.debug {
println!("-----> CPU times sample 1 - {:#?}", self.cpu_times_sample_1);
@@ -148,25 +148,6 @@ impl bar_modules::BarModuleActions for UnibarModuleCpu {
} else {
return format!("CPU?");
}
// let re = Regex::new(r"cpu\s+.*").unwrap();
// let caps = re.captures(self.procstat_str.as_str()).unwrap();
// let cpu_line = caps.get(0).unwrap().as_str();
// if self.opts.debug {
// println!("-----> CPU line - {:#?}", cpu_line);
// }
// let binding = Regex::new(r"\s+").unwrap();
// let mut parts :Vec<&str> = binding.split(cpu_line).collect();
// parts.remove(0); // Remove the 'cpu' part
// let cpu_idle :f32 = parts[3].parse::<f32>().unwrap();
// let mut cpu_total :f32 = 0.0;
// for usg in parts {
// cpu_total += usg.parse::<f32>().unwrap();
// }
// return format!("{}%", (((cpu_total - cpu_idle)/cpu_total) * 100.0).ceil() as i32);
}
// --------------------