I have been using gtk3 for quite a while now via ruby-gtk3. A few months
ago I wrote something here; this time I have more experience and solved
tons of problems.
I also got into the CSS subset that gtk supports and this works very well,
at the least for me. I actually was using perl and php (and thus knew
HTML and CSS) before ruby already, so the idea to extend support for CSS
was what I liked in gtk3.
But there is one thing that puzzles me a bit.
Say in HTML you have a div-tag and you style it via CSS such as:
<div style="width:300px; height: 50px"> Some text here </div>
Would this not be useful for gtk3 or gtk4 as well?
Now: I am NOT suggesting to abandon the old way. The old way can be retained,
no problem. But would it not be interesting to have style-elements be specified
in this way?
I remember Matthias from the gitlab issue tracker not seeming overwhelmed to
make CSS as central for gtk, so this may not have any chance to be added.
But I can think of two benefits:
- Lots of users world wide would easily understand the CSS/HTML variant.
- People may more easily be able to style the widget hierarchy in general,
including ad-hoc overriding this.
I am mostly talking about GTK here as a toolkit; how DEs such as GNOME
handle this is up to them of course.
I think the biggest benefit for this would be that lots of people who
already know HTML/CSS would find it easier to use gtk - probably not the
C bindings as such, but say python and pygobject. (I use both ruby and
python actually; to me the two languages are so similar that it isn’t
often worth that much to argue about their differences, which IMO are
more from the philosophical point of view, not the practical side of
view. The pygobject examples that I find, work almost 1:1 via ruby as
well, for the most part.)
At any rate, coming from ruby-gtk2 originally, I like the CSS support in
ruby-gtk3. Even if it is not comparable to what a typical browser offers,
which is quite nice, for a bit eye candy (I try to not go overboard or make
it distracting, but sometimes slow colour-changes are nice to have, like
slightly brighter yellow background over a gtk-entry).