X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/ddbf283f0ebbc6772d485fe76c5dccf338d3b837..133fe63b85978ac1f21658c5decd66e269261e60:/widgets/mpd.lua diff --git a/widgets/mpd.lua b/widgets/mpd.lua index d92c78f..ddedf24 100644 --- a/widgets/mpd.lua +++ b/widgets/mpd.lua @@ -21,7 +21,7 @@ local setmetatable = setmetatable -- MPD infos -- lain.widgets.mpd -local mpd = helpers.make_widget_textbox() +local mpd = {} local function worker(args) local args = args or {} @@ -41,6 +41,8 @@ local function worker(args) local echo = string.format("printf \"%sstatus\\ncurrentsong\\nclose\\n\"", password) local cmd = string.format("%s | curl --connect-timeout 1 -fsm 3 %s", echo, mpdh) + mpd.widget = wibox.widget.textbox() + mpd_notification_preset = { title = "Now playing", timeout = 6 } helpers.set_map("current mpd track", nil) @@ -110,7 +112,7 @@ local function worker(args) if not string.match(mpd_now.file, "http.*://") then -- local file instead of http stream local path = string.format("%s/%s", music_dir, string.match(mpd_now.file, ".*/")) - local cover = string.format("find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'", path, cover_pattern) + local cover = string.format("find '%s' -maxdepth 1 -type f | egrep -i -m1 '%s'", path:gsub("'", "'\\''"), cover_pattern) helpers.async({ shell, "-c", cover }, function(current_icon) common.icon = current_icon:gsub("\n", "") if #common.icon == 0 then common.icon = nil end