awful.tag.object.delete: Add option to force deletion
When this force-argument is not given, the code will refuse to delete a tag which has a non-sticky client. With this force argument, the client will just be moved to the fallback tag. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
962a73c18c
commit
a641d88d4e
|
@ -250,12 +250,14 @@ end
|
||||||
-- @see awful.tag.find_fallback
|
-- @see awful.tag.find_fallback
|
||||||
-- @tparam[opt=awful.tag.find_fallback()] tag fallback_tag Tag to assign
|
-- @tparam[opt=awful.tag.find_fallback()] tag fallback_tag Tag to assign
|
||||||
-- stickied tags to.
|
-- stickied tags to.
|
||||||
|
-- @tparam[opt=false] boolean force Move even non-sticky clients to the fallback
|
||||||
|
-- tag.
|
||||||
-- @return Returns true if the tag is successfully deleted, nil otherwise.
|
-- @return Returns true if the tag is successfully deleted, nil otherwise.
|
||||||
-- If there are no clients exclusively on this tag then delete it. Any
|
-- If there are no clients exclusively on this tag then delete it. Any
|
||||||
-- stickied clients are assigned to the optional 'fallback_tag'.
|
-- stickied clients are assigned to the optional 'fallback_tag'.
|
||||||
-- If after deleting the tag there is no selected tag, try and restore from
|
-- If after deleting the tag there is no selected tag, try and restore from
|
||||||
-- history or select the first tag on the screen.
|
-- history or select the first tag on the screen.
|
||||||
function tag.object.delete(self, fallback_tag)
|
function tag.object.delete(self, fallback_tag, force)
|
||||||
|
|
||||||
-- abort if the taf isn't currently activated
|
-- abort if the taf isn't currently activated
|
||||||
if not self.activated then return end
|
if not self.activated then return end
|
||||||
|
@ -283,7 +285,7 @@ function tag.object.delete(self, fallback_tag)
|
||||||
|
|
||||||
-- If a client has only this tag, or stickied clients with
|
-- If a client has only this tag, or stickied clients with
|
||||||
-- nowhere to go, abort.
|
-- nowhere to go, abort.
|
||||||
if (not c.sticky and nb_tags == 1) then
|
if (not c.sticky and nb_tags == 1 and not force) then
|
||||||
return
|
return
|
||||||
-- If a client has multiple tags, then do not move it to fallback
|
-- If a client has multiple tags, then do not move it to fallback
|
||||||
elseif nb_tags < 2 then
|
elseif nb_tags < 2 then
|
||||||
|
|
Loading…
Reference in New Issue