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
|
local previous_percent = 0
|
||||||
|
|
||||||
function batteryInfo()
|
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')
|
local percentage = fd:read('*all')
|
||||||
fd:close()
|
fd:close()
|
||||||
return tonumber(percentage)
|
return tonumber(percentage)
|
||||||
end
|
end
|
||||||
|
|
||||||
function isCharging()
|
function isCharging()
|
||||||
local _,_,error = os.execute('acpi | grep Discharging')
|
local _,_,error = os.execute('acpi | head -n 1 | grep Discharging')
|
||||||
return error ~= 0
|
return error ~= 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue