diff --git a/src/bar_modules/bar_module_cpu.rs b/src/bar_modules/bar_module_cpu.rs index 3677251..19e703a 100644 --- a/src/bar_modules/bar_module_cpu.rs +++ b/src/bar_modules/bar_module_cpu.rs @@ -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::().unwrap(); - // let mut cpu_total :f32 = 0.0; - // for usg in parts { - // cpu_total += usg.parse::().unwrap(); - // } - // return format!("{}%", (((cpu_total - cpu_idle)/cpu_total) * 100.0).ceil() as i32); } // -------------------- diff --git a/src/bar_modules/bar_module_weather.rs b/src/bar_modules/bar_module_weather.rs index 6402e55..a24d8e7 100644 --- a/src/bar_modules/bar_module_weather.rs +++ b/src/bar_modules/bar_module_weather.rs @@ -188,7 +188,7 @@ impl bar_modules::BarModuleActions for UnibarModuleWeather { let temperature_unit :String = self.get_temperature_unit(); // let temperature_icon :String = self.get_icon(v.clone()); - return format!("{:.2}{}", temperature_value, temperature_unit); + return format!("{:.0}{}", temperature_value, temperature_unit); } // -------------------- @@ -198,7 +198,6 @@ impl bar_modules::BarModuleActions for UnibarModuleWeather { let json_val = self.weather_info["features"][0]["properties"]["icon"].to_string(); let caps = re.captures(&json_val).unwrap(); - // println!("{}", caps.get(1).unwrap().as_str()); return self.get_unicode_symbol(caps.get(1).unwrap().as_str()); } } diff --git a/src/common/mod.rs b/src/common/mod.rs index 8998065..2177f5f 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -27,5 +27,5 @@ pub struct AppOptions { pub weather_station: String, pub music_progress: bool, pub debug: bool, - pub debug_icons: bool, + pub debug_modules: bool, } diff --git a/src/main.rs b/src/main.rs index 257ff4a..40332d0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,13 +26,14 @@ struct CommandlineArgs { #[arg(short = 'p', long)] music_progress: bool, - /// Show JSON data returned by query + /// Show verbose debug information during run #[arg(short = 'D', long)] debug: bool, - /// Show ICON debug information - #[arg(short = 'I', long)] - debug_icons: bool, + /// Show module debug information after all modules are evaluated + /// but before output is printed + #[arg(short = 'M', long)] + debug_modules: bool, } // @@ -80,7 +81,7 @@ impl Unibar { } // Show module debug information if enabled - if self.opts.debug_icons { + if self.opts.debug_modules { let bar_modules_debugged: Vec> = vec! [ Box::new(bar_modules::bar_module_weather::UnibarModuleWeather::new(self.opts.clone())), Box::new(bar_modules::bar_module_music::UnibarModuleMusic::new(self.opts.clone())), @@ -125,7 +126,7 @@ fn main() { weather_station: cmd_args.weather_station, music_progress: cmd_args.music_progress, debug: cmd_args.debug, - debug_icons: cmd_args.debug_icons + debug_modules: cmd_args.debug_modules }, };