X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/8d3868d7ce528cfc075e246c8935bae2724e0868..be69daf9644b137784789878f91b2479c09afc69:/widget/contrib/moc.lua?ds=sidebyside

diff --git a/widget/contrib/moc.lua b/widget/contrib/moc.lua
index fda50fc..027cec3 100644
--- a/widget/contrib/moc.lua
+++ b/widget/contrib/moc.lua
@@ -1,9 +1,8 @@
-
 --[[
-                                                                  
-     Licensed under GNU General Public License v2                 
-      * (c) 2014, anticlockwise <http://github.com/anticlockwise> 
-                                                                  
+
+     Licensed under GNU General Public License v2
+      * (c) 2014, anticlockwise <http://github.com/anticlockwise>
+
 --]]
 
 local helpers      = require("lain.helpers")
@@ -15,13 +14,12 @@ local wibox        = require("wibox")
 local os           = { getenv = os.getenv }
 local string       = { format = string.format,
                        gmatch = string.gmatch }
-local setmetatable = setmetatable
 
 -- MOC audio player
 -- lain.widget.contrib.moc
-local moc = {}
 
-local function worker(args)
+local function factory(args)
+    local moc           = { widget = wibox.widget.textbox() }
     local args          = args or {}
     local timeout       = args.timeout or 2
     local music_dir     = args.music_dir or os.getenv("HOME") .. "/Music"
@@ -31,8 +29,6 @@ local function worker(args)
     local followtag     = args.followtag or false
     local settings      = args.settings or function() end
 
-    moc.widget = wibox.widget.textbox()
-
     moc_notification_preset = { title = "Now playing", timeout = 6 }
 
     helpers.set_map("current moc track", nil)
@@ -98,4 +94,4 @@ local function worker(args)
     return moc
 end
 
-return setmetatable(moc, { __call = function(_, ...) return worker(...) end })
+return factory