Convert Figma logo to code with AI

asticode logogo-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)

4,903
344
4,903
54

Top Related Projects

113,668

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

24,320

Create beautiful applications using Go

7,997

Build cross-platform modern desktop apps in Go + HTML5

12,478

Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows).

81,614

Build smaller, faster, and more secure desktop applications with a web frontend.

8,880

Golang framework for robotics, drones, and the Internet of Things (IoT)

Quick Overview

The go-astilectron project is a Go library that provides a set of tools and utilities for building cross-platform desktop applications using the Electron framework. It allows developers to create desktop applications using the Go programming language, while leveraging the power of Electron's web-based user interface.

Pros

  • Cross-Platform Compatibility: go-astilectron enables the creation of desktop applications that can run on multiple operating systems, including Windows, macOS, and Linux.
  • Leverage Electron's Capabilities: By using Electron, developers can take advantage of its robust features, such as native menus, tray icons, and access to system-level APIs.
  • Seamless Integration with Go: The library provides a Go-centric approach to building desktop applications, allowing developers to utilize their existing Go skills and toolchain.
  • Modular and Extensible: The project is designed to be modular, making it easy to extend and customize the functionality to fit specific project requirements.

Cons

  • Complexity: Integrating go-astilectron with Electron can add a layer of complexity to the development process, especially for developers new to the Electron ecosystem.
  • Performance Overhead: The use of Electron, which is built on top of Chromium, can result in a larger application size and potentially higher resource consumption compared to native desktop applications.
  • Limited Documentation: The project's documentation, while generally helpful, could be more comprehensive and provide more detailed examples and use cases.
  • Dependency on Electron: The project's functionality is heavily dependent on the Electron framework, which means that any changes or updates to Electron may impact the compatibility and functionality of go-astilectron.

Code Examples

Here are a few code examples demonstrating the usage of go-astilectron:

  1. Creating a Simple Window:
package main

import (
    "github.com/asticode/go-astilectron"
    "github.com/asticode/go-astilectron-bootstrap"
)

func main() {
    // Create a new Astilectron instance
    a, err := astilectron.New(nil, nil)
    if err != nil {
        panic(err)
    }
    defer a.Close()

    // Create a new window
    w, err := a.NewWindow("", &astilectron.WindowOptions{
        Center: astilectron.PtrBool(true),
        Height: astilectron.PtrInt(600),
        Width:  astilectron.PtrInt(800),
    })
    if err != nil {
        panic(err)
    }

    // Run the application
    if err := a.Run(); err != nil {
        panic(err)
    }
}

This code creates a new Astilectron instance, then creates a new window with specified options, and finally runs the application.

  1. Handling Events:
package main

import (
    "github.com/asticode/go-astilectron"
    "github.com/asticode/go-astilectron-bootstrap"
)

func main() {
    // Create a new Astilectron instance
    a, err := astilectron.New(nil, nil)
    if err != nil {
        panic(err)
    }
    defer a.Close()

    // Create a new window
    w, err := a.NewWindow("", &astilectron.WindowOptions{
        Center: astilectron.PtrBool(true),
        Height: astilectron.PtrInt(600),
        Width:  astilectron.PtrInt(800),
    })
    if err != nil {
        panic(err)
    }

    // Handle window events
    w.On(astilectron.EventNameWindowClosed, func(e astilectron.Event) (deleteListener bool) {
        // Handle window closed event
        return false
    })

    // Run the application
    if err := a.Run(); err != nil {
        panic(err)
    }
}

This code demonstrates how to handle events, such as the window closed event, using the go-astilectron

Competitor Comparisons

113,668

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

Pros of Electron

  • Larger community and ecosystem with extensive documentation and resources
  • Native support for JavaScript, HTML, and CSS, making it easier for web developers
  • More mature and feature-rich, with a wide range of APIs for desktop integration

Cons of Electron

  • Larger application size due to bundling Chromium and Node.js
  • Higher memory usage, which can impact performance on low-end devices
  • Potential security concerns due to the broader attack surface

Code Comparison

Electron (JavaScript):

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

go-astilectron (Go):

import "github.com/asticode/go-astilectron"

func main() {
    a, _ := astilectron.New(astilectron.Options{})
    defer a.Close()
    a.Start()
    w, _ := a.NewWindow("index.html", &astilectron.WindowOptions{})
    w.Create()
    a.Wait()
}

go-astilectron provides a Go-based alternative to Electron, offering smaller application sizes and potentially better performance. However, it has a smaller community and fewer resources compared to Electron. The choice between the two depends on the developer's preferred language, project requirements, and target audience.

24,320

Create beautiful applications using Go

Pros of Wails

  • Native Go bindings for frontend interactions, eliminating the need for IPC
  • Smaller binary sizes due to not bundling Electron
  • Faster startup times and lower memory usage

Cons of Wails

  • Less mature and smaller community compared to go-astilectron
  • Limited to WebView2 on Windows, which may not be available on older systems
  • Fewer built-in features for system tray, menus, and dialogs

Code Comparison

go-astilectron:

astilectron.New(astilectron.Options{
    AppName: "MyApp",
    AppIconDefaultPath: "icon.png",
}).Run(func(a *astilectron.Astilectron, ws []*astilectron.Window, _ *astilectron.Menu, _ *astilectron.Tray, _ *astilectron.Menu) error {
    return nil
})

Wails:

wails.Run(&wails.Options{
    Width:  1024,
    Height: 768,
    Title:  "MyApp",
    AssetServer: &assetserver.Options{
        Assets: assets,
    },
    BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
    OnStartup:        app.startup,
    Bind: []interface{}{
        app,
    },
})

The code comparison shows that Wails offers a more streamlined setup process with native Go bindings, while go-astilectron requires more configuration for Electron-specific features. Wails provides easier integration of Go functions with the frontend, whereas go-astilectron relies on IPC for communication between Go and JavaScript.

7,997

Build cross-platform modern desktop apps in Go + HTML5

Pros of lorca

  • Lightweight and minimal dependencies, requiring only a Go compiler and a browser
  • No need for separate installation of Electron or other large frameworks
  • Faster startup times due to its lightweight nature

Cons of lorca

  • Limited to Chrome/Chromium-based browsers, reducing cross-platform compatibility
  • Less extensive API and features compared to Electron-based solutions
  • Potential security concerns due to direct communication with the browser

Code Comparison

lorca:

ui, _ := lorca.New("", "", 480, 320)
defer ui.Close()
ui.Bind("add", func(a, b int) int { return a + b })
ui.Load("data:text/html,<html><body><h1>Hello World</h1></body></html>")
<-ui.Done()

go-astilectron:

a, _ := astilectron.New(astilectron.Options{})
defer a.Close()
w, _ := a.NewWindow("index.html", &astilectron.WindowOptions{})
a.Start()
w.Create()
a.Wait()

Summary

lorca offers a lightweight solution for creating desktop applications using Go and web technologies, with faster startup times and minimal dependencies. However, it has limited browser compatibility and a less extensive API compared to go-astilectron. go-astilectron, being based on Electron, provides broader cross-platform support and a more comprehensive set of features, but comes with larger dependencies and potentially slower startup times. The choice between the two depends on the specific requirements of your project, such as target platforms, desired features, and performance considerations.

12,478

Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows).

Pros of webview

  • Lightweight and minimal dependencies
  • Cross-platform support (Windows, macOS, Linux)
  • Simple API for easy integration

Cons of webview

  • Limited functionality compared to full-featured browsers
  • Less customization options for UI elements
  • Smaller community and fewer resources

Code Comparison

webview:

package main

import "github.com/webview/webview"

func main() {
    w := webview.New(true)
    defer w.Destroy()
    w.SetTitle("Minimal webview example")
    w.SetSize(800, 600, webview.HintNone)
    w.Navigate("https://example.com")
    w.Run()
}

go-astilectron:

package main

import "github.com/asticode/go-astilectron"

func main() {
    a, _ := astilectron.New(astilectron.Options{
        AppName: "My App",
    })
    defer a.Close()
    a.Start()
    w, _ := a.NewWindow("https://example.com", &astilectron.WindowOptions{
        Center: astilectron.PtrBool(true),
        Height: astilectron.PtrInt(600),
        Width:  astilectron.PtrInt(800),
    })
    w.Create()
    a.Wait()
}

The code comparison shows that webview has a simpler API and requires less setup code compared to go-astilectron. However, go-astilectron provides more options for customization and control over the application window.

81,614

Build smaller, faster, and more secure desktop applications with a web frontend.

Pros of Tauri

  • Smaller bundle sizes due to native system components
  • Better performance and resource efficiency
  • Cross-platform support for mobile devices (iOS and Android)

Cons of Tauri

  • Steeper learning curve, especially for developers new to Rust
  • Less mature ecosystem compared to Electron-based solutions
  • Limited access to certain native APIs

Code Comparison

Tauri (Rust):

#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

go-astilectron (Go):

func main() {
    a, _ := astilectron.New(nil, astilectron.Options{
        AppName: "My App",
    })
    defer a.Close()
    a.Start()
    w, _ := a.NewWindow("index.html", &astilectron.WindowOptions{
        Center: astilectron.PtrBool(true),
        Height: astilectron.PtrInt(600),
        Width:  astilectron.PtrInt(800),
    })
    w.Create()
    a.Wait()
}

Both Tauri and go-astilectron offer solutions for building desktop applications using web technologies. Tauri provides better performance and smaller bundle sizes, while go-astilectron offers a simpler development experience for Go developers. The choice between the two depends on specific project requirements and developer preferences.

8,880

Golang framework for robotics, drones, and the Internet of Things (IoT)

Pros of Gobot

  • Broader scope: Supports a wide range of hardware platforms and devices
  • Active community: More contributors and frequent updates
  • Extensive documentation and examples for various robotics applications

Cons of Gobot

  • Steeper learning curve due to its broader focus
  • Potentially more complex setup for simple desktop applications
  • May include unnecessary features for non-robotics projects

Code Comparison

Go-astilectron example:

func main() {
    a, _ := astilectron.New(nil, astilectron.Options{})
    defer a.Close()
    a.Start()
    w, _ := a.NewWindow("index.html", &astilectron.WindowOptions{})
    w.Create()
    a.Wait()
}

Gobot example:

func main() {
    r := gobot.NewRobot("bot",
        []gobot.Connection{firmata.NewAdaptor("/dev/ttyACM0")},
        []gobot.Device{gpio.NewLedDriver(firmata.NewAdaptor("/dev/ttyACM0"), "13")},
        work,
    )
    r.Start()
}

Go-astilectron is more focused on creating desktop applications with web technologies, while Gobot is designed for robotics and IoT projects. Go-astilectron's code is simpler for desktop apps, whereas Gobot's code is more oriented towards hardware interactions and robotics workflows.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

GoReportCard GoDoc Test Coveralls

Thanks to go-astilectron build cross platform GUI apps with GO and HTML/JS/CSS. It is the official GO bindings of astilectron and is powered by Electron.

Warning

This project is not maintained anymore.

Demo

To see a minimal Astilectron app, checkout out the demo.

It uses the bootstrap and the bundler.

If you're looking for a minimalistic example, run go run example/main.go -v.

Real-life examples

Here's a list of awesome projects using go-astilectron (if you're using go-astilectron and want your project to be listed here please submit a PR):

  • go-astivid Video tools written in GO
  • GroupMatcher Program to allocate persons to groups while trying to fulfill all the given wishes as good as possible
  • Stellite GUI Miner An easy to use GUI cryptocurrency miner for Stellite

Bootstrap

For convenience purposes, a bootstrap has been implemented.

The bootstrap allows you to quickly create a one-window application.

There's no obligation to use it, but it's strongly recommended.

If you decide to use it, read thoroughly the documentation as you'll have to structure your project in a specific way.

Bundler

Still for convenience purposes, a bundler has been implemented.

The bundler allows you to bundle your app for every os/arch combinations and get a nice set of files to send your users.

Quick start

WARNING: the code below doesn't handle errors for readibility purposes. However you SHOULD!

Import go-astilectron

To import go-astilectron run:

$ go get -u github.com/asticode/go-astilectron

Start go-astilectron

// Initialize astilectron
var a, _ = astilectron.New(log.New(os.Stderr, "", 0), astilectron.Options{
    AppName: "<your app name>",
    AppIconDefaultPath: "<your .png icon>", // If path is relative, it must be relative to the data directory
    AppIconDarwinPath:  "<your .icns icon>", // Same here
    BaseDirectoryPath: "<where you want the provisioner to install the dependencies>",
    VersionAstilectron: "<version of Astilectron to utilize such as `0.33.0`>",
    VersionElectron: "<version of Electron to utilize such as `4.0.1` | `6.1.2`>",
})
defer a.Close()

// Start astilectron
a.Start()

// Blocking pattern
a.Wait()

For everything to work properly we need to fetch 2 dependencies : astilectron and Electron. .Start() takes care of it by downloading the sources and setting them up properly.

In case you want to embed the sources in the binary to keep a unique binary you can use the NewDisembedderProvisioner function to get the proper Provisioner and attach it to go-astilectron with .SetProvisioner(p Provisioner). Or you can use the bootstrap and the bundler. Check out the demo to see how to use them.

Beware when trying to add your own app icon as you'll need 2 icons : one compatible with MacOSX (.icns) and one compatible with the rest (.png for instance).

If no BaseDirectoryPath is provided, it defaults to the executable's directory path.

The majority of methods are asynchronous which means that when executing them go-astilectron will block until it receives a specific Electron event or until the overall context is cancelled. This is the case of .Start() which will block until it receives the app.event.ready astilectron event or until the overall context is cancelled.

HTML paths

NB! All paths in HTML (and Javascript) must be relative, otherwise the files will not be found. To make this happen in React for example, just set the homepage property of your package.json to "./".

{ "homepage": "./" }

Create a window

// Create a new window
var w, _ = a.NewWindow("http://127.0.0.1:4000", &astilectron.WindowOptions{
    Center: astikit.BoolPtr(true),
    Height: astikit.IntPtr(600),
    Width:  astikit.IntPtr(600),
})
w.Create()

When creating a window you need to indicate a URL as well as options such as position, size, etc.

This is pretty straightforward except the astilectron.Ptr* methods so let me explain: GO doesn't do optional fields when json encoding unless you use pointers whereas Electron does handle optional fields. Therefore I added helper methods to convert int, bool and string into pointers and used pointers in structs sent to Electron.

Open the dev tools

When developing in JS, it's very convenient to debug your code using the browser window's dev tools:

// Open dev tools
w.OpenDevTools()

// Close dev tools
w.CloseDevTools()

Add listeners

// Add a listener on Astilectron
a.On(astilectron.EventNameAppCrash, func(e astilectron.Event) (deleteListener bool) {
    log.Println("App has crashed")
    return
})

// Add a listener on the window
w.On(astilectron.EventNameWindowEventResize, func(e astilectron.Event) (deleteListener bool) {
    log.Println("Window resized")
    return
})

Nothing much to say here either except that you can add listeners to Astilectron as well.

Play with the window

// Play with the window
w.Resize(200, 200)
time.Sleep(time.Second)
w.Maximize()

Check out the Window doc for a list of all exported methods

Send messages from GO to Javascript

Javascript

// This will wait for the astilectron namespace to be ready
document.addEventListener('astilectron-ready', function() {
    // This will listen to messages sent by GO
    astilectron.onMessage(function(message) {
        // Process message
        if (message === "hello") {
            return "world";
        }
    });
})

GO

// This will send a message and execute a callback
// Callbacks are optional
w.SendMessage("hello", func(m *astilectron.EventMessage) {
        // Unmarshal
        var s string
        m.Unmarshal(&s)

        // Process message
        log.Printf("received %s\n", s)
})

This will print received world in the GO output

Send messages from Javascript to GO

GO

// This will listen to messages sent by Javascript
w.OnMessage(func(m *astilectron.EventMessage) interface{} {
        // Unmarshal
        var s string
        m.Unmarshal(&s)

        // Process message
        if s == "hello" {
                return "world"
        }
        return nil
})

Javascript

// This will wait for the astilectron namespace to be ready
document.addEventListener('astilectron-ready', function() {
    // This will send a message to GO
    astilectron.sendMessage("hello", function(message) {
        console.log("received " + message)
    });
})

This will print "received world" in the Javascript output

Play with the window's session

// Clear window's HTTP cache
w.Session.ClearCache()

Handle several screens/displays

// If several displays, move the window to the second display
var displays = a.Displays()
if len(displays) > 1 {
    time.Sleep(time.Second)
    w.MoveInDisplay(displays[1], 50, 50)
}

Menus

