]> git.madduck.net Git - etc/awesome.git/blobdiff - widget/contrib/gpmdp.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:

Merge pull request #338 from klaernie/master
[etc/awesome.git] / widget / contrib / gpmdp.lua
index ed3aef213012d3cca1131949bdbfcffb0a707617..e9802096885d361b2a0502707baefa41515af602 100644 (file)
@@ -6,32 +6,28 @@
                                                      
 --]]
 
                                                      
 --]]
 
-local helpers      = require("lain.helpers")
-local json         = require("lain.util.dkjson")
-local focused      = require("awful.screen").focused
-local pread        = require("awful.util").pread
-local naughty      = require("naughty")
-local wibox        = require("wibox")
-local next         = next
-local os           = { getenv = os.getenv }
-local table        = table
-local setmetatable = setmetatable
+local helpers             = require("lain.helpers")
+local json                = require("lain.util.dkjson")
+local focused             = require("awful.screen").focused
+local pread               = require("awful.util").pread
+local naughty             = require("naughty")
+local wibox               = require("wibox")
+local next, getenv, table = next, os.getenv, table
 
 -- Google Play Music Desktop infos
 -- lain.widget.contrib.gpmdp
 
 -- Google Play Music Desktop infos
 -- lain.widget.contrib.gpmdp
-local gpmdp = {}
+-- requires: curl
 
 local function factory(args)
 
 local function factory(args)
+    local gpmdp         = { widget = wibox.widget.textbox() }
     local args          = args or {}
     local timeout       = args.timeout or 2
     local notify        = args.notify or "off"
     local followtag     = args.followtag or false
     local file_location = args.file_location or
     local args          = args or {}
     local timeout       = args.timeout or 2
     local notify        = args.notify or "off"
     local followtag     = args.followtag or false
     local file_location = args.file_location or
-                          os.getenv("HOME") .. "/.config/Google Play Music Desktop Player/json_store/playback.json"
+                          getenv("HOME") .. "/.config/Google Play Music Desktop Player/json_store/playback.json"
     local settings      = args.settings or function() end
 
     local settings      = args.settings or function() end
 
-    gpmdp.widget = wibox.widget.textbox()
-
     gpmdp_notification_preset = {
         title   = "Now playing",
         timeout = 6
     gpmdp_notification_preset = {
         title   = "Now playing",
         timeout = 6
@@ -89,4 +85,4 @@ local function factory(args)
     return gpmdp
 end
 
     return gpmdp
 end
 
-return setmetatable(gpmdp, { __call = function(_, ...) return factory(...) end })
+return factory