5

I've been trying to customize the Elementary GTK3 theme (I'm using elementary OS), and would like to have different padding each for GtkEntry and GtkSearchBar.

I set the padding for all GtkEntry type widgets using:

*.entry {
    padding: 4px 5px 4px 10px;
}

However, this seems to affect both the GtkEntry and GtkSearchBar.
enter image description here
enter image description here

The extra space before the search icon in GtkSearchBar could sure be done without. What I want is, the GtkEntry to have a 10px padding to it's left as shown in the picture, and 4px padding to the left of the GtkSearchBar.

How do I do this? I couldn't find a css selector (like GtkComboBox.combobox-entry .entry) meant specifically for a GtkSearchBar.

2

You can use the following CSS fragment. I added the GtkSearchEntry selector just in case, because the image you posted stinks of it.

GtkEntry {
    padding: 4px 5px 4px 10px;
}
GtkSearchBar GtkEntry, GtkSearchEntry {
    padding: 4px 5px;
}
  • How did you find that? – protoEvangelion Mar 7 '18 at 19:30
  • 1
    @protoEvangelion I don't remember. I think now the appropriate way would be to use entry as selector instead, at least according to the CSS node section of GtkEntry. – ntd Apr 30 '18 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.