UI inside windowhandle acting weird

Hello!

I’m trying to do the equivalent of CSS’s space-between value for justify-content, but with halign & inside a title widget.

This is my widget tree. tabs is what I want on the left, and the last box (GtkWindowHandle) on the right.
image

If I leave them unchanged, this is how they look like.

If I attempt to change halign on tabs to start, I’d expect tabs to be on the left & box on the right, but this is what happens.


Same result if I try to modify the windowhandle (holder of the entire title bar), and if I manually change the margin-end property. The window controls slowly move towards my title widget.

This is what I want to achieve. (the image has been edited)

Am I missing something?

Hi,

How do you populate the Headerbar?

Do you add the “tabs” with Gtk.HeaderBar.pack_start and the windowhandle with Gtk.HeaderBar.pack_end ?

This is how I populate the headerbar:

    let headerbar = gtk::HeaderBar::builder().build();

    let tabs_widget = gtk::Box::builder().css_name("tabs").spacing(6).build();

    let tab1 = make_tab(
        // tabs_widget.clone(),
        "New Tab",
        "file.png",
        cursor_pointer.as_ref(),
        tabs.clone(),
    );

    let current_tab = tab1.clone();

    tabs_widget.append(&tab1.widget);
    tabs_widget.append(&search);

    headerbar.set_title_widget(Some(&tabs_widget));

    window.set_titlebar(Some(&headerbar));

I don’t manually add the window handle

Try replacing
headerbar.set_title_widget(Some(&tabs_widget));
by
headerbar.pack_start(Some(&tabs_widget));

1 Like

let tabs_widget = gtk::Box::builder().css_name("tabs")

Not sure it’s allowed… If you do that, all gtk::Box created thereafter will be named “tabs”…

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