diff --git a/lact-gui/src/app.rs b/lact-gui/src/app.rs index 8937f76a..92eceb7d 100644 --- a/lact-gui/src/app.rs +++ b/lact-gui/src/app.rs @@ -469,6 +469,7 @@ impl AsyncComponent for AppModel { .expect("Failed to get application from root window"); setup_actions! { (actions, ProcessMonitorAction, APP_BROKER.send(AppMsg::ShowProcessMonitor)), + (actions, HistoricalGraphsAction, APP_BROKER.send(AppMsg::ShowGraphsWindow)), (actions, GenerateDebugSnapshotAction, APP_BROKER.send(AppMsg::DebugSnapshot)), (actions, PreferencesAction, APP_BROKER.send(AppMsg::ShowPreferencesDialog)), (actions, AboutAction, APP_BROKER.send(AppMsg::ShowAboutDialog)), @@ -486,6 +487,8 @@ impl AsyncComponent for AppModel { gio_action }; application.set_accelerators_for_action::(&["comma"]); + application.set_accelerators_for_action::(&["g"]); + application.set_accelerators_for_action::(&["p"]); application.set_accelerators_for_action::(&["q"]); root.insert_action_group(AppActionGroup::NAME, Some(&actions.into_action_group())); @@ -1458,6 +1461,7 @@ async fn create_connection() -> anyhow::Result<(DaemonClient, Option() / data.len() as f64; let stat_suffix = stat_type.metric(); + let precision = stat_type.precision(); - let mut stat_label = - format!("{}: {current_value:.1}{stat_suffix}", stat_type.display(),); + let mut stat_label = format!( + "{}: {current_value:.*}{stat_suffix}", + stat_type.display(), + precision + ); if self.print_extra_info { if stat_type.show_peak() { - write!(stat_label, ", Peak {max_value:.1}{stat_suffix}").unwrap(); + write!(stat_label, ", Peak {max_value:.*}{stat_suffix}", precision).unwrap(); } - write!(stat_label, ", Avg {avg_value:.1}{stat_suffix}").unwrap(); + write!(stat_label, ", Avg {avg_value:.*}{stat_suffix}", precision).unwrap(); } // Evaluate fixed number of points per spline segment diff --git a/lact-gui/src/app/graphs_window/stat.rs b/lact-gui/src/app/graphs_window/stat.rs index 07ac2901..3c92239f 100644 --- a/lact-gui/src/app/graphs_window/stat.rs +++ b/lact-gui/src/app/graphs_window/stat.rs @@ -283,6 +283,21 @@ impl StatType { } } + /// How many digits should be formatted + pub fn precision(&self) -> usize { + use StatType::*; + match self { + GpuClock | GpuTargetClock | VramClock | Clockspeed(_) => 0, + FanPwm => 1, + FanRpm => 0, + PowerCurrent | PowerAverage | Power(_) => 1, + PowerCap => 0, + Temperature(_) => 1, + GpuUsage | VramSize | VramUsed | GttSize | GttUsed => 0, + GpuVoltage | Voltage(_) => 0, + } + } + pub fn show_peak(&self) -> bool { use StatType::*; !matches!(self, VramSize | PowerCap)