X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/5321eb485ad559ffa72f6cc804c9dff657a40f0d..d3b5b5a94d974e678d10a8670886e17a354eede5:/widget/contrib/tp_smapi.lua diff --git a/widget/contrib/tp_smapi.lua b/widget/contrib/tp_smapi.lua index 06b3cbd..b8acbe2 100644 --- a/widget/contrib/tp_smapi.lua +++ b/widget/contrib/tp_smapi.lua @@ -10,7 +10,9 @@ local helpers = require("lain.helpers") local focused = require("awful.screen").focused local gears = require("gears") local naughty = require("naughty") +local wibox = require("wibox") local string = string +local type = type -- ThinkPad battery infos and widget creator -- http://www.thinkwiki.org/wiki/Tp_smapi @@ -18,7 +20,7 @@ local string = string local function factory(apipath) local tp_smapi = { - path = apipath or "/sys/devices/platform/tp_smapi" + path = apipath or "/sys/devices/platform/smapi" } function tp_smapi.get(batid, feature) @@ -34,7 +36,7 @@ local function factory(apipath) end function tp_smapi.percentage(batid) - return tp_smapi.get("remaining_percent") + return tp_smapi.get(batid, "remaining_percent") end -- either running or charging time @@ -72,7 +74,7 @@ local function factory(apipath) tp_smapi.notification = naughty.notify { title = string.format("%s: %s %s (%s)", batid, mfgr, model, chem), text = msg, - timeout = seconds or 0, + timeout = type(seconds) == "number" and seconds or 0, screen = scr or focused() } end