thrust

Chromium-based cross-platform / cross-language application framework

  • 所有者: breach/thrust
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

DEPRECATED - This package is no longer supporter or maintained.

Logo Thrust

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:

Cross-Platform Screenshots
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

Table of Contents


Language bindings

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)

NodeJS

Getting Started

First install with npm install node-thrust

require('node-thrust')(function(err, api) { 
  api.window({ root_url: 'https://google.com' }).show();
});
Library

Go

Getting Started

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()
}

Library

Python

Getting Started

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()
Library

Scala

Getting Started

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)
    }
  }
}
Library

Clojure

Getting Started
(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))
Library

Perl

Getting Started

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
Library

API Reference

The API reference as well as links to specific language bindings documentations
are availble in the docs/
directory.


Architecture

[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
+------------+ +--------------+   #     +-----------------------+, #

Community

Request for API
List of Thrust Users
Getting Involved

No longer maintained actively.


Features & Roadmap

  • window creation create, show, close resize, minimize, maximize, ...
  • node.js, go node.js and go bindings libraries
  • window events close, blur, focus, unresponsive, crashed
  • cross-platform equivalent support on MacOSX, Windows and Linux
  • sessions off the record, custom storage path, custom cookie store
  • kiosk kiosk mode
  • application menu global application menu (MacOSX, X11/Unity)
  • webview webview tag (secure navigation, tabs management)
  • frameless frameless window and draggable regions
  • python python bindings library
  • remote thrust specific IPC mechanism for client/server communication
  • proxy enable traffic proxying (Tor, header injection, ...)
  • tray icon tray icon native integration
  • protocol specific protocol registration (file://, ...)

Building Thrust from Sources

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.

主要指标

概览
名称与所有者breach/thrust
主编程语言C++
编程语言Python (语言数: 7)
平台
许可证MIT License
所有者活动
创建于2013-07-23 19:32:40
推送于2024-01-09 14:17:23
最后一次提交2024-01-09 15:17:23
发布数7
最新版本名称v0.7.6 (发布于 )
第一版名称v0.7.0 (发布于 )
用户参与
星数2.8k
关注者数86
派生数121
提交数656
已启用问题?
问题数187
打开的问题数44
拉请求数98
打开的拉请求数3
关闭的拉请求数10
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?