From f7aa28919588d307083b4b5b1c010f26cbc63cde Mon Sep 17 00:00:00 2001 From: luke bonham Date: Fri, 13 Sep 2013 18:15:25 +0200 Subject: [PATCH] small fixes --- helpers.lua | 12 ++++++------ layout/uselesstile.lua | 2 +- util/init.lua | 22 +++++++++++----------- util/markup.lua | 12 ++++++------ widgets/alsa.lua | 10 +++++----- widgets/alsabar.lua | 6 +++--- widgets/cpu.lua | 3 ++- widgets/fs.lua | 4 ++-- widgets/imap.lua | 4 +++- widgets/mem.lua | 10 +++++----- widgets/net.lua | 2 +- widgets/sysload.lua | 2 +- 12 files changed, 46 insertions(+), 43 deletions(-) diff --git a/helpers.lua b/helpers.lua index 81910d2..97cb797 100644 --- a/helpers.lua +++ b/helpers.lua @@ -1,10 +1,10 @@ --[[ - - Licensed under GNU General Public License v2 - * (c) 2013, Luke Bonham - * (c) 2010-2012, Peter Hofmann - + + Licensed under GNU General Public License v2 + * (c) 2013, Luke Bonham + * (c) 2010-2012, Peter Hofmann + --]] local debug = require("debug") @@ -46,7 +46,7 @@ end -- }}} --- {{{ Timer maker +-- {{{ Timer maker helpers.timer_table = {} diff --git a/layout/uselesstile.lua b/layout/uselesstile.lua index b82c97e..cd288ed 100644 --- a/layout/uselesstile.lua +++ b/layout/uselesstile.lua @@ -11,7 +11,7 @@ local tag = require("awful.tag") local beautiful = require("beautiful") local ipairs = ipairs -local math = { floor = math.floor, +local math = { floor = math.floor, max = math.max, min = math.min } local tonumber = tonumber diff --git a/util/init.lua b/util/init.lua index a44d52c..26f50ae 100644 --- a/util/init.lua +++ b/util/init.lua @@ -1,15 +1,15 @@ --[[ - - Lain - Layouts, widgets and utilities for Awesome WM - - Utilities section - - Licensed under GNU General Public License v2 - * (c) 2013, Luke Bonham - * (c) 2010-2012, Peter Hofmann - + + Lain + Layouts, widgets and utilities for Awesome WM + + Utilities section + + Licensed under GNU General Public License v2 + * (c) 2013, Luke Bonham + * (c) 2010-2012, Peter Hofmann + --]] local awful = require("awful") @@ -17,7 +17,7 @@ local beautiful = require("beautiful") local math = { sqrt = math.sqrt } local mouse = mouse local pairs = pairs -local string = string +local string = { gsub = string.gsub } local client = client local screen = screen local tonumber = tonumber diff --git a/util/markup.lua b/util/markup.lua index dbb8529..d367bca 100644 --- a/util/markup.lua +++ b/util/markup.lua @@ -1,11 +1,11 @@ --[[ - - Licensed under MIT License - * (c) 2013, Luke Bonham - * (c) 2009, Uli Schlachter - * (c) 2009, Majic - + + Licensed under MIT License + * (c) 2013, Luke Bonham + * (c) 2009, Uli Schlachter + * (c) 2009, Majic + --]] local beautiful = require("beautiful") diff --git a/widgets/alsa.lua b/widgets/alsa.lua index 3e025bb..28bb05c 100644 --- a/widgets/alsa.lua +++ b/widgets/alsa.lua @@ -1,10 +1,10 @@ --[[ - - Licensed under GNU General Public License v2 - * (c) 2013, Luke Bonham - * (c) 2010, Adrian C. - + + Licensed under GNU General Public License v2 + * (c) 2013, Luke Bonham + * (c) 2010, Adrian C. + --]] local newtimer = require("lain.helpers").newtimer diff --git a/widgets/alsabar.lua b/widgets/alsabar.lua index 8331c54..d8f1731 100644 --- a/widgets/alsabar.lua +++ b/widgets/alsabar.lua @@ -15,7 +15,7 @@ local naughty = require("naughty") local io = { popen = io.popen } local math = { modf = math.modf } -local string = { format = string.format, +local string = { format = string.format, match = string.match, rep = string.rep } local tonumber = tonumber @@ -44,7 +44,7 @@ local alsabar = font = beautiful.font:sub(beautiful.font:find(""), beautiful.font:find(" ")), font_size = "11", color = beautiful.fg_focus, - bar_size = 18 + bar_size = 18 }, _current_level = 0, @@ -122,7 +122,7 @@ local function worker(args) f:close() -- Capture mixer control state: [5%] ... ... [on] - local volu, mute = string.match(mixer, "([%d]+)%%.*%[([%l]*)") + local volu, mute = string.match(mixer, "([%d]+)%%.*%[([%l]*)") if volu == nil then volu = 0 diff --git a/widgets/cpu.lua b/widgets/cpu.lua index 55a3799..0b21edc 100644 --- a/widgets/cpu.lua +++ b/widgets/cpu.lua @@ -58,7 +58,8 @@ local function worker(args) local dactive = active - cpu.last_active local dtotal = total - cpu.last_total - usage = tostring(math.ceil((dactive / dtotal) * 100)) + cpu_now = {} + cpu_now.usage = tostring(math.ceil((dactive / dtotal) * 100)) widget = cpu.widget settings() diff --git a/widgets/fs.lua b/widgets/fs.lua index 17037c4..b434056 100644 --- a/widgets/fs.lua +++ b/widgets/fs.lua @@ -64,7 +64,7 @@ local function worker(args) helpers.set_map("fs", false) function update() - fs_info = {} + fs_info = {} local f = io.popen("LC_ALL=C df -kP") @@ -95,7 +95,7 @@ local function worker(args) if used >= 99 and not helpers.get_map("fs") then - naughty.notify({ + naughty.notify({ title = "warning", text = partition .. " ran out!\nmake some room", timeout = 8, diff --git a/widgets/imap.lua b/widgets/imap.lua index 6574276..605c1c4 100644 --- a/widgets/imap.lua +++ b/widgets/imap.lua @@ -14,6 +14,7 @@ local wibox = require("wibox") local io = { popen = io.popen } local string = { format = string.format, gsub = string.gsub } +local tonumber = tonumber local setmetatable = setmetatable @@ -52,7 +53,7 @@ local function worker(args) icon = helpers.icons_dir .. "mail.png", position = "top_left" } - + curl = string.format("%s --url imaps://%s:%s/INBOX -u %s:%s %s -k", head_command, server, port, mail, password, request) @@ -62,6 +63,7 @@ local function worker(args) t, mailcount = string.gsub(ws, "%d", "") t = nil -- because it's useless + mailcount = tonumber(mailcount) widget = imap.widget settings() diff --git a/widgets/mem.lua b/widgets/mem.lua index 78ed3e0..986fa76 100644 --- a/widgets/mem.lua +++ b/widgets/mem.lua @@ -1,10 +1,10 @@ --[[ - - Licensed under GNU General Public License v2 - * (c) 2013, Luke Bonham - * (c) 2010-2012, Peter Hofmann - + + Licensed under GNU General Public License v2 + * (c) 2013, Luke Bonham + * (c) 2010-2012, Peter Hofmann + --]] local newtimer = require("lain.helpers").newtimer diff --git a/widgets/net.lua b/widgets/net.lua index b3deca6..d79e117 100644 --- a/widgets/net.lua +++ b/widgets/net.lua @@ -50,7 +50,7 @@ local function worker(args) helpers.set_map(iface, true) - function update() + function update() net_now = {} if iface == "" then iface = net.get_device() end diff --git a/widgets/sysload.lua b/widgets/sysload.lua index 868398c..015573c 100644 --- a/widgets/sysload.lua +++ b/widgets/sysload.lua @@ -32,7 +32,7 @@ local function worker(args) local f = io.open("/proc/loadavg") local ret = f:read("*all") f:close() - + load_1, load_5, load_15 = string.match(ret, "([^%s]+) ([^%s]+) ([^%s]+)") widget = sysload.widget -- 2.39.5