From b371de56f8bf19f982a4f6887f2110444b590f74 Mon Sep 17 00:00:00 2001 From: luke bonham Date: Fri, 8 Aug 2014 14:25:21 +0200 Subject: [PATCH] widget module loads optimization --- helpers.lua | 2 +- widgets/abase.lua | 1 - widgets/base.lua | 4 ++-- widgets/borderbox.lua | 1 + widgets/calendar.lua | 2 +- widgets/fs.lua | 2 +- widgets/imap.lua | 2 +- widgets/maildir.lua | 2 +- widgets/net.lua | 2 +- widgets/temp.lua | 2 +- widgets/yawn/init.lua | 3 ++- 11 files changed, 12 insertions(+), 11 deletions(-) diff --git a/helpers.lua b/helpers.lua index 863bb87..1dfb09b 100644 --- a/helpers.lua +++ b/helpers.lua @@ -2,7 +2,7 @@ --[[ Licensed under GNU General Public License v2 - * (c) 2013, Luke Bonham + * (c) 2013, Luke Bonham --]] diff --git a/widgets/abase.lua b/widgets/abase.lua index 20cc955..075d615 100644 --- a/widgets/abase.lua +++ b/widgets/abase.lua @@ -10,7 +10,6 @@ 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 diff --git a/widgets/base.lua b/widgets/base.lua index 6b808b7..39b0863 100644 --- a/widgets/base.lua +++ b/widgets/base.lua @@ -9,10 +9,10 @@ local newtimer = require("lain.helpers").newtimer local wibox = require("wibox") -local io = io +local io = { popen = io.popen } local setmetatable = setmetatable --- Basic template for custom widgets +-- Basic template for custom widgets -- lain.widgets.base local function worker(args) diff --git a/widgets/borderbox.lua b/widgets/borderbox.lua index c251ea8..cce8517 100644 --- a/widgets/borderbox.lua +++ b/widgets/borderbox.lua @@ -8,6 +8,7 @@ --]] local wibox = require("awful.wibox") + local setmetatable = setmetatable -- Creates a thin wibox at a position relative to another wibox diff --git a/widgets/calendar.lua b/widgets/calendar.lua index c690e3f..d07a5b4 100644 --- a/widgets/calendar.lua +++ b/widgets/calendar.lua @@ -12,7 +12,7 @@ local awful = require("awful") local beautiful = require("beautiful") local naughty = require("naughty") -local io = io +local io = { popen = io.popen } local os = { date = os.date } local tonumber = tonumber diff --git a/widgets/fs.lua b/widgets/fs.lua index 8127c28..f78cfe0 100644 --- a/widgets/fs.lua +++ b/widgets/fs.lua @@ -14,7 +14,7 @@ local beautiful = require("beautiful") local wibox = require("wibox") local naughty = require("naughty") -local io = io +local io = { popen = io.popen } local pairs = pairs local string = { match = string.match, format = string.format } diff --git a/widgets/imap.lua b/widgets/imap.lua index 1dca87c..65c425e 100644 --- a/widgets/imap.lua +++ b/widgets/imap.lua @@ -57,7 +57,7 @@ local function worker(args) curl = string.format("%s --url imaps://%s:%s/INBOX -u %s:%s %s -k", head_command, server, port, mail, password, request) - async.request(curl, function(f) + async.request(curl, function(f) ws = f:read("*a") f:close() diff --git a/widgets/maildir.lua b/widgets/maildir.lua index bd79221..246341f 100644 --- a/widgets/maildir.lua +++ b/widgets/maildir.lua @@ -13,7 +13,7 @@ local wibox = require("wibox") local util = require("lain.util") -local io = io +local io = { popen = io.popen } local os = { getenv = os.getenv } local pairs = pairs local string = { len = string.len, diff --git a/widgets/net.lua b/widgets/net.lua index 7851d5a..9575000 100644 --- a/widgets/net.lua +++ b/widgets/net.lua @@ -13,7 +13,7 @@ local notify_fg = require("beautiful").fg_focus local naughty = require("naughty") local wibox = require("wibox") -local io = io +local io = { popen = io.popen } local tostring = tostring local string = { format = string.format, gsub = string.gsub } diff --git a/widgets/temp.lua b/widgets/temp.lua index 4ae1c04..5994f59 100644 --- a/widgets/temp.lua +++ b/widgets/temp.lua @@ -10,7 +10,7 @@ local newtimer = require("lain.helpers").newtimer local wibox = require("wibox") -local io = io +local io = { open = io.open } local tonumber = tonumber local setmetatable = setmetatable diff --git a/widgets/yawn/init.lua b/widgets/yawn/init.lua index 033254e..aa58ed1 100644 --- a/widgets/yawn/init.lua +++ b/widgets/yawn/init.lua @@ -13,7 +13,8 @@ local naughty = require("naughty") local wibox = require("wibox") local debug = { getinfo = debug.getinfo } -local io = io +local io = { lines = io.lines, + open = io.open } local os = { date = os.date, getenv = os.getenv } local string = { find = string.find, -- 2.39.5