nativefier

package module
v0.0.0-...-d745024 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2018 License: MIT Imports: 17 Imported by: 0

README

go-nativefier

Make any web page a desktop application. Inspired by nativefier. Written in Go. Tiny binaries (5mb). Native web engines.

Note: only osx is supported in this initial draft.

nativefier has a few issues I don't like:

  • Huge binaries (250mb in some cases)
  • Depends on electron toolchain
  • Depends on Nodejs toolchain

go-nativefier has no dependencies on Nodejs or electron. It uses native web engines on each respective OS. Single binary distribution. Size is under 10mb.

Roadmap

  • Native "bundles"
    • MacOS .app
    • Windows .exe
    • Linux elf binary
  • Icon support
    • Icon inference
    • Icon conversion
  • App name inference
  • Avoid "cold starts"
    • Cache website contents
    • Show loading animation instead of blank white screen

Caveats

  • Potential incompatibilities between native web engines
  • No desktop integration that comes with electron

Todo

  • Bundler interface to abstract creating single file bundles for the different OS's

Bugs

  • Webview appears to not eval injected javascript for webkit on osx

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebview

func NewWebview(title, url string, w, h int, resize, debug bool) webview.WebView

NewWebview initialises a webview.

Types

type Darwin

type Darwin struct {
	Title     string
	URL       string
	InferIcon bool

	Target string
	Icon   string
	// contains filtered or unexported fields
}

Darwin bundles an executable into a native package with, passing the default arguments to it.

func (*Darwin) CreateConfig

func (b *Darwin) CreateConfig(dest string) error

CreateConfig creates the config file relative to dest.

func (*Darwin) CreateExecutable

func (b *Darwin) CreateExecutable(dest string) error

CreateExecutable creates the main program executable relative to dest.

func (*Darwin) CreatePlist

func (b *Darwin) CreatePlist(dest string) error

CreatePlist creates an Info.plist file, relative to dest.

func (*Darwin) FetchIcon

func (b *Darwin) FetchIcon(dest string) error

FetchIcon creates an icon file relative to dest.

func (*Darwin) Pack

func (b *Darwin) Pack(dest string) error

Pack creates an OSX ".app" inside the given destination directory.

type Icon

type Icon = pageicon.Icon

Icon contains metadata about an icon.

type IconInferrer

type IconInferrer interface {
	Infer(url string, prefs []string) (*Icon, error)
}

IconInferrer abstracts how to retrieve an icon for a given url.

type IconInferrerFunc

type IconInferrerFunc func(string, []string) (*Icon, error)

IconInferrerFunc wraps functions to satisfy IconInferrer.

func (IconInferrerFunc) Infer

func (fn IconInferrerFunc) Infer(url string, prefs []string) (*Icon, error)

Infer calls the func responsible for inferring the icon.

type Packager

type Packager interface {
	Pack(dest string) error
}

Packager creates an OS specific executable package. For OSX this is typically a ".app", windows is ".exe" and linux is an elf binary.

func NewPackager

func NewPackager(
	target string,
	title string,
	url string,
	inferIcon bool,

	inferrer IconInferrer,
	fs afero.Fs,
) (Packager, error)

NewPackager instantiates a Packager. target: the executable file to bundle. title: name of the `.app` folder. url: website to point to. inferIcon: try to guess the icon. inferrer: responsible for doing the inference, defaults to `pageicon.Infer`.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL