Love for wayland
About
So ive been rewriting my wayland compositor finally, and I never really thought about it but the design behind wayland's LayerSurface stuff is a really smart way of dealing with what it does.
For the uninitated, there are 4 layers (4 mandatory ones in the spec, but you can make more for your own use)
- background
- decoration-back
- decoration-front
- foreground
and then the windows go in the middle of the decoration, decoration layers have to be reserved and surfaces open on them take up window space. So like a task bar goes in decoration front, your wallpaper goes in background, window borders in decoration front, shadows can be in decoration back.
Whats really nice about this is that it allows for a ton of cool features you'd want, and it just flat out is in the api so if your compositor supports these properly any program that has any feature that uses this is compatible with your compositor. Not only that but since layer surfaces are unaware of their position if you have 2 bars, they are positioned, and avoided by the compositor.
Honestly the whole of wayland is one of those specs that can tell the sheer magnatude of work put in the design. I mean just the wording of api is pretty heavily designed off of a video compositor which are quite well worked on. So alot of the terminology is pretty easy to pick up and the docs don't have any really wild terms that are specific to wayland.
Realized Im grouping waylandroots in with wayland in this rant so some features are actually wayland roots, but still applies
honestly this might just be that ive only used the x11 api for this type of thing, and there is no well used c api ive ever used thats aged worse than that
For the uninitated, there are 4 layers (4 mandatory ones in the spec, but you can make more for your own use)
- background
- decoration-back
- decoration-front
- foreground
and then the windows go in the middle of the decoration, decoration layers have to be reserved and surfaces open on them take up window space. So like a task bar goes in decoration front, your wallpaper goes in background, window borders in decoration front, shadows can be in decoration back.
Whats really nice about this is that it allows for a ton of cool features you'd want, and it just flat out is in the api so if your compositor supports these properly any program that has any feature that uses this is compatible with your compositor. Not only that but since layer surfaces are unaware of their position if you have 2 bars, they are positioned, and avoided by the compositor.
Honestly the whole of wayland is one of those specs that can tell the sheer magnatude of work put in the design. I mean just the wording of api is pretty heavily designed off of a video compositor which are quite well worked on. So alot of the terminology is pretty easy to pick up and the docs don't have any really wild terms that are specific to wayland.
Realized Im grouping waylandroots in with wayland in this rant so some features are actually wayland roots, but still applies
honestly this might just be that ive only used the x11 api for this type of thing, and there is no well used c api ive ever used thats aged worse than that
Links
Last Modified 2025 06/19