]> git.madduck.net Git - etc/awesome.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

API change: lain.widget.contrib.tpbat has been rewritten and renamed to lain.widget...
authorlcpz <luca.cpz@gmail.com>
Wed, 28 Nov 2018 19:43:04 +0000 (19:43 +0000)
committerlcpz <luca.cpz@gmail.com>
Wed, 28 Nov 2018 20:01:22 +0000 (20:01 +0000)
lain.widget.cal: honour followtag argument

lightened calls to libraries

21 files changed:
layout/termfair.lua
util/quake.lua
util/separators.lua
widget/alsa.lua
widget/alsabar.lua
widget/bat.lua
widget/cal.lua
widget/contrib/moc.lua
widget/contrib/redshift.lua
widget/contrib/smapi.lua [new file with mode: 0644]
widget/contrib/task.lua
widget/contrib/tpbat/init.lua [deleted file]
widget/contrib/tpbat/smapi.lua [deleted file]
widget/cpu.lua
widget/imap.lua
widget/mpd.lua
widget/net.lua
widget/pulse.lua
widget/pulsebar.lua
widget/weather.lua
wiki

index f57f7158101af2daa0d37d2f841a5eb246844de0..e33894e11777ad85031ed6d9c1e21577869cc063 100644 (file)
@@ -8,9 +8,7 @@
 
 --]]
 
 
 --]]
 
-local math     = { ceil  = math.ceil,
-                   floor = math.floor,
-                   max   = math.max }
+local math     = math
 local screen   = screen
 local tonumber = tonumber
 
 local screen   = screen
 local tonumber = tonumber
 
index 64aaca5f956117e112e31b6b9ee4ede690283b86..f41447f9e4abaa141325fb275e36663c0fe4d44b 100644 (file)
@@ -7,14 +7,11 @@
 --]]
 
 local awful        = require("awful")
 --]]
 
 local awful        = require("awful")
-local capi         = { client = client }
-
-local math         = { floor  = math.floor }
-local string       = { format = string.format }
-
+local client       = client
+local math         = math
+local string       = string
 local pairs        = pairs
 local screen       = screen
 local pairs        = pairs
 local screen       = screen
-
 local setmetatable = setmetatable
 
 -- Quake-like Dropdown application spawn
 local setmetatable = setmetatable
 
 -- Quake-like Dropdown application spawn
@@ -80,7 +77,7 @@ function quake:display()
         client:raise()
         self.last_tag = self.screen.selected_tag
         client:tags({self.screen.selected_tag})
         client:raise()
         self.last_tag = self.screen.selected_tag
         client:tags({self.screen.selected_tag})
-        capi.client.focus = client
+        client.focus = client
    else
         client.hidden = true
         local ctags = client:tags()
    else
         client.hidden = true
         local ctags = client:tags()
@@ -140,12 +137,12 @@ function quake:new(config)
 
     local dropdown = setmetatable(conf, { __index = quake })
 
 
     local dropdown = setmetatable(conf, { __index = quake })
 
-    capi.client.connect_signal("manage", function(c)
+    client.connect_signal("manage", function(c)
         if c.instance == dropdown.name and c.screen == dropdown.screen then
             dropdown:display()
         end
     end)
         if c.instance == dropdown.name and c.screen == dropdown.screen then
             dropdown:display()
         end
     end)
-    capi.client.connect_signal("unmanage", function(c)
+    client.connect_signal("unmanage", function(c)
         if c.instance == dropdown.name and c.screen == dropdown.screen then
             dropdown.visible = false
         end
         if c.instance == dropdown.name and c.screen == dropdown.screen then
             dropdown.visible = false
         end
index e45b954e061339c21ff5d4ef513c1e621d93da81..465132d56193d6de9d7098c6ec66f8a948b2c040 100644 (file)
@@ -6,8 +6,8 @@
 
 --]]
 
 
 --]]
 
-local wibox     = require("wibox")
-local gears     = require("gears")
+local wibox = require("wibox")
+local gears = require("gears")
 
 -- Lain Cairo separators util submodule
 -- lain.util.separators
 
 -- Lain Cairo separators util submodule
 -- lain.util.separators
index 2d4891d29abb990aa12adea61d055d39c8f08efd..3b6c6d6d2e87ce69234e02a571e6c4bd9193a833 100644 (file)
@@ -9,8 +9,7 @@
 local helpers = require("lain.helpers")
 local shell   = require("awful.util").shell
 local wibox   = require("wibox")
 local helpers = require("lain.helpers")
 local shell   = require("awful.util").shell
 local wibox   = require("wibox")
