BatteryInfo now uses first battery detected by acpi

This commit is contained in:
Thomas FORGIONE 2017-01-20 09:50:08 +01:00
parent 40ece5ab95
commit 1aa926d5f0
No known key found for this signature in database
GPG Key ID: 2A210FFC062E00C3
1 changed files with 2 additions and 2 deletions

View File

@ -9,14 +9,14 @@ local beautiful = require("beautiful")
local previous_percent = 0
function batteryInfo()
local fd = io.popen('acpi | tail -n 1 | cut -d ":" -f 2 | cut -d "," -f 2 | tr -d "%"')
local fd = io.popen('acpi | head -n 1 | cut -d ":" -f 2 | cut -d "," -f 2 | tr -d "%"')
local percentage = fd:read('*all')
fd:close()
return tonumber(percentage)
end
function isCharging()
local _,_,error = os.execute('acpi | grep Discharging')
local _,_,error = os.execute('acpi | head -n 1 | grep Discharging')
return error ~= 0
end