Skip to content

Commit 7815995

Browse files
PurpleWazardshadeyg56
authored andcommitted
enable_tresholds config file improvements (Closes: AdnanHodzic#641)
1 parent 18aeecb commit 7815995

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

auto_cpufreq/battery_scripts/battery.py

+18-12
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ def battery_stop_threshold():
3535
def battery_setup():
3636
root_check()
3737
conf = get_config()
38-
if conf.has_option("battery", "enable_thresholds") and conf["battery"]["enable_thresholds"] == "true":
39-
if lsmod("thinkpad_acpi"):
40-
thinkpad_setup(battery_start_threshold(), battery_stop_threshold())
41-
elif lsmod("ideapad_acpi"):
42-
ideapad_setup(battery_start_threshold(), battery_stop_threshold())
38+
if conf.has_option("battery", "enable_thresholds"):
39+
if conf["battery"]["enable_thresholds"] == "true":
40+
if lsmod("thinkpad_acpi"):
41+
thinkpad_setup(battery_start_threshold(), battery_stop_threshold())
42+
elif lsmod("ideapad_acpi"):
43+
ideapad_setup(battery_start_threshold(), battery_stop_threshold())
44+
else:
45+
pass
4346
else:
4447
pass
4548
else:
@@ -48,13 +51,16 @@ def battery_setup():
4851

4952
def battery_get_thresholds():
5053
conf = get_config()
51-
if conf["battery"]["enable_thresholds"] == "true":
52-
print("-" * 30)
53-
if lsmod("thinkpad_acpi"):
54-
thinkpad_print_thresholds()
55-
elif lsmod("ideapad_acpi"):
56-
ideapad_print_thresholds()
54+
if conf.has_option("battery", "enable_thresholds"):
55+
if conf["battery"]["enable_thresholds"] == "true":
56+
print("-" * 30 )
57+
if lsmod("thinkpad_acpi"):
58+
thinkpad_print_thresholds()
59+
elif lsmod("ideapad_acpi"):
60+
ideapad_print_thresholds()
61+
else:
62+
pass
5763
else:
58-
pass
64+
return
5965
else:
6066
return

0 commit comments

Comments
 (0)