-local string  = { match  = string.match,
-                  format = string.format }
+local string  = string
 
 -- ALSA volume
 -- lain.widget.alsa
 
 -- ALSA volume
 -- lain.widget.alsa
index ea78ec5611b1b4eab4f308263b4f38bde4042412..9b9f4b97a21dec7a43bdba2a23d42d0137a11715 100644 (file)
@@ -6,12 +6,14 @@
 
 --]]
 
 
 --]]
 
-local helpers = require("lain.helpers")
-local awful   = require("awful")
-local naughty = require("naughty")
-local wibox   = require("wibox")
-
-local math, string, type, tonumber = math, string, type, tonumber
+local helpers  = require("lain.helpers")
+local awful    = require("awful")
+local naughty  = require("naughty")
+local wibox    = require("wibox")
+local math     = math
+local string   = string
+local type     = type
+local tonumber = tonumber
 
 -- ALSA volume bar
 -- lain.widget.alsabar
 
 -- ALSA volume bar
 -- lain.widget.alsabar
index b65494811286e4a5e8087ef413e16e698e506ba7..5a301b50a266c1680e4d2540ef43d6da2b1525d6 100644 (file)
@@ -6,14 +6,14 @@
 
 --]]
 
 
 --]]
 
-local helpers    = require("lain.helpers")
-local fs         = require("gears.filesystem")
-local naughty    = require("naughty")
-local wibox      = require("wibox")
-local math       = math
-local string     = string
-local ipairs     = ipairs
-local tonumber   = tonumber
+local helpers  = require("lain.helpers")
+local fs       = require("gears.filesystem")
+local naughty  = require("naughty")
+local wibox    = require("wibox")
+local math     = math
+local string   = string
+local ipairs   = ipairs
+local tonumber = tonumber
 
 -- Battery infos
 -- lain.widget.bat
 
 -- Battery infos
 -- lain.widget.bat
index 50426babca49c7e3c22c5e095475462973497205..47e91a979889739046d314d4251da11a2f056458 100644 (file)
@@ -79,7 +79,7 @@ local function factory(args)
         cal.notification = nil
     end
 
         cal.notification = nil
     end
 
-    function cal.show(timeout, month, year)
+    function cal.show(timeout, month, year, scr)
         cal.notification_preset.text = tconcat(cal.build(month, year))
 
         if cal.three then
         cal.notification_preset.text = tconcat(cal.build(month, year))
 
         if cal.three then
@@ -95,6 +95,7 @@ local function factory(args)
         cal.hide()
         cal.notification = naughty.notify {
             preset  = cal.notification_preset,
         cal.hide()
         cal.notification = naughty.notify {
             preset  = cal.notification_preset,
+            screen  = cal.followtag and awful.screen.focused() or scr or 1,
             icon    = cal.icon,
             timeout = timeout or cal.notification_preset.timeout or 5
         }
             icon    = cal.icon,
             timeout = timeout or cal.notification_preset.timeout or 5
         }
index 027cec36cb7032b5971751dd3c0cb08b378f7b83..f429c7782fb277d2a4978fb0dd06678b5d5176a6 100644 (file)
@@ -11,9 +11,8 @@ local focused      = require("awful.screen").focused
 local escape_f     = require("awful.util").escape
 local naughty      = require("naughty")
 local wibox        = require("wibox")
 local escape_f     = require("awful.util").escape
 local naughty      = require("naughty")
 local wibox        = require("wibox")
-local os           = { getenv = os.getenv }
-local string       = { format = string.format,
-                       gmatch = string.gmatch }
+local os           = os
+local string       = string
 
 -- MOC audio player
 -- lain.widget.contrib.moc
 
 -- MOC audio player
 -- lain.widget.contrib.moc
index 7b546116820246bd57af92812ad63fe336c2d56b..d0e5eed77f47d01d7eb623c36f16fde8fce5bb6b 100644 (file)
@@ -1,6 +1,7 @@
 --[[
 
      Licensed under GNU General Public License v2
 --[[
 
      Licensed under GNU General Public License v2
+      * (c) 2017, Luca CPZ
       * (c) 2014, blueluke <http://github.com/blueluke>
 
 --]]
       * (c) 2014, blueluke <http://github.com/blueluke>
 
 --]]
