Custom Window Decorations on Linux

Hi!

What’s the correct way to handle custom window decorations on Linux with glfw? (Both under X11 and Wayland)

Currently, implementing these is very platform dependent. For example, on Windows I’m using a custom windowProc function to handle Aero and draw window shadows on a borderless window. On macOS, I’m using a regular window but use Apple’s cocoa API to make the title bar transparent and move it into the client area.
On Linux however, I can’t seem to find a proper way to do it. From what I can tell, glfw uses libdecor to draw the decoration client sided but there’s no way to customize it I believe.

My goal is to achieve something similar to this, just on Linux. Resizing, moving and drawing of the window border/shadow being handled by libdecor but drawing the title bar ourselves.

Hi!

I didn’t initially answer this as I’m not that familiar with Wayland decorations, however given no-one else has responded I think the initial place to look at might be the fallback decorations GLFW uses:

Perhaps there might be some way to combine this with an undecorated GLFW window, drawing these decorations over the client area?

1 Like