Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here

node-gtk

GNOME Gtk+ bindings for NodeJS

Subscribe to updates I use node-gtk


Statistics on node-gtk

Number of watchers on Github 73
Number of open issues 9
Average time to close an issue about 1 month
Main language C++
Average time to merge a PR 3 days
Open pull requests 2+
Closed pull requests 3+
Last commit over 3 years ago
Repo Created over 4 years ago
Repo Last Updated over 2 years ago
Size 2.29 MB
Organization / Authorwebreflection
Contributors3
Page Updated
Do you use node-gtk? Leave a review!
View open issues (9)
View node-gtk activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating node-gtk for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Abandoned

This project is abandoned, it not even a work in progress anymore :-(

node-gtk

GNOME Gtk+ bindings for NodeJS

What is this

A work in progress to bring Gtk+ usable directly from nodejs so that the environment would be more up-to-date and supported than the one available via GJS.

Please note this project is currently in an alpha state and it needs more contributors.

Target Platforms (so far)

We're planning to serve pre-built binaries in order to make this project as cross platform and easy to install as possible. However, right now we support only Linux and experimentally OSX but in both targets the project will falback to build.

Common dependencies

In order to clone, install, and build this project you'll need a working copy of git CLI, nodejs 5, npm, and python2. In the not-working-yet Windows platform, all dependencies must be available under MSYS2 shell.

How to build on Ubuntu

Be sure node is version 5 or higher. Ignore the following step iv node --version is already 5 or higher.

# setup node v5
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -

Install basic dependencies.

# install dependencies
sudo apt-get install \
  build-essential git \
  nodejs \
  gobject-introspection \
  libgirepository1.0-dev

At this point npm install node-gtk should already install, fallback and build node-gtk without problems.

How to build on ArchLinux

The following should be the bare minimum to be able to build the project.

pacman -S --needed \
  base-devel git \
  nodejs npm \
  gtk3 gobject-introspection

Feel free to install all base-devel utilities.

After installing those packages, npm install node-gtk would do.

How to build on OSX

Assuming you have brew installed, the following has been successfully tested on El Captain.

# basic dependencies to build this repo
brew install git node gtk+3

At this point npm install node-gtk should already install, fallback and build node-gtk without problems.

Testing the project

If you'd like to test everything builds and work properly, find a target to clone this project, then run npm install.

# clone and build
git clone https://github.com/WebReflection/node-gtk.git
cd node-gtk
npm install

# how to verify from node-gtk folder
./examples/hello-gtk.js

If you'll see a little window saying hello that's it: it works!

Please note in OSX the window doesn't automatically open above other windows. Try Cmd + Tab if you don't see it.

Hello node-gtk!

browser demo

If you'd like to test ./examples/browser.js you'll need WebKit2 GTK+ libary.

  • in Ubuntu, you can apt-get install libwebkit2gtk-3.0 (4.0 works too) and try it out.
  • in ArchLinux, you can pacman -S --needed webkitgtk and try it out.
  • in OSX, you can brew install webkitgtk and try it out. If you have problems with a linked library, it's a known issue. You'll need to link the folder to the missing one.

    ```sh
    # example, the linked folder might be different
    TO_BE_LINKED=/tmp/webkitgtk20160213-86964-wydvdb/webkitgtk-2.10.7
    mkdir -p $TO_BE_LINKED
    ln -s /usr/local/Cellar/webkitgtk/2.10.7_1/lib $TO_BE_LINKED/lib
    ```
    

Once installed, you can ./examples/browser.js google.com or any other page, and you might try the dark theme out too:

# OSX needs to have the Adwaita theme installed
# brew install adwaita-icon-theme

# executable          url         theme
./examples/browser.js google.com  dark

Experimental platforms

Following how to setup the configuration to at least try building this project.

How to install node 5.x in Ubuntu 16 LTS

The setup file might not recognize xenial platform. In this case you need to download the file and edit it.

# download the file
curl -L -O https://deb.nodesource.com/setup_5.x

# edit (use vi or gedit or whatever you like) 
gedit setup_5.x

# find the following line
DISTRO=$(lsb_release -c -s)
# and change it to
DISTRO=jessie


# save the file and run the following
cat setup_5.x | sudo -E bash -

# once done you can
rm setup_5.x

At this point you can apt-get install nodejs and follow same instructions used for Ubuntu.

How to build on Windows (experimental)

Mandatory dependency is Visual Studio Community or Express with a C++ compiler (open a new C++ project and install it via IDE if necessary).

The easiest/tested way to at least try building this repository is within a MinGW shell provided by the MSYS2 installer.

Once VS and its C++ compiler is available and MSYS2 installed, launch the MinGW shell.

# update the system
# in case of errors, wait for the update to complete
# then close and open again MingW shell
pacman -Syyu --noconfirm

# install git, gtk3 and extra dependencie
pacman -S --needed --noconfirm git mingw-w64-$(uname -m)-{gtk3,gobject-introspection,pkg-config}

# where to put the repository clone?
# pick your flder or use ~/oss (Open Source Software)
mkdir -p ~/oss/
cd ~/oss

# clone node-gtk there
git clone https://github.com/WebReflection/node-gtk
cd node-gtk

# first run might take a while
GYP_MSVS_VERSION=2015 npm install

The GYP_MSVS_VERSION could be 2010, 2012, 2013 or 2015. Please verify which version you should use

Possible issue on MinGW shell

In case you are launching the general executable without knowing the correct platform, the binary path might not be available.

In such case python won't be available neither, and you can check via which python command.

If not found, you need to export the platform related binary path:

# example for the 32bit version
export PATH="/mingw32/bin:$PATH"
npm run install

This should do the trick. You can also check if there is any python at all via pacman -Qs python.

Please remember python2 is the one needed.

known issues building on Windows

Right now there are few gotchas and the build will most likely fail. Please help with a PR if you know how to solve the issue, thank you!

node-gtk open issues Ask a question     (View All Issues)
  • almost 4 years Failing to install on Ubuntu 16.04 with Node 6.7.0
  • almost 4 years Failed to start on Mac OS X 10.11.6 with Node.js 6.3.1
  • over 4 years Windows build is failing
  • over 4 years Rewrite constructors in JS code
  • over 4 years Run JS code to build NS from C++ hooks
  • over 4 years Support interfaces
  • over 4 years Add a test suite
  • over 4 years Implement a simple camelCase transform
node-gtk open pull requests (View All Pulls)
  • Using withCamelCase method to pollute namespaces
  • move away from deprecated APIs
node-gtk list of languages used
Other projects in C++