X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/0d5c25ffd4ed4d5c1a06b1f0b731b1cb6db79b8b..617675d6c3a7b79d650bfcd52a3c13e8dcdfa459:/widgets/abase.lua diff --git a/widgets/abase.lua b/widgets/abase.lua index 20cc955..60d86ab 100644 --- a/widgets/abase.lua +++ b/widgets/abase.lua @@ -10,11 +10,9 @@ local newtimer = require("lain.helpers").newtimer local async = require("lain.asyncshell") local wibox = require("wibox") -local io = io local setmetatable = setmetatable --- Basic template for custom widgets --- Asynchronous version +-- Basic template for custom widgets (asynchronous version) -- lain.widgets.abase local function worker(args) @@ -28,10 +26,12 @@ local function worker(args) function abase.update() async.request(cmd, function(f) - output = f:read("*a") - f:close() - widget = abase.widget - settings() + output = f + if output ~= abase.prev then + widget = abase.widget + settings() + abase.prev = output + end end) end