X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/a4e5b806f176c8599c6423ebc2ceb3e6c1aa2be4..b7c3cb77a1ca72ab8fb91c8618f8703e3c1e446c:/widgets/mpd.lua diff --git a/widgets/mpd.lua b/widgets/mpd.lua index 36c3ed7..73efebb 100644 --- a/widgets/mpd.lua +++ b/widgets/mpd.lua @@ -38,19 +38,7 @@ local function worker(args) local mpdcover = helpers.scripts_dir .. "mpdcover" local mpdh = "telnet://" .. host .. ":" .. port - - local echo = nil - - if password == "" then - echo = "(echo -e 'status'; sleep 0.1;" .. - "echo -e 'currentsong'; sleep 0.1;" .. - "echo -e 'close')" - else - echo = "(echo -e 'password " .. password .. "'" .. - "echo -e 'status'; sleep 0.1;" .. - "echo -e 'currentsong'; sleep 0.1;" .. - "echo -e 'close')" - end + local echo = "echo 'password " .. password .. "\nstatus\ncurrentsong\nclose'" mpd.widget = wibox.widget.textbox('') @@ -71,7 +59,7 @@ local function worker(args) date = "N/A" } - local f = io.popen(echo .. " | curl --connect-timeout 1 -fsm 1 " .. mpdh) + local f = io.popen(echo .. " | curl --connect-timeout 1 -fsm 3 " .. mpdh) for line in f:lines() do for k, v in string.gmatch(line, "([%w]+):[%s](.*)$") do @@ -104,7 +92,8 @@ local function worker(args) mpd.id = naughty.notify({ preset = mpd_notification_preset, icon = "/tmp/mpdcover.png", - replaces_id = mpd.id + replaces_id = mpd.id, + screen = client.focus and client.focus.screen or 1 }).id end elseif mpd_now.state ~= "pause"