2013-09-15 20:00:40 +00:00
|
|
|
------------------------------------------
|
|
|
|
-- Effortless wmii-style dynamic tagging.
|
|
|
|
------------------------------------------
|
|
|
|
-- Lucas de Vries <lucas@glacicle.org>
|
|
|
|
-- Licensed under the WTFPL version 2
|
|
|
|
-- * http://sam.zoy.org/wtfpl/COPYING
|
|
|
|
-----------------------------------------
|
|
|
|
-- Cut version
|
|
|
|
-----------------------------------------
|
|
|
|
|
|
|
|
-- Grab environment
|
|
|
|
local ipairs = ipairs
|
2015-07-03 10:17:54 +00:00
|
|
|
local awful = require("awful")
|
|
|
|
local table = table
|
|
|
|
local capi = {
|
2013-09-15 20:00:40 +00:00
|
|
|
screen = screen,
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Eminent: Effortless wmii-style dynamic tagging
|
|
|
|
module("eminent")
|
|
|
|
|
|
|
|
-- Grab the original functions we're replacing
|
|
|
|
local deflayout = nil
|
|
|
|
local orig = {
|
2015-07-03 10:17:54 +00:00
|
|
|
new = awful.tag.new,
|
2013-09-15 20:00:40 +00:00
|
|
|
taglist = awful.widget.taglist.new,
|
2015-07-03 10:17:54 +00:00
|
|
|
filter = awful.widget.taglist.filter.all,
|
2013-09-15 20:00:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
-- 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
|