Skip to content

Commit

Permalink
shifty: fusion delete/rename tag function
Browse files Browse the repository at this point in the history
When a tag is empty, delete it, otherwise, rename it.
  • Loading branch information
vincentbernat committed Jun 14, 2015
1 parent b2da623 commit e17f7b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/shifty.lua
Expand Up @@ -449,7 +449,7 @@ function del(tag)
for i, c in ipairs(clients) do
if c.sticky then sticky = sticky + 1 end
end
if #clients > sticky then return end
if #clients > sticky then return false end

-- store index for later
index_cache[scr][getname(t)] = idx
Expand All @@ -469,6 +469,7 @@ function del(tag)

-- FIXME: what is this for??
if capi.client.focus then capi.client.focus:raise() end
return true
end

--is_client_tagged : replicate behavior in tag.c - returns true if the
Expand Down
10 changes: 8 additions & 2 deletions rc/tags.lua
Expand Up @@ -93,6 +93,12 @@ shifty.config.defaults = {
shifty.taglist = config.taglist -- Set in widget.lua
shifty.init()

local tag_del_or_rename = function(tag)
if not shifty.del(tag) then
shifty.rename(tag)
end
end

config.keys.global = awful.util.table.join(
config.keys.global,
keydoc.group("Tag management"),
Expand Down Expand Up @@ -121,8 +127,8 @@ config.keys.global = awful.util.table.join(
end,
"Send all tags to next screen"),
awful.key({ modkey }, 0, shifty.add, "Create a new tag"),
awful.key({ modkey, "Shift" }, 0, shifty.del, "Delete tag"),
awful.key({ modkey, "Control" }, 0, shifty.rename, "Rename tag"))
awful.key({ modkey, "Shift" }, 0, tag_del_or_rename),
awful.key({ modkey, "Control" }, 0, tag_del_or_rename, "Rename or delete tag"))

-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
Expand Down

0 comments on commit e17f7b8

Please sign in to comment.