Implementation of a `z-index`like feature
I create this issue for backlog purposes, so we can keep track of the discussions about this feature. Feel free to close if that's inappropriate.
Extracted from the chat on discord :
Ok, so:
First of all, we really need a good z-index API. It is actually the main blocker of merging the dynamic layout (i3-like) library.
Right now you can emulate the z-index by calling :raise() and :lower() on the clients each time the tag switch. Adding these to the wibox is rather trivial, but I don't think it's exposed in the public API.
But that's a hack. The long term solution is to actually write a fair amount of code into the core to track a mix of client and wibox "stack" per-tag. This API needs to be able to order these object in a predictable and tag-local way, even when multiple tags are visible at the same time. Different tags would need to be able to set a different z-index on the same client. Why? Because that's required for tabs to work. That new API also need to be able to 100% re-implement the current "layer" concept (desktop/below/normal/above/ontop) so configs don't break.
Implementing 2 of these requirements at the same isn't very hard, I made it work before. But I never really managed to get everything to work, scale and have zero impact on user configs.
(I think there was more conversation before, but I couldn't find them in the history)
Refs https://github.com/awesomeWM/awesome/issues/2047#issuecomment-416052926 https://github.com/awesomeWM/awesome/pull/644
There's more conversations out there, mostly in the IRC archives. This has been causing problems for a long time.
One of the very obvious bug with the current system can be reproduced by tagging a client in 2 tags (or any sticky client) and raising it in one tag. Now if any tag has the maximized or magnifier layout, changing 1 tag just messed another tag layout.
Some functions in the API have a stacked parameter which is going to break if we implement proper z-index tracking. Some properties/methods like tag:clients() need to be rewritten in a non-global way. Wiboxes and clients need to be stored in the same data structure in C. We need changes to :raise() / :lower() to change z-index and be able to raise/lower relative to other objects. There are tons of other corner case in the API which would need to be modernized and/or deprecated because they are affected by the global client stacking order mixed with the hardcoded layers.
Sooooo... A lot of work.
Code is in https://github.com/Elv13/awesome-1/tree/2023_xmas_commits, at least most of it. I have been running this branch for most of the year and it works "fine". However this is missing part of the layout API and the damn thing is like 14000 lines of code. Getting this fully finished and ready to be merged/reviewed has been a struggle.