From 032745d7b205d7377d166063815fc41fc16bea9a Mon Sep 17 00:00:00 2001 From: luke bonham Date: Wed, 27 Mar 2013 22:33:23 +0100 Subject: [PATCH] steamburn: added automatic mpd notification --- rc.lua.steamburn | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/rc.lua.steamburn b/rc.lua.steamburn index 83907c8..c16396a 100755 --- a/rc.lua.steamburn +++ b/rc.lua.steamburn @@ -3,7 +3,7 @@ -- Steamburn Awesome WM 3.5.+ config -- -- github.com/copycat-killer -- -- - ---[[ ]-- +--[[ ]]-- -- Required Libraries @@ -19,7 +19,7 @@ vicious = require("vicious") scratch = require("scratch") --- Autostart function +-- Run once function function run_once(cmd) findme = cmd @@ -30,6 +30,7 @@ function run_once(cmd) awful.util.spawn_with_shell("pgrep -u $USER -x " .. findme .. " > /dev/null || (" .. cmd .. ")") end +-- autostart applications run_once("urxvtd") run_once("unclutter -idle 10") @@ -334,13 +335,16 @@ mygmail:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.uti -- Mpd widget mpdwidget = wibox.widget.textbox() mpdwidget:buttons(awful.util.table.join(awful.button({ }, 1, function () awful.util.spawn_with_shell(musicplr) end))) - +curr_track = nil vicious.register(mpdwidget, vicious.widgets.mpd, function(widget, args) - -- play if (args["{state}"] == "Play") then + if( args["{Title}"] ~= curr_track ) + then + curr_track = args["{Title}"] + run_once("mpdinfo") + end return gray .. args["{Title}"] .. coldef .. white .. " " .. args["{Artist}"] .. coldef - -- pause elseif (args["{state}"] == "Pause") then return gray .. "mpd " .. coldef .. white .. "in pausa" .. coldef else @@ -934,4 +938,3 @@ end) client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -