From c155301459aa73a1b5e9a1b674be12f03021c4fe Mon Sep 17 00:00:00 2001 From: copycat-killer Date: Wed, 8 Feb 2017 14:09:52 +0100 Subject: [PATCH 1/1] abase renamed to watch; #312: wiki updated --- widgets/{abase.lua => watch.lua} | 20 ++++++++++---------- wiki | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) rename widgets/{abase.lua => watch.lua} (71%) diff --git a/widgets/abase.lua b/widgets/watch.lua similarity index 71% rename from widgets/abase.lua rename to widgets/watch.lua index 300cc1b..abca92b 100644 --- a/widgets/abase.lua +++ b/widgets/watch.lua @@ -10,11 +10,11 @@ local helpers = require("lain.helpers") local textbox = require("wibox.widget.textbox") local setmetatable = setmetatable --- Template for custom asynchronous widgets --- lain.widgets.abase +-- Template for asynchronous watcher widgets +-- lain.widgets.watch local function worker(args) - local abase = {} + local watch = {} local args = args or {} local timeout = args.timeout or 5 local nostart = args.nostart or false @@ -22,22 +22,22 @@ local function worker(args) local cmd = args.cmd local settings = args.settings or function() widget:set_text(output) end - abase.widget = args.widget or textbox() + watch.widget = args.widget or textbox() - function abase.update() + function watch.update() helpers.async(cmd, function(f) output = f - if output ~= abase.prev then - widget = abase.widget + if output ~= watch.prev then + widget = watch.widget settings() - abase.prev = output + watch.prev = output end end) end - abase.timer = helpers.newtimer(cmd, timeout, abase.update, nostart, stoppable) + watch.timer = helpers.newtimer(cmd, timeout, watch.update, nostart, stoppable) - return abase + return watch end return setmetatable({}, { __call = function(_, ...) return worker(...) end }) diff --git a/wiki b/wiki index af671ad..32904a7 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit af671ad9bb1ce9c7bb74a75f489a3b5d0a934558 +Subproject commit 32904a7e2cc20b9aec497aa9a031324fc535b0f9 -- 2.39.5