orta / typescript-notes

High-level notes about TypeScript
320 stars 13 forks source link

GJS - GTK bindings for JS/TS #22

Open orta opened 3 years ago

orta commented 3 years ago

What is a modern GJS app like? https://2017.guadec.org/wp-content/uploads/2017/06/Philip-Chimento-GUADEC-2017-Modern-Javascript-in-GNOME.pdf

GJS Repo: https://gitlab.gnome.org/GNOME/gjs/-/blob/master/doc/Home.md

Bootstrap a project:

Types:

Testing:

Tutorial:

Example code showing a window

#!/usr/bin/gjs

const Gtk = imports.gi.Gtk;
Gtk.init(null);

let win = new Gtk.Window();
win.connect("delete-event", Gtk.main_quit);
win.show_all();
Gtk.main();

Devs hang out in matrix somewhere.


Notes:

orta commented 3 years ago

Working example of gjs on eOS 5 - https://github.com/orta/throwaway-gjs-example

orta commented 3 years ago

Realistically, it is very hard to get 1.68 running on elementary OS - you need to first build SpiderMonkey then build gsj, then you can use libgjs to build

I tested it in a vm, and busted my installation of gjs by using an rpm which I could download: https://launchpad.net/ubuntu/+source/gjs

Ideally the minimum version I'd like to use is 1.67.2 which adds module imports

eOS 6 is based on ubuntu 20.04 https://github.com/nodesource/distributions/pull/1159 - which might mean we won't see an official build of 1.67.2+ in apt at all: https://launchpad.net/ubuntu/+source/gjs

orta commented 3 years ago

https://github.com/orta/eos-clipboard-manager is a solid foundation for a gjs app using TypeScript

orta commented 3 years ago

https://github.com/orta/vscode-jsrdbg could provide debugging tools to a gjs eos app

Downside: jsrdbg isn't on apt for eos 6.

To get that working we need jsrdbg to support building with a more modern version of mozlibjs (it's on 24 we need 68) - I took a stab at that, but I don't know much about building c++ projects on linux

orta commented 3 years ago

I've also been wondering about seeing how the bundling in esbuild works, and maybe we don't have to think about the underlaying implementation of how imports work and so the older gjs versions might not be such a blocker

orta commented 3 years ago

Unofficial (e.g. not a gnome project) but interesting https://github.com/romgrk/node-gtk