Can I change how a particular widget is themed based on a GObject property?

I’m working on a theme which adds padding to the notebook widget to allow room for rounded corners. This is due to the fact that frames do not clip their children:

https://gitlab.gnome.org/GNOME/gtk/issues/2075

Therefore I need to add padding. However, I only want padding if tabs are visible. Otherwise it’s just a frame within a frame which looks silly:

image

Is there a way to set padding for notebook widgets based on whether its tabs are visible?

For example:

notebook (with tabs) {
   padding:10px;
}

notebook (without tabs) {
   padding:0px;
}

This is how notebooks worked in GTK2. Can this be done in GTK3?

Hi

This is due to the fact that frames do not clip their children:

You could use a GtkViewport.

Therefore I need to add padding.

Why not GtkAlignment?

Is there a way to set padding for notebook widgets based on whether its tabs are visible?

I think it has a minimum size and you should use a viewport, especially using GtkPaned.

Bests,
Joël

Hello. This question is regarding the modification of a global theme for GTK3 and not about writing an application. The image in my post is of MATE Pluma.

Here you are:

https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-theme-name

Anyhow, you should respect the widget’s allocation, use a GtkViewport.

GObject properties are not style properties, so they cannot be accessed in CSS.

The CSS elements for GtkNotebook are documented, so you can check if the tabs selector is available and style things accordingly.

How can I style notebook {} by testing for the presence of notebook > header > tabs {}?