mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-30 05:14:22 +02:00
shifty: fusion delete/rename tag function
When a tag is empty, delete it, otherwise, rename it.
This commit is contained in:
parent
b2da623de0
commit
e17f7b879c
2 changed files with 10 additions and 3 deletions
|
@ -449,7 +449,7 @@ function del(tag)
|
||||||
for i, c in ipairs(clients) do
|
for i, c in ipairs(clients) do
|
||||||
if c.sticky then sticky = sticky + 1 end
|
if c.sticky then sticky = sticky + 1 end
|
||||||
end
|
end
|
||||||
if #clients > sticky then return end
|
if #clients > sticky then return false end
|
||||||
|
|
||||||
-- store index for later
|
-- store index for later
|
||||||
index_cache[scr][getname(t)] = idx
|
index_cache[scr][getname(t)] = idx
|
||||||
|
@ -469,6 +469,7 @@ function del(tag)
|
||||||
|
|
||||||
-- FIXME: what is this for??
|
-- FIXME: what is this for??
|
||||||
if capi.client.focus then capi.client.focus:raise() end
|
if capi.client.focus then capi.client.focus:raise() end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--is_client_tagged : replicate behavior in tag.c - returns true if the
|
--is_client_tagged : replicate behavior in tag.c - returns true if the
|
||||||
|
|
10
rc/tags.lua
10
rc/tags.lua
|
@ -93,6 +93,12 @@ shifty.config.defaults = {
|
||||||
shifty.taglist = config.taglist -- Set in widget.lua
|
shifty.taglist = config.taglist -- Set in widget.lua
|
||||||
shifty.init()
|
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 = awful.util.table.join(
|
||||||
config.keys.global,
|
config.keys.global,
|
||||||
keydoc.group("Tag management"),
|
keydoc.group("Tag management"),
|
||||||
|
@ -121,8 +127,8 @@ config.keys.global = awful.util.table.join(
|
||||||
end,
|
end,
|
||||||
"Send all tags to next screen"),
|
"Send all tags to next screen"),
|
||||||
awful.key({ modkey }, 0, shifty.add, "Create a new tag"),
|
awful.key({ modkey }, 0, shifty.add, "Create a new tag"),
|
||||||
awful.key({ modkey, "Shift" }, 0, shifty.del, "Delete tag"),
|
awful.key({ modkey, "Shift" }, 0, tag_del_or_rename),
|
||||||
awful.key({ modkey, "Control" }, 0, shifty.rename, "Rename tag"))
|
awful.key({ modkey, "Control" }, 0, tag_del_or_rename, "Rename or delete tag"))
|
||||||
|
|
||||||
-- Bind all key numbers to tags.
|
-- Bind all key numbers to tags.
|
||||||
-- Be careful: we use keycodes to make it works on any keyboard layout.
|
-- Be careful: we use keycodes to make it works on any keyboard layout.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue