From 1cfa040fbd2b1740e02357f54a10f83ea36af0b1 Mon Sep 17 00:00:00 2001 From: Joerg Thalheim Date: Mon, 23 Oct 2017 15:24:17 +0100 Subject: [PATCH] re-add format parameter. This broke custom formats in the date widget. --- init.lua | 7 ++++--- widgets/pkg_all.lua | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index 3751fa1..c53254b 100644 --- a/init.lua +++ b/init.lua @@ -76,7 +76,7 @@ local function update(widget, reg, disablecache) cache.time, cache.data = t, data end end - + -- Check for cached output newer than the last update local c = widget_cache[reg.wtype] if c and c.time and c.data and t < c.time+reg.timer and not disablecache then @@ -85,14 +85,15 @@ local function update(widget, reg, disablecache) if reg.wtype.async then if not reg.lock then reg.lock = true - return reg.wtype.async(reg.warg, + return reg.wtype.async(reg.format, + reg.warg, function(data) update_value(format_data(data), t, c) reg.lock=false end) end else - return update_value(format_data(reg.wtype(nil, reg.warg)), t, c) + return update_value(format_data(reg.wtype(reg.format, reg.warg)), t, c) end end end diff --git a/widgets/pkg_all.lua b/widgets/pkg_all.lua index 5a812e2..62cc61e 100644 --- a/widgets/pkg_all.lua +++ b/widgets/pkg_all.lua @@ -17,7 +17,7 @@ local pkg_all = {} -- {{{ Packages widget type -function pkg_all.async(warg, callback) +function pkg_all.async(format, warg, callback) if not warg then return end -- Initialize counters @@ -44,7 +44,7 @@ function pkg_all.async(warg, callback) size = math.max(size-first, 0) return {size, lines} end - + -- Select command local _pkg = manager[warg] spawn.easy_async(_pkg.cmd, function(stdout) callback(parse(stdout, _pkg.sub)) end) @@ -54,8 +54,8 @@ end -- {{{ Packages widget type local function worker(format, warg) local ret = nil - - pkg_all.async(warg, function(data) ret = data end) + + pkg_all.async(format, warg, function(data) ret = data end) while ret==nil do end return ret