Merge pull request #467 from ExpidusOS/fix/widget-argument

Add "widget" arguments
This commit is contained in:
Luca CPZ 2020-11-02 17:24:16 +00:00 committed by GitHub
commit 4da087ed16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 14 additions and 14 deletions

View File

@ -15,8 +15,8 @@ local string = string
-- lain.widget.alsa -- lain.widget.alsa
local function factory(args) local function factory(args)
local alsa = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local alsa = { widget = args.widget or wibox.widget.textbox() }
local timeout = args.timeout or 5 local timeout = args.timeout or 5
local settings = args.settings or function() end local settings = args.settings or function() end

View File

@ -26,8 +26,8 @@ local function factory(args)
return return
end end
local bat = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local bat = { widget = args.widget or wibox.widget.textbox() }
local timeout = args.timeout or 30 local timeout = args.timeout or 30
local notify = args.notify or "on" local notify = args.notify or "on"
local full_notify = args.full_notify or notify local full_notify = args.full_notify or notify

View File

@ -18,8 +18,8 @@ local string = string
-- lain.widget.contrib.moc -- lain.widget.contrib.moc
local function factory(args) local function factory(args)
local moc = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local moc = { widget = args.widget or wibox.widget.textbox() }
local timeout = args.timeout or 2 local timeout = args.timeout or 2
local music_dir = args.music_dir or os.getenv("HOME") .. "/Music" local music_dir = args.music_dir or os.getenv("HOME") .. "/Music"
local cover_pattern = args.cover_pattern or "*\\.(jpg|jpeg|png|gif)$" local cover_pattern = args.cover_pattern or "*\\.(jpg|jpeg|png|gif)$"

View File

@ -16,8 +16,8 @@ local tostring = tostring
-- lain.widget.cpu -- lain.widget.cpu
local function factory(args) local function factory(args)
local cpu = { core = {}, widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local cpu = { core = {}, widget = args.widget or wibox.widget.textbox() }
local timeout = args.timeout or 2 local timeout = args.timeout or 2
local settings = args.settings or function() end local settings = args.settings or function() end

View File

@ -26,8 +26,9 @@ local query = query_size .. "," .. query_free .. "," .. query_used
-- lain.widget.fs -- lain.widget.fs
local function factory(args) local function factory(args)
local args = args or {}
local fs = { local fs = {
widget = wibox.widget.textbox(), widget = args.widget or wibox.widget.textbox(),
units = { units = {
[1] = "Kb", [2] = "Mb", [3] = "Gb", [1] = "Kb", [2] = "Mb", [3] = "Gb",
[4] = "Tb", [5] = "Pb", [6] = "Eb", [4] = "Tb", [5] = "Pb", [6] = "Eb",
@ -50,7 +51,6 @@ local function factory(args)
} }
end end
local args = args or {}
local timeout = args.timeout or 600 local timeout = args.timeout or 600
local partition = args.partition local partition = args.partition
local threshold = args.threshold or 99 local threshold = args.threshold or 99

View File

@ -17,8 +17,8 @@ local tonumber = tonumber
-- lain.widget.imap -- lain.widget.imap
local function factory(args) local function factory(args)
local imap = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local imap = { widget = args.widget or wibox.widget.textbox() }
local server = args.server local server = args.server
local mail = args.mail local mail = args.mail
local password = args.password local password = args.password

View File

@ -14,8 +14,8 @@ local gmatch, lines, floor = string.gmatch, io.lines, math.floor
-- lain.widget.mem -- lain.widget.mem
local function factory(args) local function factory(args)
local mem = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local mem = { widget = args.widget or wibox.widget.textbox() }
local timeout = args.timeout or 2 local timeout = args.timeout or 2
local settings = args.settings or function() end local settings = args.settings or function() end

View File

@ -19,8 +19,8 @@ local string = string
-- lain.widget.mpd -- lain.widget.mpd
local function factory(args) local function factory(args)
local mpd = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local mpd = { widget = args.widget or wibox.widget.textbox() }
local timeout = args.timeout or 2 local timeout = args.timeout or 2
local password = (args.password and #args.password > 0 and string.format("password %s\\n", args.password)) or "" 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" local host = args.host or os.getenv("MPD_HOST") or "127.0.0.1"

View File

@ -15,8 +15,8 @@ local string = string
-- lain.widget.net -- lain.widget.net
local function factory(args) local function factory(args)
local net = { widget = wibox.widget.textbox(), devices = {} }
local args = args or {} local args = args or {}
local net = { widget = args.widget or wibox.widget.textbox(), devices = {} }
local timeout = args.timeout or 2 local timeout = args.timeout or 2
local units = args.units or 1024 -- KB local units = args.units or 1024 -- KB
local notify = args.notify or "on" local notify = args.notify or "on"

View File

@ -15,8 +15,8 @@ local type = type
-- lain.widget.pulse -- lain.widget.pulse
local function factory(args) local function factory(args)
local pulse = { widget = wibox.widget.textbox(), device = "N/A" }
local args = args or {} local args = args or {}
local pulse = { widget = args.widget or wibox.widget.textbox(), device = "N/A" }
local timeout = args.timeout or 5 local timeout = args.timeout or 5
local settings = args.settings or function() end local settings = args.settings or function() end

View File

@ -14,8 +14,8 @@ local open, match = io.open, string.match
-- lain.widget.sysload -- lain.widget.sysload
local function factory(args) local function factory(args)
local sysload = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local sysload = { widget = args.widget or wibox.widget.textbox() }
local timeout = args.timeout or 2 local timeout = args.timeout or 2
local settings = args.settings or function() end local settings = args.settings or function() end

View File

@ -13,8 +13,8 @@ local tonumber = tonumber
-- lain.widget.temp -- lain.widget.temp
local function factory(args) local function factory(args)
local temp = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local temp = { widget = args.widget or wibox.widget.textbox() }
local timeout = args.timeout or 30 local timeout = args.timeout or 30
local tempfile = args.tempfile or "/sys/devices/virtual/thermal/thermal_zone0/temp" local tempfile = args.tempfile or "/sys/devices/virtual/thermal/thermal_zone0/temp"
local settings = args.settings or function() end local settings = args.settings or function() end

View File

@ -21,8 +21,8 @@ local tonumber = tonumber
-- lain.widget.weather -- lain.widget.weather
local function factory(args) local function factory(args)
local weather = { widget = wibox.widget.textbox() }
local args = args or {} local args = args or {}
local weather = { widget = args.widget or wibox.widget.textbox() }
local APPID = args.APPID or "3e321f9414eaedbfab34983bda77a66e" -- lain's default local APPID = args.APPID or "3e321f9414eaedbfab34983bda77a66e" -- lain's default
local timeout = args.timeout or 60 * 15 -- 15 min local timeout = args.timeout or 60 * 15 -- 15 min
local timeout_forecast = args.timeout or 60 * 60 * 24 -- 24 hrs local timeout_forecast = args.timeout or 60 * 60 * 24 -- 24 hrs