-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 @jd: Please look below
Am 29.05.2010 01:39, Perry Hargrave wrote: > tag.move_screen(s, t, ft): > Move a tag 't', or selected(), from its current screen to 's'. If > any non-stickied clients are present then move those also. > > Stickied clients are assigned a fallback tag 'ft' or > screen[]:tags()[1]. > > If no tags exist on the originating screen then the stickied client > is moved to the target screen as well. > > Signed-off-by: Perry Hargrave <[email protected]> > --- > lib/awful/tag.lua.in | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 40 insertions(+), 0 deletions(-) > > diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in > index 9046eda..8b0f7c9 100644 > --- a/lib/awful/tag.lua.in > +++ b/lib/awful/tag.lua.in > @@ -104,6 +104,46 @@ function move(new_index, target_tag) > capi.screen[scr]:tags(tmp_tags) > end > > +--- Move a tag to another screen, along with any clients except sticky ones. > +-- @param target_screen The screen number to move TO. integer > +-- @param origin_tag The tag you want to move. tag object [selected()] > +-- @param fallback_tag Tag to apply to stickied clients. [screen:tags[1]] > +-- @return The tag moved or nil > +function move_screen(target_screen, origin_tag, fallback_tag) > + if target_screen < 1 or > + target_screen > capi.screen.count() then return end > + > + -- make sure we have a tag to operate on, then get its origination > + -- screen for assigning tags to sticky clients later > + local origin_tag = origin_tag or selected() > + local origin_screen > + if origin_tag then > + origin_screen = origin_tag.screen > + else > + return > + end > + > + local oscr_tags = capi.screen[origin_screen]:tags() > + > + origin_tag.screen = nil > + > + -- set screen for clients (except sticky ones) > + -- toggle the tag off for sticky clients > + o_clients = origin_tag:clients() > + if #o_clients > 0 then That if serves no purpose, the for loop can handle that case as well. > + for _, c in ipairs(o_clients) do > + if not c.sticky or (c.sticky and #oscr_tags < 2) then > + c.screen = target_screen > + c:tags({origin_tag}) > + else > + c:tags({fallback_tag} or {oscr_tags[1]}) This won't work, use {fallback_tag or oscr_tags[1]} instead of do this once at the beginning of the function: local fallback_tag = fallback_tag or oscr_tags[1] Also, what happens if we are moving oscr_tags[1]? > + end > + end > + end > + origin_tag.screen = target_screen I think you found a bug... If I'm not mistaken, the client will show up on the new screen but it's c.screen property won't be updated. At least I'm not seeing anything in luaA_tag_set_screen() that actually moves the clients to their new screens... I'll investigate in the C core once I find the time Memo to myself: Does anything in luaA_tag_set_screen() make sure the tag is not selected when it shows up on the new screen? If not, do we need to reban? Anyway, this shouldn't really stop this patch. @jd: Am I right here? What is the expected behavior if one changes a tag's screen while the tag still got clients attached? The client could be attached to other tags, that could lead to the being attached to tags on different screens, but tag_client() doesn't seem to protect against that case either. Am I missing something important here? :/ > + return origin_tag > +end > + > --- Create a set of tags and attach it to a screen. > -- @param names The tag name, in a table > -- @param screen The tag screen, or 1 if not set. - -- - - Buck, when, exactly, did you lose your mind? - - Three months ago. I woke up one morning married to a pineapple. An ugly pineapple... But I loved her! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQEcBAEBCAAGBQJMALfPAAoJECLkKOvLj8sGZK0IAM6rN+pWKVHKI8oBFfWNFNov W8+VhN+YXkwsldsjoY/5NlDvE0TLJkKMgBwXCRAMsScA9QboPJG/8mo7SST8eXy1 AJIXx6ZZ8wVWMLHRIZ54ZzWFRg7iUJoeW8aSu/5trZwf2HtSjeKNPHeAgENFn1Lu L8XS1seMObTLB7TROplO8S6LC1TC0IfehGZBLRaU5Hk4TTgycPswBm6jtnEWeh6M BJIAlri2NL8S/Eo9kDZCtkJfXJhDEdoY0HirV6bDhmjSb0SuNg0IOB7NHSfNKWLg OqgGrtUCB41YVQ87wa2u0tYltcHu+sZWkNUTpWM0BbP/jeXnSc7eIA8fR6ar1to= =TIsm -----END PGP SIGNATURE----- -- To unsubscribe, send mail to [email protected].
