jsgtk

A simplified GJS environment for node and JS developers.

Project Ideas

Following the current list of project ideas and achievements:

Platforms

Currently developed and tested on Linux (ArchLinux, Debian, Fedora, Ubuntu) and Darwin (OSX) platforms.

How To Install

On ArchLinux you can simply use yaourt -S --needed jsgtk installing from AUR.

On other common Linux distros, and also on OSX, you can use the following terminal command and follow its instructions:

sh -c "$(curl -fsSL https://webreflection.github.io/jsgtk/install)"

If you would like to know what that script does, feel free to read the used install file content.

There is also a jsgtk package on npm and it is possible to install it via npm install -g jsgtk. However, in this case, please be sure you have installed dependencies first. Some hint about best way to install them might be printed on the terminal once installed.

Dependencies

This project trusts and uses 100% GJS, which is usually available through one of the following procedures:

Please remember using the installer should already bring in essential dependencies so most likely there's nothing else to do.

Gtk/UI Examples

To test if everything is fine, you can create a test.js file and run it via jsgtk test.js or, after chmod +x test.js, directly via ./test.js:

#!/usr/bin/env jsgtk
const Gtk = require('Gtk');
Gtk.init(null);
const win = new Gtk.Window({
  title: 'jsgtk',
  type: Gtk.WindowType.TOPLEVEL,
  windowPosition: Gtk.WindowPosition.CENTER
})
  .once('show', () => {
    win.setKeepAbove(true);
    Gtk.main();
  })
  .on('destroy', Gtk.mainQuit)
;
win.add(new Gtk.Label({label: 'Hello jsGtk+'}));
win.setDefaultSize(200, 80);
win.showAll();

There is also a jsgtk-examples repository which includes most common GJS examples, readapted for jsgtk.

Tests and other examples

If you clone this repository, npm test is the way to test few functionalities. Once cloned locally, you can also try ./jsgtk examples/base.js or any other file.

Why not node-gir or node-gtk?

Well, apparently both projects are stuck/abandoned and unfortunately there's no other option ^_^;;