mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
feat: persist fan curve when toggling fan control, avoid applying fan settings when there is no fan
This commit is contained in:
@@ -315,16 +315,17 @@ impl App {
|
||||
.context("Failed to set power profile")?;
|
||||
}
|
||||
|
||||
let thermals_settings = self.root_stack.thermals_page.get_thermals_settings();
|
||||
debug!("applying thermal settings: {thermals_settings:?}");
|
||||
if let Some(thermals_settings) = self.root_stack.thermals_page.get_thermals_settings() {
|
||||
debug!("applying thermal settings: {thermals_settings:?}");
|
||||
|
||||
self.daemon_client
|
||||
.set_fan_control(
|
||||
&gpu_id,
|
||||
thermals_settings.manual_fan_control,
|
||||
thermals_settings.curve,
|
||||
)
|
||||
.context("Could not set fan control")?;
|
||||
self.daemon_client
|
||||
.set_fan_control(
|
||||
&gpu_id,
|
||||
thermals_settings.manual_fan_control,
|
||||
thermals_settings.curve,
|
||||
)
|
||||
.context("Could not set fan control")?;
|
||||
}
|
||||
|
||||
self.set_initial(&gpu_id);
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ fn show_list_window(title: &str, items: &[FeatureModel]) {
|
||||
.build();
|
||||
|
||||
let base_model = gio::ListStore::new(FeatureModel::static_type());
|
||||
base_model.extend_from_slice(&items);
|
||||
base_model.extend_from_slice(items);
|
||||
|
||||
let expression = PropertyExpression::new(FeatureModel::static_type(), Expression::NONE, "name");
|
||||
let filter = StringFilter::builder()
|
||||
|
||||
@@ -181,17 +181,18 @@ impl ThermalsPage {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn get_thermals_settings(&self) -> ThermalsSettings {
|
||||
let manual_fan_control = !self.fan_control_enabled_switch.state();
|
||||
let curve = if manual_fan_control {
|
||||
Some(self.fan_curve_frame.get_curve())
|
||||
pub fn get_thermals_settings(&self) -> Option<ThermalsSettings> {
|
||||
if self.fan_control_enabled_switch.is_sensitive() {
|
||||
let manual_fan_control = !self.fan_control_enabled_switch.state();
|
||||
let curve = self.fan_curve_frame.get_curve();
|
||||
let curve = if curve.is_empty() { None } else { Some(curve) };
|
||||
|
||||
Some(ThermalsSettings {
|
||||
manual_fan_control,
|
||||
curve,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
ThermalsSettings {
|
||||
manual_fan_control,
|
||||
curve,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user