From dfaef973c37c0fdb53ff2ca0d28ebf0ee4517ef5 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 13 Oct 2014 15:19:14 -0400 Subject: [PATCH] Add awful.tag.swap --- lib/awful/tag.lua.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 58b0a344..af487172 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -61,6 +61,18 @@ function tag.move(new_index, target_tag) end end +--- Swap 2 tags +-- @param tag1 The first tag +-- @param tag2 The second tag +function tag.swap(tag1,tag2) + local idx1, idx2 = tag.getidx(tag1),tag.getidx(tag2) + local src2, src1 = tag.getscreen(tag2),tag.getscreen(tag1) + tag.setscreen(tag2,src1) + tag.move(idx1,tag2) + tag.setscreen(tag1,scr2) + tag.move(idx2,tag1) +end + --- Add a tag. -- @param name The tag name, a string -- @param props The tags properties, a table