Skip to content
This repository was archived by the owner on Jan 5, 2022. It is now read-only.

GJS - GTK bindings for JS/TS #22

Open
orta opened this issue Dec 13, 2020 · 6 comments
Open

GJS - GTK bindings for JS/TS #22

orta opened this issue Dec 13, 2020 · 6 comments

Comments

@orta
Copy link
Owner

orta commented Dec 13, 2020

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:

  • ElementaryOS does not come with gjs installed by default
@orta
Copy link
Owner Author

orta commented Apr 30, 2021

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

@orta
Copy link
Owner Author

orta commented Apr 30, 2021

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 nodesource/distributions#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
Copy link
Owner Author

orta commented Jun 19, 2021

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

@orta
Copy link
Owner Author

orta commented Sep 1, 2021

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
Copy link
Owner Author

orta commented Sep 1, 2021

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
Copy link
Owner Author

orta commented Sep 28, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant