rustwindowgtkgtk4gtk-rs

(gtk4-rs) How to remove titlebar from window


I recently started using GTK4 with gtk-rs for an application I am creating. I don't like the way the default titlebar ever looks, and I want to remove it. I want to keep the other decorations, such as the edges of the window, the traffic-lights, etc, but I don't like the titlebar. I have my own ideas for a titlebar I want to implement. How do I remove this using gtk-rs with GTK4?

I have looked into using CSS, but none of that is making sense. Other GUI systems tend to have their own settings for the Window object, such as Electron and Tauri. I also tried looking into these settings, but couldn't find anything.


Solution

  • GtkWindow has a method set_titlebar() which you can call with either None or with your own custom titlebar widget.