diff --git a/widget/contrib/smapi.lua b/widget/contrib/smapi.lua
new file mode 100644 (file)
index 0000000..06b3cbd
--- /dev/null
@@ -0,0 +1,145 @@
+--[[
+
+     Licensed under GNU General Public License v2
+      * (c) 2018, Luca CPZ
+      * (c) 2013, Conor Heine
+
+--]]
+
+local helpers = require("lain.helpers")
+local focused = require("awful.screen").focused
+local gears   = require("gears")
+local naughty = require("naughty")
+local string  = string
+
+-- ThinkPad battery infos and widget creator
+-- http://www.thinkwiki.org/wiki/Tp_smapi
+-- lain.widget.contrib.tp_smapi
+
+local function factory(apipath)
+    local tp_smapi = {
+        path = apipath or "/sys/devices/platform/tp_smapi"
+    }
+
+    function tp_smapi.get(batid, feature)
+        return helpers.first_line(string.format("%s/%s/%s", tp_smapi.path, batid or "BAT0", feature or ""))
+    end
+
+    function tp_smapi.installed(batid)
+        return tp_smapi.get(batid, "installed") == "1"
+    end
+
+    function tp_smapi.status(batid)
+        return tp_smapi.get(batid, "state")
+    end
+
+    function tp_smapi.percentage(batid)
+        return tp_smapi.get("remaining_percent")
+    end
+
+    -- either running or charging time
+    function tp_smapi.time(batid)
+        local status = tp_smapi.status(batid)
+        local mins_left = tp_smapi.get(batid, string.match(string.lower(status), "discharging") and "remaining_running_time" or "remaining_charging_time")
+        if not string.find(mins_left, "^%d+") then return "N/A" end
+        return string.format("%02d:%02d", math.floor(mins_left / 60), mins_left % 60) -- HH:mm
+    end
+
+    function tp_smapi.hide()
+        if not tp_smapi.notification then return end
+        naughty.destroy(tp_smapi.notification)
+        tp_smapi.notification = nil
+    end
+
+    function tp_smapi.show(batid, seconds, scr)
+        if not tp_smapi.installed(batid) then return end
+
+        local mfgr   = tp_smapi.get(batid, "manufacturer") or "no_mfgr"
+        local model  = tp_smapi.get(batid, "model") or "no_model"
+        local chem   = tp_smapi.get(batid, "chemistry") or "no_chem"
+        local status = tp_smapi.get(batid, "state")
+        local time   = tp_smapi.time(batid)
+        local msg    = ""
+
+        if status and status ~= "idle" then
+            msg = string.format("[%s] %s %s", status, time ~= "N/A" and time or "unknown remaining time",
+                  string.lower(status):gsub(" ", ""):gsub("\n", "") == "charging" and " until charged" or " remaining")
+        else
+            msg = "On AC power"
+        end
+
+        tp_smapi.hide()
+        tp_smapi.notification = naughty.notify {
+            title   = string.format("%s: %s %s (%s)", batid, mfgr, model, chem),
+            text    = msg,
+            timeout = seconds or 0,
+            screen  = scr or focused()
+        }
+    end
+
+    function tp_smapi.create_widget(args)
+        local args      = args or {}
+        local pspath    = args.pspath or "/sys/class/power_supply/"
+        local batteries = args.batteries or (args.battery and {args.battery}) or {}
+        local timeout   = args.timeout or 30
+        local settings  = args.settings or function() end
+
+        if #batteries == 0 then
+            helpers.line_callback("ls -1 " .. pspath, function(line)
+                local bstr = string.match(line, "BAT%w+")
+                if bstr then batteries[#batteries + 1] = bstr end
+            end)
+        end
+
+        local all_batteries_installed = true
+
+        for i, battery in ipairs(batteries) do
+            if not tp_smapi.installed(battery) then
+                naughty.notify {
+                    preset = naughty.config.critical,
+                    title  = "tp_smapi: error while creating widget",
+                    text   = string.format("battery %s is not installed", battery)
+                }
+                all_batteries_installed = false
+                break
+            end
+        end
+
+        if not all_batteries_installed then return end
+
+        tpbat = {
+            batteries = batteries,
+            widget    = args.widget or wibox.widget.textbox()
+        }
+
+        function tpbat.update()
+            tpbat_now = {
+                n_status = {},
+                n_perc   = {},
+                n_time   = {},
+                status   = "N/A"
+            }
+
+            for i = 1, #batteries do
+                tpbat_now.n_status[i] = tp_smapi.status(batteries[i]) or "N/A"
+                tpbat_now.n_perc[i] = tp_smapi.percentage(batteries[i])
+                tpbat_now.n_time[i] = tp_smapi.time(batteries[i]) or "N/A"
+
+                if not tpbat_now.n_status[i]:lower():match("full") then
+                    tpbat_now.status = tpbat_now.n_status[i]
+                end
+            end
+
+            widget = tpbat.widget -- backwards compatibility
+            settings()
+        end
+
+        helpers.newtimer("thinkpad-batteries", timeout, tpbat.update)
+
+        return tpbat
+    end
+
+    return tp_smapi
+end
+
+return factory
index 7e1f3d899b634d4c904e812abf935c4edd2b38d6..536e0063087abd4b5152516dbbc218be735fd7ed 100644 (file)
@@ -10,7 +10,7 @@ local markup  = require("lain.util").markup
 local awful   = require("awful")
 local naughty = require("naughty")
 local mouse   = mouse
 local awful   = require("awful")
 local naughty = require("naughty")
 local mouse   = mouse
-local string  = { format = string.format, gsub = string.gsub }
+local string  = string
 
 -- Taskwarrior notification
 -- lain.widget.contrib.task
 
 -- Taskwarrior notification
 -- lain.widget.contrib.task
@@ -23,11 +23,7 @@ function task.hide()
 end
 
 function task.show(scr)
 end
 
 function task.show(scr)
-    if task.followtag then
-        task.notification_preset.screen = awful.screen.focused()
-    elseif scr then
-        task.notification_preset.screen = scr
-    end
+    task.notification_preset.screen = task.followtag and awful.screen.focused() or scr or 1
 
     helpers.async({ awful.util.shell, "-c", task.show_cmd }, function(f)
         local widget_focused = true
 
     helpers.async({ awful.util.shell, "-c", task.show_cmd }, function(f)
         local widget_focused = true
@@ -44,12 +40,12 @@ function task.show(scr)
 
         if widget_focused then
             task.hide()
 
         if widget_focused then
             task.hide()
-            task.notification = naughty.notify({
-                    preset = task.notification_preset,
-                    title  = "task next",
-                    text   = markup.font(task.notification_preset.font,
-                             awful.util.escape(f:gsub("\n*$", "")))
-                })
+            task.notification = naughty.notify {
+                preset = task.notification_preset,
+                title  = "task next",
+                text   = markup.font(task.notification_preset.font,
+                         awful.util.escape(f:gsub("\n*$", "")))
+            }
         end
     end)
 end
         end
     end)
 end
diff --git a/widget/contrib/tpbat/init.lua b/widget/contrib/tpbat/init.lua
deleted file mode 100644 (file)
index c62acd1..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
---[[
-
-     tpbat.lua
-     Battery status widget for ThinkPad laptops that use SMAPI
-     lain.widget.contrib.tpbat
-
-     More on tp_smapi: http://www.thinkwiki.org/wiki/Tp_smapi
-
-     Licensed under GNU General Public License v2
-      * (c) 2013,      Conor Heine
-      * (c) 2013,      Luca CPZ
-      * (c) 2010-2012, Peter Hofmann
-
---]]
-
-local debug        = { getinfo = debug.getinfo }
-local newtimer     = require("lain.helpers").newtimer
-local first_line   = require("lain.helpers").first_line
-local naughty      = require("naughty")
-local wibox        = require("wibox")
-local string       = { format = string.format }
-local math         = { floor = math.floor }
-local tostring     = tostring
-local setmetatable = setmetatable
-package.path       = debug.getinfo(1,"S").source:match[[^@?(.*[\/])[^\/]-$]] .. "?.lua;" .. package.path
-local smapi        = require("smapi")
-
--- ThinkPad SMAPI-enabled battery info widget
--- lain.widget.contrib.tpbat
-local tpbat = {}
-
-function tpbat.hide()
-    if not tpbat.notification then return end
-    naughty.destroy(tpbat.notification)
-    tpbat.notification = nil
-end
-
-function tpbat.show(t_out)
-    tpbat.hide()
-
-    local bat = tpbat.bat
-
-    if bat == nil or not bat:installed() then return end
-
-    local t_out = t_out or 0
-    local mfgr   = bat:get('manufacturer') or "no_mfgr"
-    local model  = bat:get('model') or "no_model"
-    local chem   = bat:get('chemistry') or "no_chem"
-    local status = bat:get('state') or "nil"
-    local time   = bat:remaining_time()
-    local msg    = "\t"
-
-    if status ~= "idle" and status ~= "nil" then
-        if time == "N/A" then
-            msg = "...Calculating time remaining..."
-        else
-            msg = time .. (status == "charging" and " until charged" or " remaining")
-        end
-    else
-        msg = "On AC Power"
-    end
-
-    local str = string.format("%s : %s %s (%s)\n", bat.name, mfgr, model, chem)
-                .. string.format("\n%s \t\t\t %s", status:upper(), msg)
-
-    tpbat.notification = naughty.notify({
-        text    = str,
-        timeout = t_out,
-        screen  = client.focus and client.focus.screen or 1
-    })
-end
-
-function tpbat.register(args)
-    local args = args or {}
-    local timeout = args.timeout or 30
-    local battery = args.battery or "BAT0"
-    local bat_low_perc = args.bat_low_perc or 15
-    local bat_critical_perc = args.bat_critical_perc or 5
-    local settings = args.settings or function() end
-
-    tpbat.bat = smapi:battery(battery) -- Create a new battery
-    local bat = tpbat.bat
-
-    tpbat.widget = wibox.widget.textbox()
-
-    bat_notification_low_preset = {
-        title = "Battery low",
-        text = "Plug the cable!",
-        timeout = 15,
-        fg = "#202020",
-        bg = "#CDCDCD"
-    }
-
-    bat_notification_critical_preset = {
-        title = "Battery exhausted",
-        text = "Shutdown imminent",
-        timeout = 15,
-        fg = "#000000",
-        bg = "#FFFFFF"
-    }
-
-    if bat:get('state') == nil
-    then
-        local n = naughty.notify({
-            preset = bat_notification_low_preset,
-            title = "SMAPI Battery Warning: Unable to read battery state!",
-            text = "This widget is intended for ThinkPads. Is tp_smapi installed? Check your configs & paths.",
-            screen = client.focus and client.focus.screen or 1
-        })
-    end
-
-    function tpbat.update()
-        bat_now = {
-            status = "Not present",
-            perc   = "N/A",
-            time   = "N/A",
-            watt   = "N/A"
-        }
-
-        if bat:installed()
-        then
-            bat_now.status = bat:status() or "N/A"
-            bat_now.perc   = bat:percent()
-            bat_now.time   = bat:remaining_time()
-            -- bat_now.watt = string.format("%.2fW", (VOLTS * AMPS) / 1e12)
-
-            -- notifications for low and critical states (when discharging)
-            if bat_now.status == "discharging"
-            then
-                if bat_now.perc <= bat_critical_perc
-                then
-                    tpbat.id = naughty.notify({
-                        preset = bat_notification_critical_preset,
-                        replaces_id = tpbat.id,
-                        screen = client.focus and client.focus.screen or 1
-                    }).id
-                elseif bat_now.perc <= bat_low_perc
-                then
-                    tpbat.id = naughty.notify({
-                        preset = bat_notification_low_preset,
-                        replaces_id = tpbat.id,
-                        screen = client.focus and client.focus.screen or 1
-                    }).id
-                end
-            end
-
-            bat_now.perc = tostring(bat_now.perc)
-        end
-
-        widget = tpbat.widget
-
-        settings()
-    end
-
-    newtimer("tpbat-" .. bat.name, timeout, tpbat.update)
-
-    widget:connect_signal('mouse::enter', function () tpbat.show() end)
-    widget:connect_signal('mouse::leave', function () tpbat.hide() end)
-
-    return tpbat
-end
-
-return setmetatable(tpbat, { __call = function(_, ...) return tpbat.register(...) end })
diff --git a/widget/contrib/tpbat/smapi.lua b/widget/contrib/tpbat/smapi.lua
deleted file mode 100644 (file)
index a8867e4..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
---[[
-
-     smapi.lua
-     Interface with thinkpad battery information
-
-     Licensed under GNU General Public License v2
-      * (c) 2013, Conor Heine
-
---]]
-
-local first_line   = require("lain.helpers").first_line
-
-local string       = { format = string.format }
-local tonumber     = tonumber
-local setmetatable = setmetatable
-
-local smapi = {}
-local apipath = "/sys/devices/platform/smapi"
-
--- Most are readable values, but some can be written to (not implemented, yet?)
-local readable = {
-    barcoding                  = true,
-    charging_max_current       = true,
-    charging_max_voltage       = true,
-    chemistry                  = true,
-    current_avg                = true,
-    current_now                = true,
-    cycle_count                = true,
-    design_capacity            = true,
-    design_voltage             = true,
-    dump                       = true,
-    first_use_date             = true,
-    force_discharge            = false,
-    group0_voltage             = true,
-    group1_voltage             = true,
-    group2_voltage             = true,
-    group3_voltage             = true,
-    inhibit_charge_minutes     = false,
-    installed                  = true,
-    last_full_capacity         = true,
-    manufacture_date           = true,
-    manufacturer               = true,
-    model                      = true,
-    power_avg                  = true,
-    power_now                  = true,
-    remaining_capacity         = true,
-    remaining_charging_time    = true,
-    remaining_percent          = true,
-    remaining_percent_error    = true,
-    remaining_running_time     = true,
-    remaining_running_time_now = true,
-    serial                     = true,
-    start_charge_thresh        = false,
-    state                      = true,
-    stop_charge_thresh         = false,
-    temperature                = true,
-    voltage                    = true
-}
-
-function smapi:battery(name)
-    local bat = {}
-
-    bat.name = name
-    bat.path = apipath .. "/" .. name
-
-    function bat:get(item)
-        return self.path ~= nil and readable[item] and first_line(self.path .. "/" .. item) or nil
-    end
-
-    function bat:installed()
-        return self:get("installed") == "1"
-    end
-
-    function bat:status()
-        return self:get('state')
-    end
-
-    -- Remaining time can either be time until battery dies or time until charging completes
-    function bat:remaining_time()
-        local time_val = bat_now.status == 'discharging' and 'remaining_running_time' or 'remaining_charging_time'
-        local mins_left = self:get(time_val)
-
-        if not mins_left:find("^%d+") then return "N/A" end
-
-        local hrs = math.floor(mins_left / 60)
-        local min = mins_left % 60
-
-        return string.format("%02d:%02d", hrs, min)
-    end
-
-    function bat:percent()
-        return tonumber(self:get("remaining_percent"))
-    end
-
-    return setmetatable(bat, {__metatable = false, __newindex = false})
-end
-
-return smapi
index 6c6e77a9cde04826c9fb5bb76f3b3a3f85253c01..81638c280eda1c2539ef9923db8cd2bb76b8ce6e 100644 (file)
@@ -8,9 +8,8 @@
 
 local helpers  = require("lain.helpers")
 local wibox    = require("wibox")
 
 local helpers  = require("lain.helpers")
 local wibox    = require("wibox")
-local math     = { ceil   = math.ceil }
-local string   = { format = string.format,
-                   gmatch = string.gmatch }
+local math     = math
+local string   = string
 local tostring = tostring
 
 -- CPU usage
 local tostring = tostring
 
 -- CPU usage
index 75270f1d3d1780b42f194d2f221dd52f20139195..b3d9dc7d0d65965a1eea3bcb841cedefa763c2cd 100644 (file)
@@ -66,7 +66,7 @@ local function factory(args)
         helpers.async(curl, function(f)
             imap_now = { ["MESSAGES"] = 0, ["RECENT"] = 0, ["UNSEEN"] = 0 }
 
         helpers.async(curl, function(f)
             imap_now = { ["MESSAGES"] = 0, ["RECENT"] = 0, ["UNSEEN"] = 0 }
 
-            for s, d in f:gmatch("(%w+)%s+(%d+)") do imap_now[s] = tonumber(d) end
+            for s,d in f:gmatch("(%w+)%s+(%d+)") do imap_now[s] = tonumber(d) end
             mailcount = imap_now["UNSEEN"] -- backwards compatibility
             widget = imap.widget
 
             mailcount = imap_now["UNSEEN"] -- backwards compatibility
             widget = imap.widget
 
@@ -79,7 +79,8 @@ local function factory(args)
                     text   = string.format("%s has <b>%d</b> new message%s", mail, mailcount, mailcount == 1 and "" or "s")
                 }
             end
                     text   = string.format("%s has <b>%d</b> new message%s", mail, mailcount, mailcount == 1 and "" or "s")
                 }
             end
-            helpers.set_map(mail, mailcount)
+
+            helpers.set_map(mail, imap_now["UNSEEN"])
         end)
 
     end
         end)
 
     end
