Gtk for the www?

I am porting lots of my old ruby-gtk2 applications to ruby-gtk3 finally. It was quite painful
but ruby itself is great, so this is finally going quite well (for me).

Before I switched to ruby in 2005 or so, I used php. I wrote quite a lot of web-related parts
in php. When I switched to ruby, the PHP parts I rewrote in ruby and have extended them
since then.

I have a lot of websites that have a structure such as:

image(:sunshine)

This gets translated into a HTML img tag, with the correct path
automatically used, so that I don’t have to remember it.

Just as an example. This would find the local path to some image
showing a sunshine setting. This is embedded in a webpage.

Now the thing is … the way this is described, I can easily use this
in ruby-gtk too. So the above could simply map a gtk-image and
embed it into a widget.

What I am saying is that all my web stuff could, in THEORY, be also
used in ruby-gtk (thus gtk).

Even css will work, to some extent (I can autogenerate the css
“dialect” gtk uses, via ruby).

Obviously there is one problem for me right now: javascript.

Now … I actually hate javascript. So I want to avoid it ideally.

Via ruby-gtk, I can avoid it! The things I can do via ruby-gtk
is quite similar to javascript if you think about it. Like the
GTK popover widget? That is quite similar to balloon widgets
as a HTML div tag, in javascript / jquery.

Take gtk-text-view and stuff. I have, sort of, a table, that I
can dynamically update, change, and so forth. In some ways
the way I use ruby-gtk is a bit similar to the www; just that
I can avoid javascript, sort of. (I am aware that gtk may not
offer all that CSS and javascript offers, but I am fine to
focus on the MAIN functionality here. I don’t need
everything really. I also use jquery for image-effects or
widget-relocation, so I’d look for something like this
in gtk as well.)

Ok so far so good - I hope you can understand the background
so far.

Now … as I was thinking about things such as:

image(:foobar)

There are some things I can do in ruby + web, via jquery,
that I am not sure I can easily do in gtk. For example,
dragging a gtk widget holding an image; I can do this
very easily in jquery. Not sure how to do this via
gtk; I assume it is possible but I don’t know how.

Has anyone thought about this? Wouldn’t it be quite
cool if, say, a gtk application could seamlessly work
on the modern www as well? Sort of like providing
a mapping between the main parts of gtk, to the
www. Again - just for the simple parts. We don’t
necessarily need ALL of the functionality. Keep it
simple; and then afterwards it can always be extended
if it is important.

Note - I am NOT suggesting a 1:1 mapping. We don’t
need all of javascript or jquery either. Ideally we could
have some meta-project that could be used by different
people; gtk, qt and so forth, where applications in gtk or
qt could, quite easily, also work on the www.

But I know way too little right now to know if anyone has
done this. There are many potential benefits. For example,
the game wesnoth could perhaps be played via the www but
the default bindings could be retained (I think they will
rewrite it in godot or whatever the name of that engine
is … godrin not sure).

Almost like it’s a web framework/platform :grinning_face_with_smiling_eyes:

Is this some kinda templating language? I’m not recognising that syntax

GtkImage is a widget, do you mean GdkPixbuf or something?

What web stuff? You trying to integrate a ruby web framework with gtk? Sorry I’m really not following

What gtk uses is CSS - what we implement is spec-compliant - we just have rather different nodes/elments (widgets) to the Web

Why? Your writing ruby - other than a spot of xml/css you don’t ned to bother with anything but ruby

Sure, but I’m not the relevance

Wait are you embedding gjs or someting?

Honestly this reads like a disjointed brain dump with no real direction thus far, sorry :slight_smile:

Fair, HTML is a lot more flexible than Gtk in that sense

You mean broadway? Bit “meh” to be completely honest

Confused - GJS is complete ECMAScript (it’s mozjs on the inside) and nobody wants jQuery :slight_smile:

Not sure I would describe the tooling involved in wasm’d qt “easy” or the results particularly desirable

PS: Could we
please try not
to break
text flow so
much?

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.