DEV Community

Czax225
Czax225

Posted on

Stop Fighting Go GUIs: Build Sleek Desktop Apps in Pure Go with Proton

The state of GUI development in Go has always been a bit complicated.

You either have to wrestle with heavy C-dependencies like GTK and Qt bindings that make cross-compiling a nightmare, or settle for web-view frameworks that turn a simple desktop utility into a 150MB RAM-hogging Electron clone.

If you love Go for its simplicity, speed, and single-binary deployment, your GUI library should look and feel the same way.

That is exactly why I built Proton.

What is Proton?

Proton is a lightweight, pure-Go GUI framework built on top of the incredibly fast Gio engine. It utilizes an immediate-mode architecture, meaning your UI renders dynamically every single frame.

The philosophy behind Proton is straightforward: Zero C-dependencies, ultra-fast performance, and a developer experience that does not make you want to pull your hair out.

Here is why it works so well:

Pure Go: No cgo required. Cross-compiling actually works out of the box.

Featherweight: Tiny binary sizes and low resource usage.

Immediate Mode: Your state lives directly in your code. No complex data-binding boilerplate.

Themeable: Comes with built-in palettes like Catppuccin, Nord, and Rose Pine.

See it in Action: The 5-Minute Setup

Here is a complete, self-contained application with an input box, a button, and basic text handling in just a few lines of code:

package main

import "github.com/CzaxStudio/proton"

type UI struct {
    name proton.Editor
    btn  proton.Clickable
}

func main() {
    u := &UI{}
    a := proton.New("My First Proton App")

    // Apply a theme instantly
    a.ApplyPalette(proton.CatppuccinPalette)

    a.Window("Hello Proton", 480, 300, func(win *proton.Win) {
        proton.H3(win, "Welcome to Go GUIs done right")
        proton.Gap(win, 12)

        // Interactive Input
        proton.Input(win, &u.name, "What is your name?")
        proton.Gap(win, 12)

        // Immediate-mode button handling
        if proton.Button(win, &u.btn, "Greet Me") {
            println("Hello, ", u.name.Text())
        }
    })

    a.Run()
}
Enter fullscreen mode Exit fullscreen mode

Layouts Without the Headache

If you have ever used Gio directly, you know that managing layouts and constraints can require a lot of nesting. Proton abstracts that complexity away into intuitive layout functions:

Stacking: Arrange components cleanly using Row(win, ...) and Column(win, ...).

Flexibility: Use GrowRow alongside GrowItem and FixedItem to create responsive sidebars and expanding content panes.

Proportions: Instantly split screens using Split(win, 0.25, leftSide, rightSide) for instant dashboard layouts.

Spacing: Fine-tune visuals cleanly with Pad(), PadH(), and Gap()

// Example of a quick responsive layout split
proton.Split(win, 0.25, func(left *proton.Win) {
    proton.Label(left, "Sidebar Navigation")
}, func(right *proton.Win) {
    proton.H1(right, "Main Content Dashboard")
})
Enter fullscreen mode Exit fullscreen mode

Real Features for Real Apps

Proton is not just a proof-of-concept for text and buttons. It includes the actual utilities you need to build functional software:

Virtualized Lists: List() and HList() only render what is visible on screen, letting you scroll through thousands of rows smoothly without breaking a sweat.

Keyboard Shortcuts: Global hotkeys are a first-class citizen. Fire events using proton.OnKey(win, key.ModCtrl, "S", saveFunc).

Async Notifications: Show modern, non-blocking toast notifications safely from any background goroutine using u.toast.Show("Saved!", 2 * time.Second).

Asset Embedding: Includes a simple built-in CLI tool (Proton logo path/to/img.png) that caches and bakes assets directly into your binary.

Try it out

Ready to ditch the heavy web frameworks and complex C bindings? Getting started takes seconds. Just initialize your Go module and pull the library:

mkdir myapp && cd myapp
go mod init myapp
go get github.com/CzaxStudio/proton
Enter fullscreen mode Exit fullscreen mode

If you are on Linux, just grab your standard graphics drivers (libwayland-dev, libxkbcommon-dev, libvulkan-dev). Windows and macOS users need zero extra system dependencies.

The project is completely open-source and moving fast. Check out the example applications, including a fully functional Calculator and a CyberTool showcase, directly in the repository.

Take a look at the Proton GitHub Repository, try out the examples, and let me know what you think in the comments. I am curious to see what you build with it.

If you like it then please star the Repo

GitHub logo CzaxStudio / proton

A framework for building GUI applications in Go, Stay positive :)

Proton

A GUI library for Go. Built on Gio. No C deps, pure Go.

Example apps (made using Proton)

Note: These are very basic, you can make even better apps.

GUI demo
Example app 2

Logo

Proton

Getting started

package main
import "github.com/CzaxStudio/proton"

type UI struct {
    name proton.Editor
    btn  proton.Clickable
}

func main() {
    u := &UI{}
    a := proton.New("my app")
    a.Window("Hello", 480, 300, func(win *proton.Win) {
        proton.H3(win, "Hello from Proton!")
        proton.Gap(win, 8)
        proton.Input(win, &u.name, "Your name")
        proton.Gap(win, 8)
        if proton.Button(win, &u.btn, "Go") {
            println("Hello,", u.name.Text())
Enter fullscreen mode Exit fullscreen mode

Top comments (0)