From 502a1a28ba87c0808ff0aad87b42285f99e9e39d Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Sat, 31 Oct 2020 10:11:29 -0700 Subject: [PATCH 1/3] Added args.widget info all widgets that can take it --- widget/alsa.lua | 2 +- widget/bat.lua | 2 +- widget/contrib/moc.lua | 2 +- widget/cpu.lua | 2 +- widget/fs.lua | 4 ++-- widget/imap.lua | 2 +- widget/mem.lua | 2 +- widget/mpd.lua | 2 +- widget/net.lua | 2 +- widget/pulse.lua | 2 +- widget/sysload.lua | 2 +- widget/temp.lua | 2 +- widget/weather.lua | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/widget/alsa.lua b/widget/alsa.lua index 3b6c6d6..49b2cf0 100644 --- a/widget/alsa.lua +++ b/widget/alsa.lua @@ -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 diff --git a/widget/bat.lua b/widget/bat.lua index 3310069..7e69e1f 100644 --- a/widget/bat.lua +++ b/widget/bat.lua @@ -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 diff --git a/widget/contrib/moc.lua b/widget/contrib/moc.lua index f429c77..e9a7dfe 100644 --- a/widget/contrib/moc.lua +++ b/widget/contrib/moc.lua @@ -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)$" diff --git a/widget/cpu.lua b/widget/cpu.lua index f4cce73..b823a5f 100644 --- a/widget/cpu.lua +++ b/widget/cpu.lua @@ -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 diff --git a/widget/fs.lua b/widget/fs.lua index 8e2441a..53eac66 100644 --- a/widget/fs.lua +++ b/widget/fs.lua @@ -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 diff --git a/widget/imap.lua b/widget/imap.lua index b3d9dc7..c8eb2c9 100644 --- a/widget/imap.lua +++ b/widget/imap.lua @@ -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 diff --git a/widget/mem.lua b/widget/mem.lua index 3dcae2b..90933b6 100644 --- a/widget/mem.lua +++ b/widget/mem.lua @@ -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 diff --git a/widget/mpd.lua b/widget/mpd.lua index 01f28e6..13994bd 100644 --- a/widget/mpd.lua +++ b/widget/mpd.lua @@ -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" diff --git a/widget/net.lua b/widget/net.lua index a6c43ab..bf24fcf 100644 --- a/widget/net.lua +++ b/widget/net.lua @@ -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" diff --git a/widget/pulse.lua b/widget/pulse.lua index f63fe55..5a6fb0b 100644 --- a/widget/pulse.lua +++ b/widget/pulse.lua @@ -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 diff --git a/widget/sysload.lua b/widget/sysload.lua index adf3e03..38cdd9d 100644 --- a/widget/sysload.lua +++ b/widget/sysload.lua @@ -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 diff --git a/widget/temp.lua b/widget/temp.lua index e909b32..8b646a0 100644 --- a/widget/temp.lua +++ b/widget/temp.lua @@ -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 diff --git a/widget/weather.lua b/widget/weather.lua index 79d45d8..3cf5102 100644 --- a/widget/weather.lua +++ b/widget/weather.lua @@ -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 From 9846ab63786b5d6e738aef3c2630344841686809 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Sat, 31 Oct 2020 13:04:43 -0700 Subject: [PATCH 2/3] Wiki updated for new arguments --- wiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki b/wiki index 2899629..1287ecf 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 2899629c445cb12efb72cc538e36cfc2ec812201 +Subproject commit 1287ecfcb238df04e95c6f9daa6a7848a97bac92 From e48e271bd44ab5c92711e79dcd45dce7b1d191f0 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Sun, 1 Nov 2020 19:27:00 -0800 Subject: [PATCH 3/3] Wiki update --- wiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki b/wiki index 1287ecf..2899629 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 1287ecfcb238df04e95c6f9daa6a7848a97bac92 +Subproject commit 2899629c445cb12efb72cc538e36cfc2ec812201