Help with title bar

From what I could understand, you are trying to implement your custom CSD (Client-Side Decoration).

Firefox does it by using, on Linux, GTK components under the hood. Those components are the ones who provide the low-level infrastructure, so their title bar allows for user dragging the window around a DE.

Some other UI frameworks, like SDL, for example, doesn’t provide such infrastructure, as you can look into GNOME gitlab’s issue tracker about their compositor implementing the XDG decoration protocol.

One of the workarounds provided was a library called libdecor, which provides emulated window decoration, meant to be as CSD.

You could:

  • look into Firefox’s codebase, to see how they integrate GTK’s components to allow their titlebar to behave as you describe
  • look into libdecor’s codebase, to see how they issue low-level calls that allow their emulated window decorations to behave as native window decorations
  • Find a way to use libdecor in your project, from my understanding, it allows you to customize the window decoration look-and-feel
  • Take @redstrate suggestion, and look into implementing XDG protocol’s calls. I am not aware if Godot exposes the needed low-level calls to interact with a DE to their scripting engine
  • Ask Godot to provide such features to allow you to implement CSD on your own

Mind that none of these examples involves knowledge of KDE specific features.

KWin (KDE’s compositor) interacts with these UI Toolkit’s through standardized protocols, so there is not much it can provide for your specific request.

I guess there is a misconception on how the needed layers, for what you want to achieve, operate.

What you describe is not KDE specific, and I agree with @redstrate that it is a question better suited towards Godot’s forums or support.