mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-07-27 07:34:25 +02:00
fixed battery_percentage (#442)
This commit is contained in:
parent
e813301aa8
commit
ff72e1e0f3
@ -259,11 +259,11 @@ def battery_percentage():
|
||||
"""
|
||||
get batery percentage
|
||||
"""
|
||||
sensors_battery = psutil.sensors_battery()
|
||||
if sensors_battery:
|
||||
return round(sensors_battery.percent)
|
||||
else:
|
||||
return None
|
||||
try:
|
||||
percentage = psutil.sensors_battery().percent
|
||||
except:
|
||||
percentage = None
|
||||
return percentage
|
||||
|
||||
|
||||
def get_avail_gov():
|
||||
|
Loading…
x
Reference in New Issue
Block a user