BatteryInfo now uses first battery detected by acpi
This commit is contained in:
parent
40ece5ab95
commit
1aa926d5f0
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue