Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stylizing GtkNotebook Tabs in Theme (gtkrc)
#1
Hello,

I actually subscribed to ask you guys this, but frankly I don't know if this is the right forum. If not, I would appreciate some pointers to the right place(s). Thanks in advance.

Long story short (and for the name of the loving God) I cannot find which widget corresponds to the tabs of a GtkNotebook in the gtkrc file (and hence to the GimpDockbook, since according to the docs it inherits the styles of the GtkNotebook).

With lots of trial & error attempts, I figured that the widget_class "*<GtkNotebook>.<GtkWidget>.<GtkLabel>" affects the labels of the tabs (their text title) but what I'm after is how to highlight the active tab, as shown in the Gtk2 docshttps://developer.gnome.org/gtk2/stable/notebook.png (that little blue stripe, at the top of the active tab)

Btw, the full docs are here: https://developer.gnome.org/gtk2/stable/...ebook.html

I can colorize the actual pane of the active tab (the white area in the image above), as well as the background color of the inactive tabs., But I cannot find how to make that little highlight at the top of the active tab.

The funny thing is that I had done that, like 6 years ago, in a collection of themes for Gimp 2.8 I had released on DeviantArt. I had many requests to update them for v2.10.1x, which I kindly declined, because I have never dealt with the GTK2 theming engine since then.

However, like a week ago, I decided to give it a go (using Gimp 2.10.18) but I found that things I've done in the old themes do not work now (most probably because GTK+2 has evolved since then and/or because newer versions of Gimp probably use some things differently).

I've almost finished a Dark theme for Gimp 2.10.18, for which btw, v2.10.20 broke the ComboBox drop-down lists style. Most notably the appears-as-list property (which has been reported as problematic and it's deprecated in GTK3). In Gimp 2.10.18, with that property set to FALSE, all ComboBox drop-down lists were using the styles of the menus, so they were looking like popup menus. You know, the ones with the scrolling butons at their top and bottom, like the list of the layer Blend Modes in v2.10.18. In Gimp 2.10.20, regardless of how I set the "appears-as-list" property, all ComboBox drop-down lists look like regular TreeView lists, and once again I cannot find how to disable the border/shadow around the popup: https://prnt.sc/sz5e7a

So, that's a second thing I would like to know how to solve, if possible.

I've tested Gimp 2.10.20's default dark theme, and I confirmed that indeed the layer Blend Modes list has been brought back to be a regular list (its appears-as-list property is set to FALSE, but changing it to TRUE doesn't make any difference, just like it doesn't with my theme anymore). The reason it looks as a popup menu is because the default themes overlay everything with images (found in the ./ui/ folder). I guess going for uniform looks across different OSes, so menus and TreeView lists are both using the same background image. But if you look for it you will see that in Gimp 2.10.20 the layer Blend Modes list does NOT have top & bottom scrolling buttons. Instead, it uses a regular vertical scrollbar, so it is a just a list.

Please excuse my long post, I tried to be as precise as I could, about my questions. Once again, if you know a better place I should ask, please let me know.

Greetings to all!
Reply
#2
I'll have a look at my previous experiments with themes to see if I found anything about the tabs, although I think I was using images rather than just style settings.
Reply
#3
Thank you Kevin, I would appreciate it!