index ff451797e96924ddac126c435db7311ebdf1ef99..01f28e633e271c0fc617e7af454d2ab4c6732ad7 100644 (file)
@@ -6,16 +6,14 @@
 
 --]]
 
 
 --]]
 
-local helpers      = require("lain.helpers")
-local shell        = require("awful.util").shell
-local escape_f     = require("awful.util").escape
-local focused      = require("awful.screen").focused
-local naughty      = require("naughty")
-local wibox        = require("wibox")
-local os           = { getenv = os.getenv }
-local string       = { format = string.format,
-                       gmatch = string.gmatch,
-                       match  = string.match }
+local helpers  = require("lain.helpers")
+local shell    = require("awful.util").shell
+local escape_f = require("awful.util").escape
+local focused  = require("awful.screen").focused
+local naughty  = require("naughty")
+local wibox    = require("wibox")
+local os       = os
+local string   = string
 
 -- MPD infos
 -- lain.widget.mpd
 
 -- MPD infos
 -- lain.widget.mpd
index 987f047ec3137da0dd15164c5ceff1dd6638ed86..805b5778f1199caad96390e9cf7f4ccc8f548a01 100644 (file)
@@ -9,7 +9,7 @@
 local helpers = require("lain.helpers")
 local naughty = require("naughty")
 local wibox   = require("wibox")
 local helpers = require("lain.helpers")
 local naughty = require("naughty")
 local wibox   = require("wibox")
