Deno port of Gnome libraries (such as Gtk).

Overview

Deno GI

Deno port of Gnome libraries (such as Gtk).

Early Stage and Unstable

Usage

You must specify --allow-ffi and --unstable flags to run your program.

deno run --unstable --allow-ffi <file>

Loading a library

Import libraries from gir.deno.dev to load them.

Loading Gtk:

import Gtk from "https://gir.deno.dev/Gtk-4.0";

Creating Objects

Objects are initialized using creation functions or javascript constructors.

Creating a GtkButton:

const button = Gtk.Button.newWithLabel("Click Me!");

or

const button = new Gtk.Button({ label: "Click Me!" });

Signals

Signals are connected using on method.

Connecting clicked signal to a button:

button.on("clicked", () => {
  console.log("Clicked");
});

Example

import Gtk from "https://gir.deno.dev/Gtk-4.0";

const app = new Gtk.Application();

app.on("activate", () => {
  const win = new Gtk.ApplicationWindow({ application: app });
  const contentArea = new Gtk.Box();
  const label = new Gtk.Label({ label: "Hello World!" });

  contentArea.append(label);
  win.setChild(contentArea);
  win.show();
});

app.run([]);

See more examples on examples folder.

Dependencies

Deno GI depends on gobject-introspection.

Fedora

dnf install gobject-introspection

Ubuntu

apt install gobject-introspection

Arch

pacman -S gobject-introspection

macOS

brew install gobject-introspection

Windows

  1. Install MSYS2.
  2. Add C:\msys64\mingw64\bin to system path.
  3. Run in msys shell:
pacman -S mingw-w64-x86_64-gobject-introspection

Additional libraries such as gtk4 and libadwaita are used in examples. Their installation process is the same as gobject-introspection.

Related Projects

You might also like...

Deno bindings for yoga, using Deno FFI.

deno_yoga Deno bindings for yoga, using Deno FFI. Usage flags: --allow-ffi: Requires ffi access to "yogacore.dll", "libyogacore.so", "libyogacore.dyli

Feb 11, 2022

🛣️ A tiny and fast http request router designed for use with deno and deno deploy

Rutt Rutt is a tiny http router designed for use with deno and deno deploy. It is written in about 200 lines of code and is pretty fast, using an exte

Dec 10, 2022

A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

Wren Wren is a small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity. convenient aliases for HTTP responses au

Dec 12, 2022

deno-ja (Deno Japanese community) showcase

Showcase Deno本家よりも気軽に作ったものを公開できるようなShowcaseです。 スクリーンショットの撮影方法 短めのidを決めていただいて、下記のようにスクリプトを実行してください。 deno task screenshot [url] [id] ※エラーが出る場合は、下記を実行してみ

Oct 28, 2022

A command-line tool to manage Deno scripts installed via deno install

🏞️ nublar nublar is a command-line tool to manage your scripts installed via deno install. 🛳️ Installation deno install --allow-read --allow-write -

Dec 26, 2022

Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

smart-auto-move smart-auto-move is a Gnome Shell extension which keeps track of all application windows and restores them to the previous position, si

Dec 23, 2022

A simple menubar app for GNOME Shell that tracks how long you've been using your computer uninterruptedly

A simple menubar app for GNOME Shell that tracks how long you've been using your computer uninterruptedly

Welcome to Since Indicator 👋 🏠 Homepage Since Indicator is a simple menubar app for GNOME Shell that tracks how long you've been using your computer

Oct 20, 2022

Apollo - a JavaScript library to get real-time economic declarations such as inflation rates

Apollo is a JavaScript library to get real-time economic declarations such as inflation rates, unemployment rates or interest rates reported by governments or other entities.

Dec 10, 2022

enables communication between command-line or desktop applications and browser-based Ethereum wallets such as Metamask.

@securerpc/walletbus @securerpc/walletbus Abstract Quickstart Installation Usage Ethers.js Web3.js Configuration options Logging Development Automated

Dec 27, 2022
Owner
Ahmadreza Gilak
JS/TS Developer
Ahmadreza Gilak
Open apps directly in GNOME Software by clicking Install from Flathub and apps.gnome.

Flatline Open apps directly in GNOME Software by clicking Install from Flathub and apps.gnome. Load the extension in Firefox Clone the repository Open

Cleo Menezes Jr. 43 Nov 7, 2022
solid material ui port (ported from blazor port)

solid-material-ui solid material ui port (porting from blazor port) In preparation for solid hack Turbo Mono-repository is used for component package

skclusive 18 Apr 30, 2022
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
Fluent for Deno. Port of @the-moebius/fluent.

Fluent for Deno [better_fluent] Deno port of the-moebius/fluent Better Fluent integration for TypeScript/JavaScript. See the original repository for m

Dunkan 5 May 29, 2022
Grm is an improved Deno port of GramJS, written in TypeScript

Grm is an improved Deno port of GramJS, written in TypeScript. GramJS is a popular MTProto API Telegram client library written in JavaScript for Node.js and browsers, with its core being based on Telethon.

Dunkan 26 Dec 31, 2022
Improved Deno port of GramJS — a MTProto API Telegram client library.

Warning Considered as unstable. But, most of the commonly used features are working as expected. Grm Grm is an improved Deno port of GramJS, written i

Dunkan 26 Dec 31, 2022
Unofficial port of the Sentry SDK for JavaScript to Deno.

Sentry_deno This is an unofficial port of the Sentry SDK (@sentry/browser) to Deno. import * as Sentry from "https://deno.land/x/sentry_deno/main.ts";

Geert-Jan Zwiers 11 Aug 11, 2022
🦕 Deno port of Microsoft/vscode-textmate: A library that helps tokenize text using TextMate grammars.

TextMate A library that helps tokenize text using TextMate grammars. Deno port of Microsoft/vscode-textmate. See original license here. An interpreter

Dunkan 2 Sep 13, 2022
This is a simple boilerplate for a Deno website, deployed with Deno Deploy.

Simple Deno Website Boilerplate This is a simple website boilerplate built using Deno and deployed using Deno Deploy. Demo at simple-deno-website-boil

Bruno Bernardino 15 Dec 3, 2022
TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Erfan Safari 20 Dec 26, 2022