// Init a new app menu
// You can do the same thing with a window
var m = a.NewMenu([]*astilectron.MenuItemOptions{
    {
        Label: astikit.StrPtr("Separator"),
        SubMenu: []*astilectron.MenuItemOptions{
            {Label: astikit.StrPtr("Normal 1")},
            {
                Label: astikit.StrPtr("Normal 2"),
                OnClick: func(e astilectron.Event) (deleteListener bool) {
                    log.Println("Normal 2 item has been clicked")
                    return
                },
            },
            {Type: astilectron.MenuItemTypeSeparator},
            {Label: astikit.StrPtr("Normal 3")},
        },
    },
    {
        Label: astikit.StrPtr("Checkbox"),
        SubMenu: []*astilectron.MenuItemOptions{
            {Checked: astikit.BoolPtr(true), Label: astikit.StrPtr("Checkbox 1"), Type: astilectron.MenuItemTypeCheckbox},
            {Label: astikit.StrPtr("Checkbox 2"), Type: astilectron.MenuItemTypeCheckbox},
            {Label: astikit.StrPtr("Checkbox 3"), Type: astilectron.MenuItemTypeCheckbox},
        },
    },
    {
        Label: astikit.StrPtr("Radio"),
        SubMenu: []*astilectron.MenuItemOptions{
            {Checked: astikit.BoolPtr(true), Label: astikit.StrPtr("Radio 1"), Type: astilectron.MenuItemTypeRadio},
            {Label: astikit.StrPtr("Radio 2"), Type: astilectron.MenuItemTypeRadio},
            {Label: astikit.StrPtr("Radio 3"), Type: astilectron.MenuItemTypeRadio},
        },
    },
    {
        Label: astikit.StrPtr("Roles"),
        SubMenu: []*astilectron.MenuItemOptions{
            {Label: astikit.StrPtr("Minimize"), Role: astilectron.MenuItemRoleMinimize},
            {Label: astikit.StrPtr("Close"), Role: astilectron.MenuItemRoleClose},
        },
    },
})

// Retrieve a menu item
// This will retrieve the "Checkbox 1" item
mi, _ := m.Item(1, 0)

// Add listener manually
// An OnClick listener has already been added in the options directly for another menu item
mi.On(astilectron.EventNameMenuItemEventClicked, func(e astilectron.Event) bool {
    log.Printf("Menu item has been clicked. 'Checked' status is now %t\n", *e.MenuItemOptions.Checked)
    return false
})

// Create the menu
m.Create()

// Manipulate a menu item
mi.SetChecked(true)

// Init a new menu item
var ni = m.NewItem(&astilectron.MenuItemOptions{
    Label: astikit.StrPtr("Inserted"),
    SubMenu: []*astilectron.MenuItemOptions{
        {Label: astikit.StrPtr("Inserted 1")},
        {Label: astikit.StrPtr("Inserted 2")},
    },
})

// Insert the menu item at position "1"
m.Insert(1, ni)

// Fetch a sub menu
s, _ := m.SubMenu(0)

// Init a new menu item
ni = s.NewItem(&astilectron.MenuItemOptions{
    Label: astikit.StrPtr("Appended"),
    SubMenu: []*astilectron.MenuItemOptions{
        {Label: astikit.StrPtr("Appended 1")},
        {Label: astikit.StrPtr("Appended 2")},
    },
})

// Append menu item dynamically
s.Append(ni)

// Pop up sub menu as a context menu
s.Popup(&astilectron.MenuPopupOptions{PositionOptions: astilectron.PositionOptions{X: astikit.IntPtr(50), Y: astikit.IntPtr(50)}})

// Close popup
s.ClosePopup()

// Destroy the menu
m.Destroy()

A few things to know:

  • when assigning a role to a menu item, go-astilectron won't be able to capture its click event
  • on MacOS there's no such thing as a window menu, only app menus therefore my advice is to stick to one global app menu instead of creating separate window menus
  • on MacOS MenuItem without SubMenu is not displayed

Tray

// New tray
var t = a.NewTray(&astilectron.TrayOptions{
    Image:   astikit.StrPtr("/path/to/image.png"),
    Tooltip: astikit.StrPtr("Tray's tooltip"),
})

// Create tray
t.Create()

// New tray menu
var m = t.NewMenu([]*astilectron.MenuItemOptions{
    {
        Label: astikit.StrPtr("Root 1"),
        SubMenu: []*astilectron.MenuItemOptions{
            {Label: astikit.StrPtr("Item 1")},
            {Label: astikit.StrPtr("Item 2")},
            {Type: astilectron.MenuItemTypeSeparator},
            {Label: astikit.StrPtr("Item 3")},
        },
    },
    {
        Label: astikit.StrPtr("Root 2"),
        SubMenu: []*astilectron.MenuItemOptions{
            {Label: astikit.StrPtr("Item 1")},
            {Label: astikit.StrPtr("Item 2")},
        },
    },
})

// Create the menu
m.Create()

// Change tray's image
time.Sleep(time.Second)
t.SetImage("/path/to/image-2.png")

Notifications

// Create the notification
var n = a.NewNotification(&astilectron.NotificationOptions{
	Body: "My Body",
	HasReply: astikit.BoolPtr(true), // Only MacOSX
	Icon: "/path/to/icon",
	ReplyPlaceholder: "type your reply here", // Only MacOSX
	Title: "My title",
})

// Add listeners
n.On(astilectron.EventNameNotificationEventClicked, func(e astilectron.Event) (deleteListener bool) {
	log.Println("the notification has been clicked!")
	return
})
// Only for MacOSX
n.On(astilectron.EventNameNotificationEventReplied, func(e astilectron.Event) (deleteListener bool) {
	log.Printf("the user has replied to the notification: %s\n", e.Reply)
	return
})

// Create notification
n.Create()

// Show notification
n.Show()

Dock (MacOSX only)

// Get the dock
var d = a.Dock()

// Hide and show the dock
d.Hide()
d.Show()

// Make the Dock bounce
id, _ := d.Bounce(astilectron.DockBounceTypeCritical)

// Cancel the bounce
d.CancelBounce(id)

// Update badge and icon
d.SetBadge("test")
d.SetIcon("/path/to/icon")

// New dock menu
var m = d.NewMenu([]*astilectron.MenuItemOptions{
    {
        Label: astikit.StrPtr("Root 1"),
        SubMenu: []*astilectron.MenuItemOptions{
            {Label: astikit.StrPtr("Item 1")},
            {Label: astikit.StrPtr("Item 2")},
            {Type: astilectron.MenuItemTypeSeparator},
            {Label: astikit.StrPtr("Item 3")},
        },
    },
        {
        Label: astikit.StrPtr("Root 2"),
        SubMenu: []*astilectron.MenuItemOptions{
            {Label: astikit.StrPtr("Item 1")},
            {Label: astikit.StrPtr("Item 2")},
        },
    },
})

// Create the menu
m.Create()

Global Shortcuts

Registering a global shortcut.

// Register a new global shortcut
isRegistered, _ := a.GlobalShortcuts().Register("CmdOrCtrl+x", func() {
    fmt.Println("CmdOrCtrl+x is pressed")
})
fmt.Println("CmdOrCtrl+x is registered:", isRegistered)  // true

// Check if a global shortcut is registered
isRegistered, _ = a.GlobalShortcuts().IsRegistered("Shift+Y") // false

// Unregister a global shortcut
a.GlobalShortcuts().Unregister("CmdOrCtrl+x")

// Unregister all global shortcuts
a.GlobalShortcuts().UnregisterAll()

Dialogs

Add the following line at the top of your javascript file :

const { dialog } = require('electron').remote

Use the available methods.

Basic auth

// Listen to login events
w.OnLogin(func(i astilectron.Event) (username, password string, err error) {
	// Process the request and auth info
	if i.Request.Method == "GET" && i.AuthInfo.Scheme == "http://" {
		username = "username"
		password = "password"
	}
    return
})

Features and roadmap

  • custom branding (custom app name, app icon, etc.)
  • window basic methods (create, show, close, resize, minimize, maximize, ...)
  • window basic events (close, blur, focus, unresponsive, crashed, ...)
  • remote messaging (messages between GO and Javascript)
  • single binary distribution
  • multi screens/displays
  • menu methods and events (create, insert, append, popup, clicked, ...)
  • bootstrap
  • dialogs (open or save file, alerts, ...)
  • tray
  • bundler
  • session
  • accelerators (shortcuts)
  • dock
  • notifications
  • loader
  • file methods (drag & drop, ...)
  • clipboard methods
  • power monitor events (suspend, resume, ...)
  • desktop capturer (audio and video)
  • window advanced options (add missing ones)
  • window advanced methods (add missing ones)
  • window advanced events (add missing ones)
  • child windows

Cheers to

go-thrust which is awesome but unfortunately not maintained anymore. It inspired this project.