GTK apps window decorations

Hello, I’d opened a topic ( GTK apps theme problem (Window decorations) ) but while I try to solve the problem I discovered that in fact selected theme for GTK apps really apply. I mean GTK apps colors etc. changes. What doesn’t change and what I want to change is the window decorations. Anybody knows how to change window decorations on GTK apps?

This is expected. GTK apps use their own window decorations. They don’t follow KDE settings. If you want GTK apps to follow KDE settings, use this and this. If you need a Fedora package, give me a few days to build these in my copr.

Thanks for the response. I’d like to try what you offered so I’d appreciate if you could build fedora packages if it wouldn’t be too much hassle. But the thing is, as I explained in more details in my other thread (link in my post), I have another PC with more or less the same configuration. On that pc somehow, window decorations of GTK applications are applied from my chosen theme and I don’t remember applying any sort of patch or something like you suggested. (Same fedora version, same plasma version, same theme, etc. I even compared line by line theme settings files all is identical.) I remember a month back I was using whitesur theme for KDE and GTK apps and GTK apps also had whitesur window decaorations. Then I changed both themes to Relax-Light and GTK apps window decarations changed to Relax-Light. I can’t change anymore on that PC too but nevertheless it’s applied. I don’t know how I had applied. When I delete theme folder of GTK application style theme it goes and returns to default gtk theme and can’t apply back even if restore the theme. I couldn’t figure out inner workings. What do you think?

gtk3-classic has been packaged. gtk4-nocsd is difficult to package, please build from source

Thanks a lot friend. I’ll test the GTK3 package and will try to build GTK4 one when I go back to home.

Two questions.

First, would gtk3-classic possibly result in symbol breakage making GTK3 programs like mousepad only partially usable or not launchable at all? Wouldn’t it make more sense to use gtk3-nocsd?

And how is gtk4-nocsd possible? I thought gtk4 completely removed LD_PRELOAD capabilities.

Yes, if you use the wrong version of gtk. I have patched Fedora’s gtk3 source with gtk3-classic patches.

Regarding mousepad, it is a libxfce4ui app. In order to use it without any breakage, you need gtk3-classic-xfce. I don’t package that

Ask the maintainer

No, gtk doesn’t have the ability to do that. I think glibc can do that, I may be wrong. However, I doubt glibc or the shell or whatever would ever do that.

Hi! Thanks for recommending the library. If I can help with building or using it, feel free to write.

I still use and recommend gtk3-nocsd instead of gtk3-classic, for those that only want the CSD removed from the apps. It works as it should with modern versions of GTK3, on wayland too.

Gtk4-nocsd works in similar ways to the gtk3 counterpart, for regular GTK4 apps it creates a top container where it puts the controls from the CSD, then it uses CSS to hide window controls and make the window have corners and finally unset the decoration from GTK side to remove the padding but set it from the window manager/compositor side to get it back.

For libadwaita the whole rearranging is not needed, since libadwaita does not hide the CSD when the decoration is removed, there only the title text is hidden in that step. (yes, it is easier to remove libadwaita CSD, than regular GTK4 CSD)

A last thing to add, GTK4 hides the xdg toplevel, which functions as a sort of API key on the wayland side. It is only available in a private struct, and the Build.sh script bruteforce mines the location of it, tries each shift by 8 bytes until once the small test app does not crash, then uses that shift to build the library, which then is guaranteed to work only on that nano version (4.20.x, x is nano). It might work later, but there was already one version jump where they rearranged this private struct and it was different. On X there is no such thing and a build is guaranteed to work on later versions

1 Like