Chromium-based cross-platform / cross-language application framework
C++
2,752
25 commits
updated Jan 9, 2024

Chromium-based cross-platform / cross-language application framework
Thrust is require/import-able, it lets you distribute NodeJS, Go or Python GUI apps directly
through their native package managers.
Thrust is based on Chromium's Content Module and is supported on Linux, MacOSX and Windows:
Screenshot of Thrust Getting Started example running on each major platform.
To better understand what Thrust can do, check out JankyBrowser by @morganrallen, the cross-platform browser that fits in a gist:
npm install -g \
https://gist.github.com/morganrallen/f07f59802884bcdcad4a/download
Thrust's binary distribution exposes its API on the standard IO and language specific library packages automatically download the binary distribution at installation. Thrust is based on Chromium's content module and uses web-pages as its GUI.
All these Getting Started example work as is on each major platform (MacOSX, Windows, Linux)
First install with npm install node-thrust
require('node-thrust')(function(err, api) {
api.window({ root_url: 'https://google.com' }).show();
});
First download with go get -u github.com/miketheprogrammer/go-thrust/
package main
import ( "github.com/miketheprogrammer/go-thrust/lib/dispatcher" "github.com/miketheprogrammer/go-thrust/lib/spawn" "github.com/miketheprogrammer/go-thrust/lib/bindings/window" "github.com/miketheprogrammer/go-thrust/lib/commands" )
func main() { spawn.Run() size := commands.SizeHW{} opts := window.Options{ RootUrl: "http://google.com", Size: size, Title: "Demo window", HasFrame: true, } thrustWindow := window.NewWindow(opts) thrustWindow.Show() thrustWindow.Maximize() thrustWindow.Focus() dispatcher.RunLoop() }
First install with pip3 install pythrust [--user] (requires Python3)
import asyncio, pythrust
loop = asyncio.get_event_loop()
api = pythrust.API(loop)
asyncio.async(api.spawn())
asyncio.async(api.window({ 'root_url': 'http://google.com' }).show())
loop.run_forever()
Include scala-thrust jar on your classpath. (Add to lib in your project.)
import scala.concurrent.ExecutionContext.Implicits.global
import com.github.eklavya.thrust._
object Main extends App {
Window.create("http://google.com").foreach { w =>
w.show
w.maximize
w.openDevtools
w.focus(true)
w.onBlur(() => println("we were blurred"))
w.onFocus(() => println("we were focused"))
Menu.create("MyMenu").foreach { m =>
val i = MenuItem("Item1", _ => println("Item1 was clicked"))
m.addItem(i)
m.popup(w)
}
}
}
(ns my-app.core
(:require [clj-thrust.core :refer [create-process destroy-process]]
[clj-thrust.window :as w]))
(let [process (create-process) ; `create-process` also takes path to Thrust directory
window (w/create-window process
:root-url "http://localhost:8080" ; URL to your web app
:size {:width 400 :height 300})]
(w/listen-closed window
(fn [e]
(destroy-process process))) ; Optionally call `(System/exit 0)` here.
(w/show window)
(w/focus window true))
Install with cpanm Thrust [--sudo]
Simple command line test:
perl -MThrust -e 'Thrust->window->show->maximize->open_devtools->run'
Basic program
use Thrust;
my $t = Thrust->new;
my $w = $t->window(
root_url => 'data:text/html,Hello World!',
title => 'My App',
size => { width => 800, height => 600 },
);
$w->on(closed => sub { exit });
$w->show;
$t->run; ## enter event loop
The API reference as well as links to specific language bindings documentations are availble in the docs/ directory.
[Thrust Architecture]
(Platform) [stdio] (Your Implementation)
#
+--------------+ # +-----------------------+ |
| Cocoa / Aura | # +---| win3: (HTML/JS) | |
+-------+------+ # | +-----------------------++ |
| # +--| win2: (HTML/JS) | | cli
+------------+ +-------+------+ # | +-----------------------++ |
| +-+ thrust (C++) +-------+-+ win1: (HTML/JS) | |
| ContentAPI | +-------+------+ # +-----------------------+ |
| | | # | (TCP/FS)
| (Blink/v8) | +-------+------+ # +-----------------------+ |
| | + JSON RPC srv +---------+ Client App (any Lang) | | srv
+------------+ +--------------+ # +-----------------------+ |
#
No longer maintained actively.
MacOSX, Windows and Linuxfile://, ...)You will generally don't need to build thrust yourself. A binary version of thrust should be automatically fetched by the library you're reyling on at installation.
To build thrust, you'll need to have python 2.7.x and git installed. You can
then boostrap the project with:
./scripts/boostrap.py
Build both the Release and Debug targets with the following commands:
./scripts/update.py
./scripts/build.py
Note that bootstrap.py may take some time as it checks out brightray and
downloads libchromiumcontent for your platform.
(top 24 of 36)
6,688 followers · starred Dec 2014
2,306 followers · starred Sep 2013
3,401 followers · starred Feb 2015
1,204 followers · starred Nov 2014
Chromium-based cross-platform / cross-language application framework
C++
2,752
25 commits
updated Jan 9, 2024

