From 1aa926d5f03dbe2817685bad7b5b826ee9da9175 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Fri, 20 Jan 2017 09:50:08 +0100 Subject: [PATCH] BatteryInfo now uses first battery detected by acpi --- awesome/battery.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awesome/battery.lua b/awesome/battery.lua index 65fc72f..d90e824 100644 --- a/awesome/battery.lua +++ b/awesome/battery.lua @@ -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