Skip to content

energye/energy

Repository files navigation

3.0

A Go framework for building cross-platform desktop applications based on LCL & CEF & Webview (Webview2, Webkit2)

中文 | English


go-version github release Build Status repo Go Report Go Reference Ask DeepWiki Discord codecov contributors license

Energy is a framework developed in Go using: LCL, CEF, Webview2, Webkit2Gtk, WKWebView

LCL — Native UI component library

CEF — Browser component, CEF3 via CEF4Delphi

Webview2 — Browser component, Webview2 via WebView4Delphi; uses the system runtime

Webkit2 (Webkit2Gtk / WKWebView) — Browser component, Webkit2; uses the system runtime

Features

  • Three rendering engines: LCL native controls (lightweight, system look), Webview system runtime (WebView2 / WebKit2, no extra dependencies), CEF full Chromium (complete browser capabilities). Use them together or independently
  • Visual designer: Energy Designer supports drag-and-drop components, property/event configuration, and one-click run preview, generating maintainable Go source code
  • 100+ native controls: Based on LCL, providing 100+ system-native GUI components including buttons, grids, tree views, list views, dialogs, code editors, and more
  • Go + Web hybrid architecture: Go backend handles window management, system calls, file I/O, encryption, etc.; Web frontend (HTML + CSS + JavaScript) handles UI rendering. Supports Vue, React, Angular, and other mainstream frontend frameworks
  • Bidirectional IPC: High-performance event-driven IPC enabling Go and Web to call each other and exchange data, with callback support and automatic type conversion
  • Local resource loading: Custom protocol scheme to load local files or Go embedded resources directly, without an HTTP server; HTTP server loading is also supported
  • Cross-platform: Windows (7+), macOS (Intel / Apple Silicon), Linux (x86 / ARM)
  • NO CGO: Optionally develop in pure Go — no CGO compilation required, lowering the environment setup barrier

Development Environment

  • Golang >= 1.20
  • Energy development environment ([CEF or System Runtime], libenergy runtime)
  1. Install Golang
  2. Create a project from Energy Designer Releases

Quick Start

LCL Native Mode

package main

import (
	"github.com/energye/lcl/api"
	"github.com/energye/lcl/lcl"
)

type TMainForm struct {
	lcl.TEngForm
}

var MainForm TMainForm

func main() {
	lcl.Init()
	lcl.RunApp(&MainForm)
}

func (m *TMainForm) FormCreate(sender lcl.IObject) {
	m.SetCaption("Hello Energy")
	m.SetWidth(400)
	m.SetHeight(300)
	m.WorkAreaCenter()

	btn := lcl.NewButton(m)
	btn.SetParent(m)
	btn.SetCaption("Click Me")
	btn.SetLeft(50)
	btn.SetTop(50)
	btn.SetOnClick(func(sender lcl.IObject) {
		api.ShowMessage("Hello from Go!")
	})
}

Webview Hybrid Mode

package main

import (
	"github.com/energye/energy/v3/application"
	"github.com/energye/energy/v3/window"
	"github.com/energye/energy/v3/wv"
	"github.com/energye/lcl/lcl"
	"github.com/energye/lcl/types"
)

type TForm1 struct {
	window.TWindow
	Webview1 wv.IWebview
}

var Form1 TForm1

func (m *TForm1) FormCreate(sender lcl.IObject) {
	m.TWindow.InternalBeforeFormCreate() // window create before call
	m.SetCaption("Hello Energy")
	m.SetWidth(800)
	m.SetHeight(600)

	m.Webview1 = wv.NewWebview(m)
	m.Webview1.SetAlign(types.AlClient)
	m.Webview1.SetParent(m)

	m.TWindow.FormCreate(sender) // window widget create after call

	m.Webview1.SetWindow(m)
}

func main() {
	wvApp := wv.Init()
	wvApp.SetOptions(application.Options{
		DefaultURL: "https://energye.github.io",
	})
	wv.Run(&Form1)
}

Using Energy Designer

  1. Launch Energy Designer
  2. Create a new project, drag components onto the canvas
  3. Configure properties and events
  4. Click Run to preview

NO CGO

Optionally develop in pure Go — no CGO compilation required

Documentation

Platform Support

Windows MacOS Linux

32-bit 64-bit Tested OS Versions
Windows Windows Windows 7, 10, 11
MacOSX MacOSX MacOSX MacOSX Intel x86
MacOS M1/M2 MacOS MacOS MacOS Apple Silicon
Linux Linux Linux Deepin 20.8, Ubuntu 18.04, LinuxMint 21
Linux ARM Linux ARM Linux ARM Kylin-V10-SP1-2107

Related Projects


If you find this project helpful, please give us a Star!


Screenshots

image


License

license

Contributors

About

Energy is a framework developed by Go language based on CEF (Chromium Embedded Framework) for developing cross-platform desktop applications for Windows, Mac OS X, and Linux

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages