Hacker News new | ask | show | jobs
by phoneperson 1698 days ago
GTK4 has a LOT of regressions. They decided to remove menus, which is fine, except their replacement is broken https://gitlab.gnome.org/GNOME/gtk/-/issues/3042

As for font rendering, it is kinda broken in gtk3 too. I recently switched to roboto condensed and while qt applications look fine the spacing between letters in gtk3 apps is totally broken.

1 comments

Not sure what you're talking about: Menus haven't gone anywhere. The adwaita theme uses some window decorations to add a shadow, doing this required a compositor. If you don't have a compositor don't use adwaita...
> If you don't have a compositor don't use adwaita...

Can I? I haven't been following GTK+4, but GTK3 managed to break every theme except Adwaita, and the developers were pretty clear that having themes is not a priority for GTK+. There's also this website https://stopthemingmy.app/ which says 'don't theme apps, it breaks them' so it implies we're stuck with Adwaita.

That's not quite accurate, let me try to explain it. GTK3 and GTK4 both support a kind of limited "theming" with CSS, and that hasn't changed. In GTK3 before certain versions, the CSS selectors were unstable, so theme developers were relying on something that was going to break. Even after the CSS selectors have been stabilized, it's only really safe for applications to change those selectors. Third party CSS loaded into a running application will always risk breaking. It was (and still is) safe for applications to load themes besides Adwaita if that's something they tested for, but this has to be something done by the application. Not by a third party theme. That's what that website is talking about.

There was a tweet going around a while ago that I'll try to re-state. Adwaita is not really a "theme" it's more like a CSS framework that you build your app on top of. Trying to swap out the theme is like trying to take a site built for Bootstrap and putting the CSS from Foundation on top of it, you might be able to hack it to sort of get it to work but what you're doing is combining two things which are fundamentally not compatible. Hopefully that helps explain why the method that people were using for third party theming in GTK3 was unreliable.

In GTK4, the Adwaita theme has actually been removed from GTK and moved into libadwaita. That could mean some changes for some things, but not other things. Will all GTK3 apps port to GTK4 and libadwaita? Probably the GNOME ones will, but other apps might not. In that case it would be up to those developers to come up with a solution for theming, they could try to base that on CSS, or they could do something else.

Thanks for the explanation!

> Will all GTK3 apps port to GTK4 and libadwaita? Probably the GNOME ones will, but other apps might not

I have a question. Does it make sense to start new apps with GTK3? E.g. if I want my app to look at home in MATE/Xfce (which currently use GTK+3), and don't want to touch GNOME in any way, does it make sense to write it in GTK+3 (using GTK+2 HIG)?

You can do that, but I don't know if I'd recommend it. You'd have to think about what your requirements for the application are. GTK3 is currently stable but will not gain any new features, and all progress is happening in GTK4. So if you don't need any of the new features then you could use GTK3.

Personally I don't think the look needs to be a major factor in your decision though. If you wanted some new features from GTK4 and wanted it to "look at home", and you really wanted to not use any GNOME APIs, then you could avoid using libadwaita and apply the theme yourself. Libadwaita is only useful if you want to follow the current GNOME HIG. I think if MATE/Xfce want to upgrade from GTK3 they would have to do this eventually anyway, and it would actually probably provide a better experience than GTK3 themes did. Also, GTK never had a HIG. You're thinking of the GNOME HIG, and the GNOME 2 HIG is pretty out dated. I think even MATE/Xfce would want to change some of those things in there that we know don't work well with the benefit of 15-20 years of hindsight.

:/

GtkMenu, GtkMenuBar, and GtkMenuItem are gone so you have to use GtkPopover* instead which has this issue.

I would love to not use adwaita except gtk4 has crippled the ability for users to theme their apps, especially when libadwaita is used. Also gtk3 does not have this issue even with adwaita.

Libadwaita hasn't crippled that, it's still very possible to load CSS. You just can't use the gtk-theme-name setting anymore.

Maybe it would be better if somebody fixed that thing with the menus. But I think IIRC if you wanted transparency in old X11 without a compositor, the toolkit had to copy the region under the popup, and then blit it to the popup... Yes, this meant that content in the transparent region that changed would be stale until the popup went away. So someone would have to decide if that would be a viable solution, or maybe someone could get away with just using the existing XShape stuff in GDK somehow.

How can I load css as a user?

As for the solution, why not remove shadows for non-composing wms?

Any CSS you put in ~/.config/gtk-4.0/gtk.css will load, you can put an @import statement there to load from another file.

The issue is not the shadows, the popup window itself is shaped. All that black region is supposed to be transparent. To fix with CSS you'd have to get rid of the "arrow" and make the corners square. But that may reduce usability of the popover since it no longer "points" to the parent. Maybe it could be positioned inside the popup somehow.

Thanks, will check the css solution.