mirror of
https://github.com/ilya-zlobintsev/LACT.git
synced 2025-02-25 18:55:26 -06:00
Apply fan control settings
This commit is contained in:
parent
c7852fed4d
commit
024bbc915e
@ -100,6 +100,19 @@ impl App {
|
||||
|
||||
self.apply_revealer.connect_apply_button_clicked(move || {
|
||||
let gpu_id = current_gpu_id.load(Ordering::SeqCst);
|
||||
|
||||
let thermals_settings = app.root_stack.thermals_page.get_thermals_settings();
|
||||
|
||||
if thermals_settings.automatic_fan_control_enabled {
|
||||
app.daemon_connection
|
||||
.stop_fan_control(gpu_id)
|
||||
.expect("Failed to top fan control");
|
||||
} else {
|
||||
app.daemon_connection
|
||||
.start_fan_control(gpu_id)
|
||||
.expect("Failed to start fan control");
|
||||
}
|
||||
|
||||
app.set_info(gpu_id);
|
||||
});
|
||||
}
|
||||
@ -119,7 +132,6 @@ impl App {
|
||||
self.root_stack
|
||||
.thermals_page
|
||||
.set_ventilation_info(ventilation_info);
|
||||
|
||||
}
|
||||
|
||||
fn start_stats_update_loop(&self, current_gpu_id: Arc<AtomicU32>) {
|
||||
|
@ -17,9 +17,9 @@ impl Header {
|
||||
|
||||
container.set_custom_title(Some(&Grid::new())); // Bad workaround to hide the title
|
||||
|
||||
if env::var("XDG_CURRENT_DESKTOP") == Ok("GNOME".to_string()) {
|
||||
// if env::var("XDG_CURRENT_DESKTOP") == Ok("GNOME".to_string()) {
|
||||
container.set_show_close_button(true);
|
||||
}
|
||||
// }
|
||||
|
||||
let gpu_selector = ComboBoxText::new();
|
||||
container.pack_start(&gpu_selector);
|
||||
|
@ -1,11 +1,15 @@
|
||||
mod fan_curve_frame;
|
||||
|
||||
use daemon::gpu_controller::{FanControlInfo, GpuStats};
|
||||
use gtk::*;
|
||||
use gtk::prelude::*;
|
||||
use gtk::*;
|
||||
|
||||
use fan_curve_frame::FanCurveFrame;
|
||||
|
||||
pub struct ThermalsSettings {
|
||||
pub automatic_fan_control_enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ThermalsPage {
|
||||
pub container: Box,
|
||||
@ -77,21 +81,18 @@ impl ThermalsPage {
|
||||
1,
|
||||
);
|
||||
|
||||
|
||||
let fan_control_enabled_switch = Switch::new();
|
||||
|
||||
fan_control_enabled_switch.set_active(true);
|
||||
fan_control_enabled_switch.set_halign(Align::Start);
|
||||
|
||||
grid.attach(&fan_control_enabled_switch, 2, 2, 1, 1);
|
||||
|
||||
|
||||
|
||||
container.pack_start(&grid, false, false, 5);
|
||||
|
||||
let fan_curve_frame = FanCurveFrame::new();
|
||||
|
||||
container.pack_start(&fan_curve_frame.container, true, true, 5);
|
||||
|
||||
container.pack_start(&fan_curve_frame.container, true, true, 5);
|
||||
|
||||
Self {
|
||||
container,
|
||||
@ -113,7 +114,8 @@ impl ThermalsPage {
|
||||
}
|
||||
|
||||
pub fn set_ventilation_info(&self, fan_control_info: FanControlInfo) {
|
||||
self.fan_control_enabled_switch.set_active(!fan_control_info.enabled);
|
||||
self.fan_control_enabled_switch
|
||||
.set_active(!fan_control_info.enabled);
|
||||
|
||||
if fan_control_info.enabled {
|
||||
self.fan_curve_frame.container.set_visible(true);
|
||||
@ -123,8 +125,17 @@ impl ThermalsPage {
|
||||
}
|
||||
|
||||
pub fn connect_settings_changed<F: Fn() + 'static>(&self, f: F) {
|
||||
self.fan_control_enabled_switch.connect_changed_active(move |_| {
|
||||
f();
|
||||
});
|
||||
self.fan_control_enabled_switch
|
||||
.connect_changed_active(move |_| {
|
||||
f();
|
||||
});
|
||||
}
|
||||
|
||||
pub fn get_thermals_settings(&self) -> ThermalsSettings {
|
||||
let automatic_fan_control_enabled = self.fan_control_enabled_switch.get_active();
|
||||
|
||||
ThermalsSettings {
|
||||
automatic_fan_control_enabled,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user