Chromium-based cross-platform / cross-language application framework
Thrust is require/import-able, it lets you distribute NodeJS, Go or Python GUI apps directly
through their native package managers.
Thrust is based on Chromium's Content Module and is supported on Linux, MacOSX and Windows:
Screenshot of Thrust Getting Started example running on each major platform.
To better understand what Thrust can do, check out JankyBrowser by @morganrallen, the cross-platform browser that fits in a gist:
npm install -g \
https://gist.github.com/morganrallen/f07f59802884bcdcad4a/download
Thrust's binary distribution exposes its API on the standard IO and language specific library packages automatically download the binary distribution at installation. Thrust is based on Chromium's content module and uses web-pages as its GUI.
All these Getting Started example work as is on each major platform (MacOSX, Windows, Linux)
First install with npm install node-thrust
require('node-thrust')(function(err, api) {
api.window({ root_url: 'https://google.com' }).show();
});
First download with go get -u github.com/miketheprogrammer/go-thrust/
package main
import ( "github.com/miketheprogrammer/go-thrust/lib/dispatcher" "github.com/miketheprogrammer/go-thrust/lib/spawn" "github.com/miketheprogrammer/go-thrust/lib/bindings/window" "github.com/miketheprogrammer/go-thrust/lib/commands" )
func main() { spawn.Run() size := commands.SizeHW{} opts := window.Options{ RootUrl: "http://google.com", Size: size, Title: "Demo window", HasFrame: true, } thrustWindow := window.NewWindow(opts) thrustWindow.Show() thrustWindow.Maximize() thrustWindow.Focus() dispatcher.RunLoop() }
First install with pip3 install pythrust [--user] (requires Python3)
import asyncio, pythrust
loop = asyncio.get_event_loop()
api = pythrust.API(loop)
asyncio.async(api.spawn())
asyncio.async(api.window({ 'root_url': 'http://google.com' }).show())
loop.run_forever()
Include scala-thrust jar on your classpath. (Add to lib in your project.)
import scala.concurrent.ExecutionContext.Implicits.global
import com.github.eklavya.thrust._
object Main extends App {
Window.create("http://google.com").foreach { w =>
w.show
w.maximize
w.openDevtools
w.focus(true)
w.onBlur(() => println("we were blurred"))
w.onFocus(() => println("we were focused"))
Menu.create("MyMenu").foreach { m =>
val i = MenuItem("Item1", _ => println("Item1 was clicked"))
m.addItem(i)
m.popup(w)
}
}
}
(ns my-app.core
(:require [clj-thrust.core :refer [create-process destroy-process]]
[clj-thrust.window :as w]))
(let [process (create-process) ; `create-process` also takes path to Thrust directory
window (w/create-window process
:root-url "http://localhost:8080" ; URL to your web app
:size {:width 400 :height 300})]
(w/listen-closed window
(fn [e]
(destroy-process process))) ; Optionally call `(System/exit 0)` here.
(w/show window)
(w/focus window true))
Install with cpanm Thrust [--sudo]
Simple command line test:
perl -MThrust -e 'Thrust->window->show->maximize->open_devtools->run'
Basic program
use Thrust;
my $t = Thrust->new;
my $w = $t->window(
root_url => 'data:text/html,Hello World!',
title => 'My App',
size => { width => 800, height => 600 },
);
$w->on(closed => sub { exit });
$w->show;
$t->run; ## enter event loop
The API reference as well as links to specific language bindings documentations are availble in the docs/ directory.
[Thrust Architecture]
(Platform) [stdio] (Your Implementation)
#
+--------------+ # +-----------------------+ |
| Cocoa / Aura | # +---| win3: (HTML/JS) | |
+-------+------+ # | +-----------------------++ |
| # +--| win2: (HTML/JS) | | cli
+------------+ +-------+------+ # | +-----------------------++ |
| +-+ thrust (C++) +-------+-+ win1: (HTML/JS) | |
| ContentAPI | +-------+------+ # +-----------------------+ |
| | | # | (TCP/FS)
| (Blink/v8) | +-------+------+ # +-----------------------+ |
| | + JSON RPC srv +---------+ Client App (any Lang) | | srv
+------------+ +--------------+ # +-----------------------+ |
#
No longer maintained actively.
MacOSX, Windows and Linuxfile://, ...)You will generally don't need to build thrust yourself. A binary version of thrust should be automatically fetched by the library you're reyling on at installation.
To build thrust, you'll need to have python 2.7.x and git installed. You can
then boostrap the project with:
./scripts/boostrap.py
Build both the Release and Debug targets with the following commands:
./scripts/update.py
./scripts/build.py
Note that bootstrap.py may take some time as it checks out brightray and
downloads libchromiumcontent for your platform.
(top 24 of 36)
6,688 followers · starred Dec 2014
2,306 followers · starred Sep 2013
3,401 followers · starred Feb 2015
1,204 followers · starred Nov 2014