GTK3 headerbars do I use them or something else?

For reference I am using arc-dark theme.

I want to make something similar to thunar, nemo and most other gtk applications in terms of having the headerbar.

I assume where it says “Help” is the menubar and where it shows Desktop, Untitled Folder and the rest of the buttons such as search button this is part of the Headerbar?

If I am correct I am trying to make something similar but without the menubar, just the headerbar but I am getting this issue

Notice how there is this thin gap between the headerbar and the window border? I am not too sure why this appears for my application but not with thunar (or any other gtk3 applications).

I am using rust with gtk3.

This is my code:

rs
let header_bar = HeaderBar::new();
let vbox = gtk::Box::new(gtk::Orientation::Vertical, 0);

let header_buttons = HeaderButtons
            {
                back: Button::new(),
                forward: Button::new(),
                new: Button::new(),
                delete: Button::new(),
            };

            header_buttons.back.set_image(Some(&Image::from_icon_name(Some("go-previous"), gtk::IconSize::Button)));
            header_buttons.back.set_always_show_image(true);
            header_bar.pack_start(&header_buttons.back);
vbox.pack_start(&header_bar, false, false, 0);
win.add(&vbox);
```

If I replaced:

vbox.pack_start(&header_bar, false, false, 0);
win.add(&vbox);

with:

header_bar.set_show_close_button(true);
win.set_titlebar(Some(&header_bar));

Then it appears like this:

But notice how the window is slightly transparent but other gtk3 applications for their headerbars it is not transparent at all and using the same theme.

I tried using toolbars instead

But color is like the rest of the window.

I am not too sure what the correct way of doing this is when coding this up, I am I supposed to be using headerbars or is there something I need to set?

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.