From 005b4aa178525265ce335504c0d1c0e49a7afdb7 Mon Sep 17 00:00:00 2001 From: PurpleWazard <155469001+PurpleWazard@users.noreply.github.com> Date: Sat, 10 Feb 2024 11:02:25 -0600 Subject: [PATCH] enable_tresholds config file improvements (Closes: #641) --- auto_cpufreq/battery_scripts/battery.py | 30 +++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/auto_cpufreq/battery_scripts/battery.py b/auto_cpufreq/battery_scripts/battery.py index 871863d..3692094 100644 --- a/auto_cpufreq/battery_scripts/battery.py +++ b/auto_cpufreq/battery_scripts/battery.py @@ -35,11 +35,14 @@ def battery_stop_threshold(): def battery_setup(): root_check() conf = get_config() - if conf.has_option("battery", "enable_thresholds") and conf["battery"]["enable_thresholds"] == "true": - if lsmod("thinkpad_acpi"): - thinkpad_setup(battery_start_threshold(), battery_stop_threshold()) - elif lsmod("ideapad_acpi"): - ideapad_setup(battery_start_threshold(), battery_stop_threshold()) + if conf.has_option("battery", "enable_thresholds"): + if conf["battery"]["enable_thresholds"] == "true": + if lsmod("thinkpad_acpi"): + thinkpad_setup(battery_start_threshold(), battery_stop_threshold()) + elif lsmod("ideapad_acpi"): + ideapad_setup(battery_start_threshold(), battery_stop_threshold()) + else: + pass else: pass else: @@ -48,13 +51,16 @@ def battery_setup(): def battery_get_thresholds(): conf = get_config() - if conf["battery"]["enable_thresholds"] == "true": - print("-" * 30) - if lsmod("thinkpad_acpi"): - thinkpad_print_thresholds() - elif lsmod("ideapad_acpi"): - ideapad_print_thresholds() + if conf.has_option("battery", "enable_thresholds"): + if conf["battery"]["enable_thresholds"] == "true": + print("-" * 30 ) + if lsmod("thinkpad_acpi"): + thinkpad_print_thresholds() + elif lsmod("ideapad_acpi"): + ideapad_print_thresholds() + else: + pass else: - pass + return else: return