fix a bug caused by args swap

This commit is contained in:
erpalma
2018-09-20 09:48:01 +02:00
parent 5c96274e52
commit 301a57aa0f
2 changed files with 2 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
# Enable or disable the script execution # Enable or disable the script execution
Enabled: True Enabled: True
# SYSFS path for checking if the system is running on AC power # SYSFS path for checking if the system is running on AC power
Sysfs_Power_Path = "/sys/class/power_supply/AC*/online" Sysfs_Power_Path: /sys/class/power_supply/AC*/online
## Settings to apply while connected to Battery power ## Settings to apply while connected to Battery power
[BATTERY] [BATTERY]

View File

@@ -153,7 +153,7 @@ def get_value_for_bits(val, from_bit=0, to_bit=63):
def is_on_battery(config): def is_on_battery(config):
try: try:
for path in glob.glob(config.get('Sysfs_Power_Path', 'GENERAL', fallback=DEFAULT_SYSFS_POWER_PATH)): for path in glob.glob(config.get('GENERAL', 'Sysfs_Power_Path', fallback=DEFAULT_SYSFS_POWER_PATH)):
with open(path) as f: with open(path) as f:
return not bool(int(f.read())) return not bool(int(f.read()))
except: except: