Skip to content

Instantly share code, notes, and snippets.

@blueyed
Created March 29, 2014 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blueyed/9858358 to your computer and use it in GitHub Desktop.
Save blueyed/9858358 to your computer and use it in GitHub Desktop.
-- Autohide tags with no clients. {{{
-- Based on eminent (https://github.com/guotsuan/eminent), without monkey-patching viewidx.
local function autohidetags(screen)
for k, t in ipairs(awful.tag.gettags(screen)) do
if t.selected or #t:clients() > 0 then
awful.tag.setproperty(t, "hide", false)
else
awful.tag.setproperty(t, "hide", true)
end
end
end
-- Callback for signals to update hidden status.
local function uc(c) autohidetags(c.screen) end
local function ut(s,t) autohidetags(s.index) end
capi.client.connect_signal("unmanage", uc)
capi.client.connect_signal("new", function(c)
c:connect_signal("property::screen", uc)
-- c:connect_signal("property::urgent", uc)
c:connect_signal("tagged", uc)
c:connect_signal("untagged", uc)
-- c:connect_signal("focus", uc)
-- c:connect_signal("unfocus", uc)
end)
for screen=1, capi.screen.count() do
awful.tag.attached_connect_signal(screen, "property::selected", ut)
-- awful.tag.attached_connect_signal(screen, "property::icon", ut)
-- awful.tag.attached_connect_signal(screen, "property::hide", ut)
-- awful.tag.attached_connect_signal(screen, "property::name", ut)
awful.tag.attached_connect_signal(screen, "property::activated", ut)
awful.tag.attached_connect_signal(screen, "property::screen", ut)
-- awful.tag.attached_connect_signal(screen, "property::index", ut)
--awful.tag.attached_connect_signal(screen, "tag::history::update",uc)
capi.screen[screen]:connect_signal("tag::history::update", ut)
-- --capi.screen[screen]:connect_signal("tag::detach", ut)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment