Battery widget: don't show usb device battery

This commit is contained in:
Alice Gaudon 2020-10-02 18:49:20 +02:00
parent a29cf9e2b6
commit a609640435

View File

@ -150,7 +150,7 @@ function getBatteryCapacity()
local charge = 0 local charge = 0
local capacity = 0 local capacity = 0
for b in getBatteries() do for b in getBatteries() do
if readCommand("cat /sys/class/power_supply/" .. b .. "/type"):match("Battery") then if b:sub(1,3) ~= 'hid' and readCommand("cat /sys/class/power_supply/" .. b .. "/type"):match("Battery") then
charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now") charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now")
capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_full") capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_full")
end end