]> git.madduck.net Git - etc/awesome.git/blobdiff - widgets/net.lua

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:

version 1.0
[etc/awesome.git] / widgets / net.lua
index f361146d0d72d5303bb2868114ff591c8e7622cc..18727f1156071c66d4f463b78b9dd34b11d39252 100644 (file)
@@ -29,7 +29,7 @@ local net = {
     last_r = {}
 }
 
-local unit = {
+net.units = {
     ["b"] = 1,
     ["kb"] = 1024,
     ["mb"] = 1024^2,
@@ -52,12 +52,12 @@ function worker(args)
     local args = args or {}
     local iface = args.iface or net.get_device()
     local delta = args.refresh_timeout or 2
-    local unit = args.unit or unit["kb"]
+    local units = args.units or net.units["kb"]
     local spr = args.spr or " "
     local header = args.header or iface
     local header_color = args.header_color or beautiful.fg_normal or "#FFFFFF"
-    local color_up = args.color_up or beautiful.fg_focus or header_color
-    local color_down = args.color_down or beautiful.fg_focus or header_color
+    local color_up = args.color_up or beautiful.fg_focus or "#FFFFFF"
+    local color_down = args.color_down or beautiful.fg_focus or "#FFFFFF"
     local app = args.app or "sudo wifi-menu"
 
     helpers.set_map(iface, true)
@@ -113,8 +113,8 @@ function worker(args)
 
         if net.last_t[iface] and net.last_t[iface]
         then
-            net.send = tostring((now_t - net.last_t[iface]) / delta / unit)
-            net.recv = tostring((now_r - net.last_r[iface]) / delta / unit)
+            net.send = tostring((now_t - net.last_t[iface]) / delta / units)
+            net.recv = tostring((now_r - net.last_r[iface]) / delta / units)
 
             text = text
                    .. '<span color="' .. color_up .. '">'