Skip to content

Commit

Permalink
Don't show the boost option on the GUI if the laptop doesn't support it
Browse files Browse the repository at this point in the history
  • Loading branch information
JosuGZ committed Oct 27, 2024
1 parent df9027d commit f440da0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions razer_control_gui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,15 @@ pub struct SupportedDevice {
pub features: Vec<String>,
pub fan: Vec<u16>,
}

impl SupportedDevice {

pub fn has_feature(&self, feature: &str) -> bool {
self.features.iter().any(|f| f == feature)
}

pub fn can_boost(&self) -> bool {
self.has_feature("boost")
}

}
2 changes: 1 addition & 1 deletion razer_control_gui/src/razer-settings/razer-settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ fn make_page(ac: bool, device: SupportedDevice) -> SettingsPage {
cpu_boost.append_text("Low");
cpu_boost.append_text("Medium");
cpu_boost.append_text("High");
cpu_boost.append_text("Boost");
if device.can_boost() { cpu_boost.append_text("Boost") };
cpu_boost.set_active(Some(power.1 as u32));
cpu_boost.set_width_request(100);
let row = SettingsRow::new(&label, &cpu_boost);
Expand Down

0 comments on commit f440da0

Please sign in to comment.