From 64ab76a6b70caea7a3d764b0ef613d17f9f0fe35 Mon Sep 17 00:00:00 2001 From: Conor Heine Date: Thu, 26 Sep 2013 01:49:37 -0400 Subject: [PATCH] fixed brace style to match project's --- widgets/contrib/tpbat/init.lua | 12 ++++++++---- widgets/contrib/tpbat/smapi.lua | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/widgets/contrib/tpbat/init.lua b/widgets/contrib/tpbat/init.lua index d46697a..1bb6a9b 100644 --- a/widgets/contrib/tpbat/init.lua +++ b/widgets/contrib/tpbat/init.lua @@ -30,7 +30,8 @@ local tpbat = { } local tpbat_notification = nil function tpbat:hide() - if tpbat_notification ~= nil then + if tpbat_notification ~= nil + then naughty.destroy(tpbat_notification) tpbat_notification = nil end @@ -49,8 +50,10 @@ function tpbat:show(t_out) local time = bat:remaining_time() local msg = "\t" - if status ~= "idle" and status ~= "nil" then - if time == "N/A" then + if status ~= "idle" and status ~= "nil" + then + if time == "N/A" + then msg = "...Calculating time remaining..." else msg = time .. (status == "charging" and " until charged" or " remaining") @@ -80,7 +83,8 @@ function tpbat.register(args) tpbat.widget = wibox.widget.textbox('') - if bat:get('state') == nil then + if bat:get('state') == nil + then local n = naughty.notify({ title = "SMAPI Battery Warning: Unable to read battery state!", text = "This widget is intended for ThinkPads. Is tp_smapi installed? Check your configs & paths.", diff --git a/widgets/contrib/tpbat/smapi.lua b/widgets/contrib/tpbat/smapi.lua index 3291cc2..59b916b 100644 --- a/widgets/contrib/tpbat/smapi.lua +++ b/widgets/contrib/tpbat/smapi.lua @@ -80,8 +80,9 @@ function smapi:battery(name) local time_val = bat_now.status == 'discharging' and 'remaining_running_time' or 'remaining_charging_time' local mins_left = self:get(time_val) - if mins_left:find("^%d+") == nil then - return "N/A" + if mins_left:find("^%d+") == nil + then + return "N/A" end local hrs = mins_left / 60 -- 2.39.2