All Projects → romgrk → Node Gtk

romgrk / Node Gtk

Licence: other
GTK+ bindings for NodeJS (via GObject introspection)

Projects that are alternatives of or similar to Node Gtk

Sunflower
Small and highly customizable twin-panel file manager for Linux with support for plugins.
Stars: ✭ 347 (+20.91%)
Mutual labels:  gnome, gtk, gtk3
Plotinus
A searchable command palette in every modern GTK+ application
Stars: ✭ 805 (+180.49%)
Mutual labels:  gnome, gtk, gtk3
Gradio
Stars: ✭ 335 (+16.72%)
Mutual labels:  gnome, gtk, gtk3
Awesome Gtk
List of awesome GTK+ (gtk3) applications
Stars: ✭ 174 (-39.37%)
Mutual labels:  gnome, gtk, gtk3
gui-python-gtk
Repositório criado para documentar e centralizar conteúdos, dicas, tutoriais e exemplos de código sobre a construção de interfaces com a linguagem de programação Python (PyGObject) e o toolkit gráfico Gtk 4.
Stars: ✭ 85 (-70.38%)
Mutual labels:  gtk, gnome, gtk3
pw3270
3270 Emulator for gtk
Stars: ✭ 38 (-86.76%)
Mutual labels:  gtk, gnome, gtk3
Marker
🖊 A gtk3 markdown editor
Stars: ✭ 644 (+124.39%)
Mutual labels:  gnome, gtk, gtk3
Swiftgtk
A Swift wrapper around gtk-3.x and gtk-4.x that is largely auto-generated from gobject-introspection
Stars: ✭ 180 (-37.28%)
Mutual labels:  gnome, gtk, gtk3
GabTag
A gtk linux application to handle audio tags 🎵
Stars: ✭ 34 (-88.15%)
Mutual labels:  gtk, gnome, gtk3
ThemeChanger
Theme changing utility for Linux, etc.
Stars: ✭ 14 (-95.12%)
Mutual labels:  gtk, gnome, gtk3
vulcan
A minimalistic text editor designed for both ordinary use and software development
Stars: ✭ 46 (-83.97%)
Mutual labels:  gtk, gnome, gtk3
telegrand
A Telegram client for GNOME
Stars: ✭ 380 (+32.4%)
Mutual labels:  gtk, gnome
sideload
Sideload Flatpaks on elementary OS
Stars: ✭ 41 (-85.71%)
Mutual labels:  gtk, gtk3
palette
Color palette app for elementary OS
Stars: ✭ 32 (-88.85%)
Mutual labels:  gtk, gtk3
wingpanel-indicator-network
Wingpanel Network Indicator
Stars: ✭ 22 (-92.33%)
Mutual labels:  gtk, gtk3
Resource Monitor
Resource_Monitor is a GNOME Shell extension that Monitor the use of system resources like cpu, ram, disk, network and display them in GNOME Shell top bar.
Stars: ✭ 62 (-78.4%)
Mutual labels:  gtk, gnome
switchboard-plug-onlineaccounts
Switchboard Online Accounts Plug
Stars: ✭ 25 (-91.29%)
Mutual labels:  gtk, gtk3
PokeChat
UNIX compatible, Discord and Telegram inspired, Pokémon-themed instant messaging service.
Stars: ✭ 11 (-96.17%)
Mutual labels:  gtk, gtk3
Lua-GTK3-Examples
Some GTK examples in Lua
Stars: ✭ 20 (-93.03%)
Mutual labels:  gtk, gtk3
wingpanel-indicator-bluetooth
Wingpanel Bluetooth Indicator
Stars: ✭ 18 (-93.73%)
Mutual labels:  gtk, gtk3

NODE-GTK

node-gtk

GNOME Gtk+ bindings for NodeJS
Package Version

Node-Gtk is a gobject-introspection library for nodejs. It makes it possible to use any introspected library, such as Gtk+, usable. It is similar in essence to GJS or PyGObject. Please note this project is currently in a beta state and is being developed. Any contributors willing to help will be welcomed.

Supported Node.js versions: 12, 14, 15 (other versions should work but are untested)
Pre-built binaries available for: Linux, macOS

Table of contents

Usage

You can use the Gtk+ API directly, or you can use react-gtk if your prefer to use React.

const gi = require('node-gtk')
const Gtk = gi.require('Gtk', '3.0')

gi.startLoop()
Gtk.init()

const win = new Gtk.Window()
win.on('destroy', () => Gtk.mainQuit())
win.on('delete-event', () => false)

win.setDefaultSize(200, 80)
win.add(new Gtk.Label({ label: 'Hello Gtk+' }))

win.showAll()
Gtk.main()

Hello Gtk

See our examples folder for more examples, and in particular the browser demo source for a more complex application.

Hello Gtk

Documentation

Read our documentation here

Installing and building

Note that prebuilt binaries are available for common systems, in those cases building is not necessary.

Target Platforms
  • Linux: prebuilt binaries available
  • macOS: prebuilt binaries available
  • Windows: unsupported for now (#241)

Requirements

In the not-working-yet Windows platform, all dependencies must be available under MSYS2 shell.

How to build on Ubuntu

Install basic dependencies.

sudo apt-get install \
  build-essential git \
  gobject-introspection \
  libgirepository1.0-dev \
  libcairo2 \
  libcairo2-dev

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

How to build on Fedora

Install basic dependencies:

sudo dnf install \
  @development-tools \
  nodejs \
  gobject-introspection \
  gtk3 \
  cairo

After installing of packages, run npm install node-gtk.

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 \
  cairo

Feel free to install all base-devel utilities.

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

How to build on macOS

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

brew install git node gobject-introspection gtk+3 cairo

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, after installing and building you can run any of the examples:

node ./examples/hello-gtk.js

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

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

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 Fedora, you should run sudo dnf install webkit2gtk3
  • in ArchLinux, you can pacman -S --needed webkitgtk and try it out.
  • in macOS, there is no way to run it right now because webkitgtk was removed from homebrew

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

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

# Usage: ./examples/browser.js <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 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,cairo}

# 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/romgrk/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 either, 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!

Contributing

If you'd like to help, we'd be more than happy to have support. To setup your development environment, you can run npm run configure. You can then build the project with npm run build.

Don't hesitate to join our Discord channel.

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].