Even with images, there should be a distinct widget assignment for that little highlight stripe at the top of the active tab (although the engine might have it's own semantics for it)

In any case, I'd like to avoid images because they make it harder and way more cumbersome to change colors (since one would need to re-colorize the images too).

For example, in my previous themes I was offering different highlight colors for the same base theme, and it was only a matter of changing the value of a symbolic color definition in the gtkrc file. With images, I would have to create new images for all categories of highligted elements.

Actually, I have already ditched almost all images used by the default theme. I do realize that it "breaks" the uniform looks across different OSes, but frankly I much prefer the flexibility I get without them.
Reply
#4
I don't see anything that would create the highlight at the top of the tab without using images, or using an engine that is built to do that.

The GTK code I've looked at just draws six lines when it's drawing an extension and makes no allowance for anything other than the content (label and or icon) and the curvature/focus-line-width/xthickness/ythickness padding.
Reply
#5
Thank you very much for your time Kevin!

And you are absolutely right (I had no idea you would look at the code... so much appreciated!)

I switched back to the Clearlooks enigine, and the darn thing finally showed up! I am scratching the work I did this past week or so with the pixmap engine, and I will update the existed themes so they look good in Gimp 2.10.1x (actually I've started already doing that).

So, the image they show on the GtkNotebook docs page, showing that hint-stripe, is most probably using the Clearlooks engine (it was the Gnome preferred engine, before they switch to Adwaita I think) .

Once again, thank you very much!
Reply
#6
Bear in mind that the Windows version of GIMP only ships with pixmap and wimp engines so you are limiting your potential market.

Let us know when you've got something to try.
Reply
#7
Yes, I know.

I'll bundle the Clearlooks.dll with the themes, like I did with the previous ones. Also, Linux people would probably have to install the gtk2-engine-clearlooks pack, since AFAIK many Linux distros are GTK3 only (although there is a GTK3 port, called clearlooks-phoenix... but I'm not using Linux anymore, so I don't really know what is going on currently in the Linux arena).

I definitely let you guys know, thank you! Actually, if things go as planned, I will probably have something ready for testing later today (or tomorrow). Here is how the Darker Blue Small looks like so far: http://prntscr.com/t0rzts
Reply
#8
Ok guys, here it is. I am attaching a zip file, containing the regular and the small variants of the Dark (Blue Hint) theme


.zip   Clearlooks_Gimp_2.10.1x_Hinted_Themes_RC1.1.zip (Size: 213.99 KB / Downloads: 240)


[Image: KntYOUq.jpg]

First things first! If, for whatever reason, the theme crashes Gimp, just rename the gtkrc file in the theme's folder (say, rename it to gtkrc-off) and re-launch Gimp. It will open with the default theme, and you can switch to another theme (Edit -> Preferences | Theme).

The included Readme file talks about 20 theme variants in total, but I haven't done those yet. Well the hint-color variants are dead easy to make. Just make copies of the desired theme folder and edit the Current Highlight Color line in the gtkrc file. It already contains 5 colors (commented out), but feel free to set any other you want.

If you have a 4K monitor, you should probably increase the font-size. Actually have a look at the "USAGE TIPS: EDITING THE gtkrc FILE" section in the Readme file, for a few more easy tweaks you can do in the gtkrc file.

The zip file also contains the Clearlooks GTK2 theme-engine for Windows, as a separate zip-file (both x64 and x86). One only needs to copy the appropriate libclearlooks.dll file into: C:\Program Files\GIMP 2\lib\gtk-2.0\2.10.0\engines\ (or C:\Program Files (x86) \GIMP 2\lib\gtk-2.0\2.10.0\engines\ for 32-bit Windows)

If you are on Linux, without GTK2 installed, you can first install GTK2 and then install the gtk2-engines-clearlooks package, or the gtk2-engines package (whichever is available for your distro). The latter contains more GTK2 engines too, besides Clearlooks.

If you do NOT want to install GTK2 on your system, and prefer to use Gimp's GTK2 runtime instead, you can try to download any of the above mentioned packages (make sure they are for your specific Linux distro, unpack it to a temp folder, and look for the libclearlooks.so file. Then copy it into:  [whichever dir GIMP is installed in]/lib/gtk-2.0/2.10.0/engines/

Try here:  https://pkgs.org/download/gtk2-engines

If you are on macOS / Mac OS X I really have no idea what you can do. In the Readme file of the themes I have included a couple of links I found, but I seriously doubt they can be of any help, cause they look really old.

If you try the themes, please post here your feedback. I am only using Windows for a few years now, so I would really appreciate feedback for other OSes.
Reply
#9
Excellent theme, I am using it now.. and very happy with it, thank you!! It was easy to install as everything's clearly explained in the textfile(s). Big Grin
Job well done!
Reply
#10
Thank you very much Zero01!

Are you using it on Windows or Linux?
Reply


Forum Jump: