contrib.gpmdp: instantiate in factory

This commit is contained in:
Luke Bonham 2017-04-02 21:28:49 +02:00
parent 8f948b52eb
commit 3a0b51ee57

View file

@ -6,32 +6,28 @@
--]] --]]
local helpers = require("lain.helpers") local helpers = require("lain.helpers")
local json = require("lain.util.dkjson") local json = require("lain.util.dkjson")
local focused = require("awful.screen").focused local focused = require("awful.screen").focused
local pread = require("awful.util").pread local pread = require("awful.util").pread
local naughty = require("naughty") local naughty = require("naughty")
local wibox = require("wibox") local wibox = require("wibox")
local next = next local next, getenv, table = next, os.getenv, table
local os = { getenv = os.getenv }
local table = table
local setmetatable = setmetatable
-- Google Play Music Desktop infos -- Google Play Music Desktop infos
-- lain.widget.contrib.gpmdp -- 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 args = args or {}
local timeout = args.timeout or 2 local timeout = args.timeout or 2
local notify = args.notify or "off" local notify = args.notify or "off"
local followtag = args.followtag or false local followtag = args.followtag or false
local file_location = args.file_location or 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 = { gpmdp_notification_preset = {
title = "Now playing", title = "Now playing",
timeout = 6 timeout = 6
@ -89,4 +85,4 @@ local function factory(args)
return gpmdp return gpmdp
end end
return setmetatable(gpmdp, { __call = function(_, ...) return factory(...) end }) return factory