mirror of https://github.com/lcpz/lain.git
Merge pull request #467 from ExpidusOS/fix/widget-argument
Add "widget" arguments
This commit is contained in:
commit
4da087ed16
|
@ -15,8 +15,8 @@ local string = string
|
|||
-- lain.widget.alsa
|
||||
|
||||
local function factory(args)
|
||||
local alsa = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local alsa = { widget = args.widget or wibox.widget.textbox() }
|
||||
local timeout = args.timeout or 5
|
||||
local settings = args.settings or function() end
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ local function factory(args)
|
|||
return
|
||||
end
|
||||
|
||||
local bat = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local bat = { widget = args.widget or wibox.widget.textbox() }
|
||||
local timeout = args.timeout or 30
|
||||
local notify = args.notify or "on"
|
||||
local full_notify = args.full_notify or notify
|
||||
|
|
|
@ -18,8 +18,8 @@ local string = string
|
|||
-- lain.widget.contrib.moc
|
||||
|
||||
local function factory(args)
|
||||
local moc = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local moc = { widget = args.widget or wibox.widget.textbox() }
|
||||
local timeout = args.timeout or 2
|
||||
local music_dir = args.music_dir or os.getenv("HOME") .. "/Music"
|
||||
local cover_pattern = args.cover_pattern or "*\\.(jpg|jpeg|png|gif)$"
|
||||
|
|
|
@ -16,8 +16,8 @@ local tostring = tostring
|
|||
-- lain.widget.cpu
|
||||
|
||||
local function factory(args)
|
||||
local cpu = { core = {}, widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local cpu = { core = {}, widget = args.widget or wibox.widget.textbox() }
|
||||
local timeout = args.timeout or 2
|
||||
local settings = args.settings or function() end
|
||||
|
||||
|
|
|
@ -26,8 +26,9 @@ local query = query_size .. "," .. query_free .. "," .. query_used
|
|||
-- lain.widget.fs
|
||||
|
||||
local function factory(args)
|
||||
local args = args or {}
|
||||
local fs = {
|
||||
widget = wibox.widget.textbox(),
|
||||
widget = args.widget or wibox.widget.textbox(),
|
||||
units = {
|
||||
[1] = "Kb", [2] = "Mb", [3] = "Gb",
|
||||
[4] = "Tb", [5] = "Pb", [6] = "Eb",
|
||||
|
@ -50,7 +51,6 @@ local function factory(args)
|
|||
}
|
||||
end
|
||||
|
||||
local args = args or {}
|
||||
local timeout = args.timeout or 600
|
||||
local partition = args.partition
|
||||
local threshold = args.threshold or 99
|
||||
|
|
|
@ -17,8 +17,8 @@ local tonumber = tonumber
|
|||
-- lain.widget.imap
|
||||
|
||||
local function factory(args)
|
||||
local imap = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local imap = { widget = args.widget or wibox.widget.textbox() }
|
||||
local server = args.server
|
||||
local mail = args.mail
|
||||
local password = args.password
|
||||
|
|
|
@ -14,8 +14,8 @@ local gmatch, lines, floor = string.gmatch, io.lines, math.floor
|
|||
-- lain.widget.mem
|
||||
|
||||
local function factory(args)
|
||||
local mem = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local mem = { widget = args.widget or wibox.widget.textbox() }
|
||||
local timeout = args.timeout or 2
|
||||
local settings = args.settings or function() end
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ local string = string
|
|||
-- lain.widget.mpd
|
||||
|
||||
local function factory(args)
|
||||
local mpd = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local mpd = { widget = args.widget or wibox.widget.textbox() }
|
||||
local timeout = args.timeout or 2
|
||||
local password = (args.password and #args.password > 0 and string.format("password %s\\n", args.password)) or ""
|
||||
local host = args.host or os.getenv("MPD_HOST") or "127.0.0.1"
|
||||
|
|
|
@ -15,8 +15,8 @@ local string = string
|
|||
-- lain.widget.net
|
||||
|
||||
local function factory(args)
|
||||
local net = { widget = wibox.widget.textbox(), devices = {} }
|
||||
local args = args or {}
|
||||
local net = { widget = args.widget or wibox.widget.textbox(), devices = {} }
|
||||
local timeout = args.timeout or 2
|
||||
local units = args.units or 1024 -- KB
|
||||
local notify = args.notify or "on"
|
||||
|
|
|
@ -15,8 +15,8 @@ local type = type
|
|||
-- lain.widget.pulse
|
||||
|
||||
local function factory(args)
|
||||
local pulse = { widget = wibox.widget.textbox(), device = "N/A" }
|
||||
local args = args or {}
|
||||
local pulse = { widget = args.widget or wibox.widget.textbox(), device = "N/A" }
|
||||
local timeout = args.timeout or 5
|
||||
local settings = args.settings or function() end
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ local open, match = io.open, string.match
|
|||
-- lain.widget.sysload
|
||||
|
||||
local function factory(args)
|
||||
local sysload = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local sysload = { widget = args.widget or wibox.widget.textbox() }
|
||||
local timeout = args.timeout or 2
|
||||
local settings = args.settings or function() end
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ local tonumber = tonumber
|
|||
-- lain.widget.temp
|
||||
|
||||
local function factory(args)
|
||||
local temp = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local temp = { widget = args.widget or wibox.widget.textbox() }
|
||||
local timeout = args.timeout or 30
|
||||
local tempfile = args.tempfile or "/sys/devices/virtual/thermal/thermal_zone0/temp"
|
||||
local settings = args.settings or function() end
|
||||
|
|
|
@ -21,8 +21,8 @@ local tonumber = tonumber
|
|||
-- lain.widget.weather
|
||||
|
||||
local function factory(args)
|
||||
local weather = { widget = wibox.widget.textbox() }
|
||||
local args = args or {}
|
||||
local weather = { widget = args.widget or wibox.widget.textbox() }
|
||||
local APPID = args.APPID or "3e321f9414eaedbfab34983bda77a66e" -- lain's default
|
||||
local timeout = args.timeout or 60 * 15 -- 15 min
|
||||
local timeout_forecast = args.timeout or 60 * 60 * 24 -- 24 hrs
|
||||
|
|
Loading…
Reference in New Issue