]> 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:

base: update subfuction added; contrib/brightness removed because now redundant
authorluke bonham <dadasignificanulla@gmail.com>
Thu, 13 Feb 2014 17:17:48 +0000 (18:17 +0100)
committercopycat-killer <dada@archlinux.info>
Wed, 5 Aug 2015 11:30:38 +0000 (13:30 +0200)
widgets/base.lua
widgets/contrib/brightness.lua [deleted file]
wiki

index 0431d03a8891f15696ff674aa47e501cf7a86b2a..198b6f71c124c0d141709f61e11bc1d5c3ac2f5c 100644 (file)
@@ -12,7 +12,7 @@ local wibox        = require("wibox")
 local io           = io
 local setmetatable = setmetatable
 
--- Basic template for simple widgets 
+-- Basic template for custom widgets 
 -- lain.widgets.base
 local base = {}
 
@@ -24,14 +24,17 @@ local function worker(args)
 
     base.widget = wibox.widget.textbox('')
 
-    function update()
-        output = io.popen(cmd):read("*all")
+    function base.update()
+        local f = assert(io.popen(cmd))
+        output = f:read("*all")
+        f:close()
         widget = base.widget
         settings()
     end
 
     newtimer(cmd, timeout, update)
-    return base.widget
+
+    return setmetatable(base, { __index = base.widget })
 end
 
 return setmetatable(base, { __call = function(_, ...) return worker(...) end })
diff --git a/widgets/contrib/brightness.lua b/widgets/contrib/brightness.lua
deleted file mode 100644 (file)
index 04b8d2b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-
---[[
-                                                   
-     Licensed under GNU General Public License v2  
-      * (c) 2013, yawnt <yawn.localhost@gmail.com> 
-                                                   
---]]
-
-local newtimer        = require("lain.helpers").newtimer
-
-local wibox           = require("wibox")
-local io              = { popen  = io.popen }
-
-local setmetatable    = setmetatable
-
--- Brightness level
--- lain.widgets.contrib.brightness
-local brightness = {}
-
-local function worker(args)
-    local args      = args or {}
-    local backlight = args.backlight or "acpi_video0"
-    local timeout   = args.timeout or 5
-    local settings  = args.settings or function() end
-
-    brightness.widget = wibox.widget.textbox('')
-
-    function brightness.update()
-        local f = assert(io.popen('cat /sys/class/backlight/' .. backlight .. "/brightness"))
-        brightness_now = f:read("*a")
-        f:close()
-
-        widget = brightness.widget
-        settings()
-    end
-
-    newtimer("brightness", timeout, brightness.update)
-
-    return setmetatable(brightness, { __index = brightness.widget })
-end
-
-return setmetatable(brightness, { __call = function(_, ...) return worker(...) end })
diff --git a/wiki b/wiki
index 60754084cf7bb69d7387484e12fa686c73cfe1bc..b56a779e276987cb9f8f8d81785d35633db047d1 160000 (submodule)
--- a/wiki
+++ b/wiki
@@ -1 +1 @@
-Subproject commit 60754084cf7bb69d7387484e12fa686c73cfe1bc
+Subproject commit b56a779e276987cb9f8f8d81785d35633db047d1