-local string  = { format = string.format, match = string.match }
+local string  = string
 
 -- Network infos
 -- lain.widget.net
 
 -- Network infos
 -- lain.widget.net
index d37e83aca12e0ab0d2e537118481ae6d85183412..f63fe55c3b146b548a348176b9d05d44112a1796 100644 (file)
@@ -8,10 +8,8 @@
 local helpers = require("lain.helpers")
 local shell   = require("awful.util").shell
 local wibox   = require("wibox")
 local helpers = require("lain.helpers")
 local shell   = require("awful.util").shell
 local wibox   = require("wibox")
-local string  = { gmatch = string.gmatch,
-                  match  = string.match,
-                  format = string.format }
-local type = type
+local string  = string
+local type    = type
 
 -- PulseAudio volume
 -- lain.widget.pulse
 
 -- PulseAudio volume
 -- lain.widget.pulse
index a7c0666d95e5816f9c4867870b402c7bb8fe4acc..317468f46ce6e90c462c670e719ffcbb81825240 100644 (file)
@@ -6,12 +6,14 @@
 
 --]]
 
 
 --]]
 
-local helpers = require("lain.helpers")
-local awful   = require("awful")
-local naughty = require("naughty")
-local wibox   = require("wibox")
-
-local math, string, type, tonumber = math, string, type, tonumber
+local helpers  = require("lain.helpers")
+local awful    = require("awful")
+local naughty  = require("naughty")
+local wibox    = require("wibox")
+local math     = math
+local string   = string
+local type     = type
+local tonumber = tonumber
 
 -- PulseAudio volume bar
 -- lain.widget.pulsebar
 
 -- PulseAudio volume bar
 -- lain.widget.pulsebar
index a9b886a12f9ea3df7774595e8b96c18f00bcb45f..f35ca68b2e72ffb7e6326744197753d117ffcc62 100644 (file)
@@ -10,8 +10,10 @@ local json     = require("lain.util").dkjson
 local focused  = require("awful.screen").focused
 local naughty  = require("naughty")
 local wibox    = require("wibox")
 local focused  = require("awful.screen").focused
 local naughty  = require("naughty")
 local wibox    = require("wibox")
-
-local math, os, string, tonumber = math, os, string, tonumber
+local math     = math
+local os       = os
+local string   = string
+local tonumber = tonumber
 
 -- OpenWeatherMap
 -- current weather and X-days forecast
 
 -- OpenWeatherMap
 -- current weather and X-days forecast
diff --git a/wiki b/wiki
index 39799f8b08f55f567fd3f31db447d35f211bb5ce..f52c9068f4e64effe8a3f38e7531beef3fec3388 160000 (submodule)
--- a/wiki
+++ b/wiki
@@ -1 +1 @@
-Subproject commit 39799f8b08f55f567fd3f31db447d35f211bb5ce
+Subproject commit f52c9068f4e64effe8a3f38e7531beef3fec3388