From d1c73522c616ae934e1612a630ca0e5dd6a1960a Mon Sep 17 00:00:00 2001 From: luke bonham Date: Sun, 15 Sep 2013 22:00:40 +0200 Subject: [PATCH] holo: mpd update --- eminent/init.lua | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ rc.lua.holo | 8 +++---- 2 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 eminent/init.lua diff --git a/eminent/init.lua b/eminent/init.lua new file mode 100644 index 0000000..0b45a30 --- /dev/null +++ b/eminent/init.lua @@ -0,0 +1,57 @@ +------------------------------------------ +-- Effortless wmii-style dynamic tagging. +------------------------------------------ +-- Lucas de Vries +-- Licensed under the WTFPL version 2 +-- * http://sam.zoy.org/wtfpl/COPYING +----------------------------------------- +-- Cut version +----------------------------------------- + +-- Grab environment +local ipairs = ipairs +local awful = require("awful") +local table = table +local capi = { + screen = screen, +} + +-- Eminent: Effortless wmii-style dynamic tagging +module("eminent") + +-- Grab the original functions we're replacing +local deflayout = nil +local orig = { + new = awful.tag.new, + taglist = awful.widget.taglist.new, + filter = awful.widget.taglist.filter.all, +} + +-- Return tags with stuff on them, mark others hidden +function gettags(screen) + local tags = {} + + for k, t in ipairs(capi.screen[screen]:tags()) do + if t.selected or #t:clients() > 0 then + awful.tag.setproperty(t, "hide", false) + table.insert(tags, t) + else + awful.tag.setproperty(t, "hide", true) + end + end + + return tags +end + +-- Pre-create tags +awful.tag.new = function (names, screen, layout) + deflayout = layout and layout[1] or layout + return orig.new(names, screen, layout) +end + +-- Taglist label functions +awful.widget.taglist.filter.all = function (t, args) + if t.selected or #t:clients() > 0 then + return orig.filter(t, args) + end +end diff --git a/rc.lua.holo b/rc.lua.holo index cce17ae..d466b39 100755 --- a/rc.lua.holo +++ b/rc.lua.holo @@ -202,23 +202,23 @@ function () awful.util.spawn_with_shell(musicplr) end))) prev_icon:buttons(awful.util.table.join(awful.button({}, 1, function () awful.util.spawn_with_shell("mpc prev || ncmpcpp prev || ncmpc prev || pms prev") - mpdwidget.notify() + mpdwidget.update() end))) next_icon:buttons(awful.util.table.join(awful.button({}, 1, function () awful.util.spawn_with_shell("mpc next || ncmpcpp next || ncmpc next || pms next") - mpdwidget.notify() + mpdwidget.update() end))) stop_icon:buttons(awful.util.table.join(awful.button({}, 1, function () play_pause_icon:set_image(beautiful.play) awful.util.spawn_with_shell("mpc stop || ncmpcpp stop || ncmpc stop || pms stop") - mpdwidget.notify() + mpdwidget.update() end))) play_pause_icon:buttons(awful.util.table.join(awful.button({}, 1, function () awful.util.spawn_with_shell("mpc toggle || ncmpcpp toggle || ncmpc toggle || pms toggle") - mpdwidget.notify() + mpdwidget.update() end))) -- Battery