GTK2 and GTK3 theming

Discuss various technical topics not related to Mozilla.
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

GTK2 and GTK3 theming

Post by barbaz »

(from http://forums.mozillazine.org/viewtopic ... #p14673887 )
Frank Lion wrote: I wrote a Linux OS theme
How did you learn to write GTK2/GTK3 themes and do it right?
How to figure out what "selector" to use for theming specific widget(s) in specific way?

I haven't been able to get anything to even look like it's working without copying stuff from someone else's theme :(
User avatar
Grumpus
Posts: 13246
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: GTK2 and GTK3 theming

Post by Grumpus »

A short Google search for GTK3 themes found a load of instructional information.
I realize Frank is the Pro from Dover ????? on this stuff but it might not be a waste to look around.
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: GTK2 and GTK3 theming

Post by barbaz »

Grumpus wrote:A short Google search for GTK3 themes found a load of instructional information.
Can you please post some links here? All I can find are basic tutorials, useful but I'm looking for something more advanced than that.
User avatar
Grumpus
Posts: 13246
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: GTK2 and GTK3 theming

Post by Grumpus »

Maybe these, but I don't write themes. I believe this was the search.
A thought on this might be top start with GTK3 and then move on to GTK3 Themes.
GTK Theming Tutorials
Some of the links in some of the older threads use older certificates so be careful allowing exceptions
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: GTK2 and GTK3 theming

Post by barbaz »

Thanks, from there I found GTK's own documentation about GTK3 CSS. But none of those links cover what I'm looking for - that is, how to build a correctly-coded theme from scratch, what's right and what's wrong, and how to get specific selectors for specific widgets (tried GTK Inspector but I can't figure out how to get it to inspect some things such as inside of a GtkTextView).
User avatar
Grumpus
Posts: 13246
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: GTK2 and GTK3 theming

Post by Grumpus »

Have you searched the Debian packages?
Can GTKTextView be seen with something like Emacs or Vim?
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: GTK2 and GTK3 theming

Post by barbaz »

Grumpus wrote:Have you searched the Debian packages?
No, I don't know enough about what to looking for (and I'm using Ubuntu anyway).
Grumpus wrote:Can GTKTextView be seen with something like Emacs or Vim?
Using a text editor to open a component of a live running application is way above my level of knowledge... :?
User avatar
Grumpus
Posts: 13246
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: GTK2 and GTK3 theming

Post by Grumpus »

Ubuntu is based on Debian, there may be documentation (detailed instructions) in the Debian repositories.
As long as the package dependencies are met there's a good possibility, using either dpkg or Gdebi it can be installed.
Each package usually has a list of what is required and you can check your system (use Synaptic) to see if they are already installed.
One simple way is to download the .deb package and open it with Gdebi.
Usually Gdebi will grouse if it isn't going to work or if a dependency isn't met.

My bad on the GtkTextView, I assumed it was a static file not operating.
Also this link programmatically-scroll-to-a-specific-line-in-gtktextview
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: GTK2 and GTK3 theming

Post by barbaz »

Grumpus wrote:Ubuntu is based on Debian, there may be documentation (detailed instructions) in the Debian repositories.
No results on GtkTextView in the Debian packages.
Grumpus wrote:My bad on the GtkTextView, I assumed it was a static file not operating.
Also this link programmatically-scroll-to-a-specific-line-in-gtktextview
I'm not trying to make a custom theme engine, just building a custom theme using the existing engines.

The GtkTextView I'm looking at are GTK 3, and what I don't know is how to get selectors to match specific text inside it. For example on some themes the dates in gnome-system-log are washed out to the point of being unreadable, how did the Lubuntu theme devs figure out this selector?

Code: Select all

LogviewWindow .view.dim-label, .dim-label
User avatar
Frenzie
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium
Contact:

Re: GTK2 and GTK3 theming

Post by Frenzie »

The documentation has stuff (more alluding to than fully explanatory) about applicable CSS classes for each kind of widget.

https://developer.gnome.org/gtk3/unstab ... 3.8.2.10.3

But wouldn't the inspector say when a label is a .dim-label? (in the style classes column) It's not really clear to me what dates you're referring to so I have no idea where to see for myself. :)
Intelligent alien life does exist, otherwise they would have contacted us.
User avatar
Frank Lion
Posts: 21178
Joined: April 23rd, 2004, 6:59 pm
Location: ... The Exorcist....United Kingdom
Contact:

Re: GTK2 and GTK3 theming

Post by Frank Lion »

barbaz wrote:(from http://forums.mozillazine.org/viewtopic ... #p14673887 )
Frank Lion wrote: I wrote a Linux OS theme
How did you learn to write GTK2/GTK3 themes and do it right?
Odd as it may seems, I'm probably not the best person to ask. I've been making themes since 2006 and I just seem to know how to do this stuff. I have, I'm told, a different approach to things than most, but I'm only reading the same info out there as everyone else.

The other thing is that I deliberately forget all this stuff as soon as a theme, or update to it, is done. It has to be that way, when I'm working I have the entire theme code in my head, like The Matrix, and my hands move by themselves, like playing the piano and I'm restarting up to 30 times an hour to see the changes and few days later a theme appears. Then, to preserve sanity, it is all forgotten.

So, because I wrote my Linux OS theme back in November 2015 and hasn't blown up since, then atm the man in the moon would know more about individual selectors than I do. A few hours in, back in the seat, and it would all be different. I've always worked like that.

Btw - SMPlayer (works well with my TV capture card) - lying toads those guys are 'Download SMPlayer Themes' they say. Those ain't themes, those are toolbar button sets! So I made a proper theme for it - Tip #1. in theming - don't believe anyone who tells you something can't be done.
I haven't been able to get anything to even look like it's working without copying stuff from someone else's theme :(
That's OK, just make sure you fully understand the code you are copying.

barbaz wrote:Thanks, from there I found GTK's own documentation about GTK3 CSS. But none of those links cover what I'm looking for - that is, how to build a correctly-coded theme from scratch.
There's your mistake, no one builds this stuff from scratch. True for Linux and true for other stuff.

For example, there are 500 odd Firefox themes kicking around and all of them originally derived from the original 2002 theme by Joe Hewitt. (the only exception was back in 2014 when I wrote a completely 'from scratch' theme using a new method to theme Firefox, just because I could see that the conventional method could not be maintained easily, or at all, under Firefox's Rapid Release policy ....don't forget, I had been writing themes for 8 years by then)

No, take a good working Open Source theme that is as close to your planned theme as possible and adapt it, recoding whole sections if required.

GTK3 is pretty easy as it really is just same old, same old .css. GTK2 is fairly bizarre and complex though. :)
"The only thing necessary for the triumph of evil, is for good men to do nothing." - Edmund Burke (attrib.)
.
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: GTK2 and GTK3 theming

Post by barbaz »

Thanks for the replies. I'll start by picking a favorite GTK 3 theme, then test it against something "strict" like GTK 3 SeaMonkey until it looks good.
(Raleigh theme looks sane enough on GTK 3 SeaMonkey, so I guess I can use that for reference if I can't figure something out.)

@Frenzie: On Lubuntu 14.04 with (for example) Greybird theme, when using gnome-system-log to view syslog you'll see what I mean. (I use gtkparasite there given that the GTK version is too old for GTK Inspector. Checked 16.04 but the gnome-system-log there leaves the dates the same as the rest of the displayed information.)
User avatar
Frenzie
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium
Contact:

Re: GTK2 and GTK3 theming

Post by Frenzie »

@barbaz But if it's GTK2 then it won't use CSS selectors, so either there's a gap in your logic or I'm just not quite following you. :)
Intelligent alien life does exist, otherwise they would have contacted us.
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: GTK2 and GTK3 theming

Post by barbaz »

Well, mainly I'm trying to solve the problem that GTK 3 SeaMonkey looks like crap because so many GTK 3 themes appear to be poorly coded. So even if I end up only being able to make a custom GTK 3 theme and have to just symlink some pre-installed GTK 2 theme, that's already great.
(Mismatched looks between graphics toolkits don't matter to me if I know why it is and if they're not an eyesore side-by-side.)

Do you know a GTK 2 equivalent of GTK Inspector / gtkparasite?
User avatar
Frenzie
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium
Contact:

Re: GTK2 and GTK3 theming

Post by Frenzie »

I'm not familiar with anything other than Parasite for GTK2, but it didn't add GTK3 compatibility until 2012 and can still be compiled both ways. The Inspector thingy is integrated & improved Parasite.

But when SeaMonkey is the only app that looks a bit off, one has to wonder what makes you so sure it's the theme that's at fault and not SeaMonkey?
Intelligent alien life does exist, otherwise they would have contacted us.
Post Reply