GTK4 - Resized Window Control Buttons

I managed to enlarge the minimize, maximize, and close buttons on Windows 10 and 11 using the following CSS manipulations:


s << "windowcontrols button {outline-offset:1px; padding:0; margin:0; min-width:32px; min-height:32px; border-radius: 0;}\n";
s << "windowcontrols button > image {-gtk-icon-size:24px; font-weight:400; padding:0; margin:0; min-width:24px; min-height:24px;}\n";

However, I noticed that the lines used to draw these buttons became thicker and inconsistent compared to other applications. If the images used for the window control buttons are SVGs (or another scalable format), is there a way to keep the line thickness minimal while increasing the button size?

The attached images show the buttons in a GTK-based app using scaled images, compared to the native buttons in another Windows app.

GTK resized:
GTK

Orig windows:
Win

If we could establish a delegate interface for rendering window control buttons, it would allow for easier and more precise style adjustments compared to just applying CSS. Is something like this available? The idea is that GTK would still manage the button click handling, but if a custom paint handler is provided, it would be called to render the buttons.

No.

Definitely not. “Painting” and event handling cannot be decoupled from widgets, so you can’t have one without the other.

The assets used by GTK are not SVGs: they are “symbolic” PNG (PNG encoded to allow recoloring).

Is there another way to programmatically replace the window control buttons?

You can hide the default buttons with Adw.HeaderBar:show-end-title-buttons , then add instead a GtkBox with custom buttons in there.

Excellent! I’ll implement this. If I have any additional questions, I’ll ask. Otherwise, upon success, I’ll mark this as the solution.

I can finally make them to look ‘more native’ on windows. :smile:

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