mirror of https://github.com/lcpz/lain.git
fixed brace style to match project's
This commit is contained in:
parent
3192a938cb
commit
68037080cd
|
@ -30,7 +30,8 @@ local tpbat = { }
|
||||||
local tpbat_notification = nil
|
local tpbat_notification = nil
|
||||||
|
|
||||||
function tpbat:hide()
|
function tpbat:hide()
|
||||||
if tpbat_notification ~= nil then
|
if tpbat_notification ~= nil
|
||||||
|
then
|
||||||
naughty.destroy(tpbat_notification)
|
naughty.destroy(tpbat_notification)
|
||||||
tpbat_notification = nil
|
tpbat_notification = nil
|
||||||
end
|
end
|
||||||
|
@ -49,8 +50,10 @@ function tpbat:show(t_out)
|
||||||
local time = bat:remaining_time()
|
local time = bat:remaining_time()
|
||||||
local msg = "\t"
|
local msg = "\t"
|
||||||
|
|
||||||
if status ~= "idle" and status ~= "nil" then
|
if status ~= "idle" and status ~= "nil"
|
||||||
if time == "N/A" then
|
then
|
||||||
|
if time == "N/A"
|
||||||
|
then
|
||||||
msg = "...Calculating time remaining..."
|
msg = "...Calculating time remaining..."
|
||||||
else
|
else
|
||||||
msg = time .. (status == "charging" and " until charged" or " remaining")
|
msg = time .. (status == "charging" and " until charged" or " remaining")
|
||||||
|
@ -80,7 +83,8 @@ function tpbat.register(args)
|
||||||
|
|
||||||
tpbat.widget = wibox.widget.textbox('')
|
tpbat.widget = wibox.widget.textbox('')
|
||||||
|
|
||||||
if bat:get('state') == nil then
|
if bat:get('state') == nil
|
||||||
|
then
|
||||||
local n = naughty.notify({
|
local n = naughty.notify({
|
||||||
title = "SMAPI Battery Warning: Unable to read battery state!",
|
title = "SMAPI Battery Warning: Unable to read battery state!",
|
||||||
text = "This widget is intended for ThinkPads. Is tp_smapi installed? Check your configs & paths.",
|
text = "This widget is intended for ThinkPads. Is tp_smapi installed? Check your configs & paths.",
|
||||||
|
|
|
@ -80,8 +80,9 @@ function smapi:battery(name)
|
||||||
local time_val = bat_now.status == 'discharging' and 'remaining_running_time' or 'remaining_charging_time'
|
local time_val = bat_now.status == 'discharging' and 'remaining_running_time' or 'remaining_charging_time'
|
||||||
local mins_left = self:get(time_val)
|
local mins_left = self:get(time_val)
|
||||||
|
|
||||||
if mins_left:find("^%d+") == nil then
|
if mins_left:find("^%d+") == nil
|
||||||
return "N/A"
|
then
|
||||||
|
return "N/A"
|
||||||
end
|
end
|
||||||
|
|
||||||
local hrs = mins_left / 60
|
local hrs = mins_left / 60
|
||||||
|
|
Loading…
Reference in New Issue