mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Feat: add screen_auto_brightness
This commit is contained in:
@@ -40,6 +40,7 @@ pub fn setup_system_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
|||||||
ui.global::<SystemPageData>().set_platform_profile(-1);
|
ui.global::<SystemPageData>().set_platform_profile(-1);
|
||||||
ui.global::<SystemPageData>().set_panel_overdrive(-1);
|
ui.global::<SystemPageData>().set_panel_overdrive(-1);
|
||||||
ui.global::<SystemPageData>().set_boot_sound(-1);
|
ui.global::<SystemPageData>().set_boot_sound(-1);
|
||||||
|
ui.global::<SystemPageData>().set_screen_auto_brightness(-1);
|
||||||
ui.global::<SystemPageData>().set_mini_led_mode(-1);
|
ui.global::<SystemPageData>().set_mini_led_mode(-1);
|
||||||
ui.global::<SystemPageData>().set_screenpad_brightness(-1);
|
ui.global::<SystemPageData>().set_screenpad_brightness(-1);
|
||||||
ui.global::<SystemPageData>().set_ppt_pl1_spl(MINMAX);
|
ui.global::<SystemPageData>().set_ppt_pl1_spl(MINMAX);
|
||||||
@@ -666,6 +667,11 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
|||||||
setup_callback!(boot_sound, handle, attr, i32);
|
setup_callback!(boot_sound, handle, attr, i32);
|
||||||
setup_external!(boot_sound, i32, handle, attr, value)
|
setup_external!(boot_sound, i32, handle, attr, value)
|
||||||
}
|
}
|
||||||
|
FirmwareAttribute::ScreenAutoBrightness => {
|
||||||
|
init_property!(screen_auto_brightness, handle, value, i32);
|
||||||
|
setup_callback!(screen_auto_brightness, handle, attr, i32);
|
||||||
|
setup_external!(screen_auto_brightness, i32, handle, attr, value)
|
||||||
|
}
|
||||||
FirmwareAttribute::McuPowersave => {}
|
FirmwareAttribute::McuPowersave => {}
|
||||||
FirmwareAttribute::PanelOverdrive => {
|
FirmwareAttribute::PanelOverdrive => {
|
||||||
init_property!(panel_overdrive, handle, value, i32);
|
init_property!(panel_overdrive, handle, value, i32);
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ export global SystemPageData {
|
|||||||
callback cb_panel_overdrive(int);
|
callback cb_panel_overdrive(int);
|
||||||
in-out property <int> boot_sound;
|
in-out property <int> boot_sound;
|
||||||
callback cb_boot_sound(int);
|
callback cb_boot_sound(int);
|
||||||
|
in-out property <int> screen_auto_brightness;
|
||||||
|
callback cb_screen_auto_brightness(int);
|
||||||
in-out property <int> mini_led_mode;
|
in-out property <int> mini_led_mode;
|
||||||
callback cb_mini_led_mode(int);
|
callback cb_mini_led_mode(int);
|
||||||
|
|
||||||
@@ -300,6 +302,14 @@ export component PageSystem inherits Rectangle {
|
|||||||
SystemPageData.cb_boot_sound(SystemPageData.boot_sound)
|
SystemPageData.cb_boot_sound(SystemPageData.boot_sound)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if SystemPageData.screen_auto_brightness != -1: SystemToggleInt {
|
||||||
|
text: @tr("Screen Auto Brightness");
|
||||||
|
checked_int <=> SystemPageData.screen_auto_brightness;
|
||||||
|
toggled => {
|
||||||
|
SystemPageData.cb_screen_auto_brightness(SystemPageData.screen_auto_brightness)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SystemPageData.ppt_pl1_spl.max > 0 && SystemPageData.ppt_pl1_spl.current != -1) || (SystemPageData.ppt_pl2_sppt.max > 0 && SystemPageData.ppt_pl2_sppt.current != -1) || (SystemPageData.ppt_pl3_fppt.max > 0 && SystemPageData.ppt_pl3_fppt.current != -1) || (SystemPageData.ppt_fppt.max > 0 && SystemPageData.ppt_fppt.current != -1) || (SystemPageData.ppt_apu_sppt.max > 0 && SystemPageData.ppt_apu_sppt.current != -1) || (SystemPageData.nv_temp_target.max > 0 && SystemPageData.nv_temp_target.current != -1) || (SystemPageData.nv_dynamic_boost.max > 0 && SystemPageData.nv_dynamic_boost.current != -1): HorizontalLayout {
|
if (SystemPageData.ppt_pl1_spl.max > 0 && SystemPageData.ppt_pl1_spl.current != -1) || (SystemPageData.ppt_pl2_sppt.max > 0 && SystemPageData.ppt_pl2_sppt.current != -1) || (SystemPageData.ppt_pl3_fppt.max > 0 && SystemPageData.ppt_pl3_fppt.current != -1) || (SystemPageData.ppt_fppt.max > 0 && SystemPageData.ppt_fppt.current != -1) || (SystemPageData.ppt_apu_sppt.max > 0 && SystemPageData.ppt_apu_sppt.current != -1) || (SystemPageData.nv_temp_target.max > 0 && SystemPageData.nv_temp_target.current != -1) || (SystemPageData.nv_dynamic_boost.max > 0 && SystemPageData.nv_dynamic_boost.current != -1): HorizontalLayout {
|
||||||
|
|||||||
@@ -272,10 +272,29 @@ macro_rules! define_attribute_getters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
define_attribute_getters!(
|
define_attribute_getters!(
|
||||||
apu_mem, cores_performance, cores_efficiency, ppt_pl1_spl, ppt_pl2_sppt, ppt_apu_sppt,
|
apu_mem,
|
||||||
ppt_platform_sppt, ppt_fppt, nv_dynamic_boost, nv_temp_target, dgpu_base_tgp, dgpu_tgp,
|
cores_performance,
|
||||||
charge_mode, boot_sound, mcu_powersave, panel_od, panel_hd_mode, egpu_connected, egpu_enable,
|
cores_efficiency,
|
||||||
dgpu_disable, gpu_mux_mode, mini_led_mode
|
ppt_pl1_spl,
|
||||||
|
ppt_pl2_sppt,
|
||||||
|
ppt_apu_sppt,
|
||||||
|
ppt_platform_sppt,
|
||||||
|
ppt_fppt,
|
||||||
|
nv_dynamic_boost,
|
||||||
|
nv_temp_target,
|
||||||
|
dgpu_base_tgp,
|
||||||
|
dgpu_tgp,
|
||||||
|
charge_mode,
|
||||||
|
boot_sound,
|
||||||
|
mcu_powersave,
|
||||||
|
panel_od,
|
||||||
|
panel_hd_mode,
|
||||||
|
egpu_connected,
|
||||||
|
egpu_enable,
|
||||||
|
dgpu_disable,
|
||||||
|
gpu_mux_mode,
|
||||||
|
mini_led_mode,
|
||||||
|
screen_auto_brightness
|
||||||
);
|
);
|
||||||
|
|
||||||
/// CamelCase names of the properties. Intended for use with DBUS
|
/// CamelCase names of the properties. Intended for use with DBUS
|
||||||
@@ -322,6 +341,7 @@ pub enum FirmwareAttribute {
|
|||||||
PendingReboot = 23,
|
PendingReboot = 23,
|
||||||
PptEnabled = 24,
|
PptEnabled = 24,
|
||||||
None = 25,
|
None = 25,
|
||||||
|
ScreenAutoBrightness = 26,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FirmwareAttribute {
|
impl FirmwareAttribute {
|
||||||
@@ -375,6 +395,7 @@ impl From<&str> for FirmwareAttribute {
|
|||||||
"gpu_mux_mode" => Self::GpuMuxMode,
|
"gpu_mux_mode" => Self::GpuMuxMode,
|
||||||
"mini_led_mode" => Self::MiniLedMode,
|
"mini_led_mode" => Self::MiniLedMode,
|
||||||
"pending_reboot" => Self::PendingReboot,
|
"pending_reboot" => Self::PendingReboot,
|
||||||
|
"screen_auto_brightness" => Self::ScreenAutoBrightness,
|
||||||
_ => {
|
_ => {
|
||||||
error!("Invalid firmware attribute: {}", s);
|
error!("Invalid firmware attribute: {}", s);
|
||||||
Self::None
|
Self::None
|
||||||
@@ -411,6 +432,7 @@ impl From<FirmwareAttribute> for &str {
|
|||||||
FirmwareAttribute::GpuMuxMode => "gpu_mux_mode",
|
FirmwareAttribute::GpuMuxMode => "gpu_mux_mode",
|
||||||
FirmwareAttribute::MiniLedMode => "mini_led_mode",
|
FirmwareAttribute::MiniLedMode => "mini_led_mode",
|
||||||
FirmwareAttribute::PendingReboot => "pending_reboot",
|
FirmwareAttribute::PendingReboot => "pending_reboot",
|
||||||
|
FirmwareAttribute::ScreenAutoBrightness => "screen_auto_brightness",
|
||||||
FirmwareAttribute::None => "none",
|
FirmwareAttribute::None => "none",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user