Traverse client focus across tags

Johannes Jordan jordan at lanrules.de
Mon Feb 8 13:14:19 CET 2021


Hello,

For starters, the binary tree of frames is exposed starting with 
_tags.focus.tiling.root_. So you may reverse this node an its children 
to get the whole frame tree, e.g. you might end up having
  - tags.focus.tiling.root.0.0
  - tags.focus.tiling.root.0.1.0
  - tags.focus.tiling.root.0.1.1
  - tags.focus.tiling.root.1

Furthermore, each frame (accessible by _clients.focus.parent_frame_) has 
attribute _index_ (string) which represents the position in the tree.
E.g. "010" means we are in frame _tags.focus.tiling.root.0.1.0_.

Now let's tie this together: The left-most leaf of the tree will have no 
character  "1" in its _index_ attribute. If there is only a single frame 
on the tag, it will be "". Otherwise, it might be "0", or "00", or 
"000", etc.
At the same time, the right-most leaf of the tree will always have index 
"", or "1", or "11", etc.

tl;dr: Your client is in the "last or only frame on a tag" when
 > herbstclient attr clients.focus.parent_frame.index
returns a value that matches regex
 > 1*

Please let me know whether this helps.


Johannes

8 Feb. 2021 12:45:38 doa379 <doa379 at gmail.com>:

> Is there a way to traverse focus of clients across tags? Sort of like
> cycle_all +- 1. However I would like the scope of clients to not just be
> limited to the current tag.
> 
> Alternatively, how can I determine if a frame is the last or only frame
> on a tag? That way I can use a wrapper for cycle_all to intercept the
> last client on the tag and move to the next tag.
> 
> I would appreciate any suggestions.



More information about the hlwm mailing list