Go-toy is a toy Wails app whose purpose is to illustrate how to build a desktop app that can register a Go service as a background task in the OS, and interact with it.
The background task is a logger that writes to a file in the OS with a status update every ten seconds.
The GUI frontend is a Svelte app.
go.mod)go install github.com/wailsapp/wails/v2/cmd/[email protected]
This project targets webkit2gtk-4.1 (see wails.json).
sudo apt update
sudo apt install -y build-essential pkg-config libgtk-3-dev libwebkit2gtk-4.1-dev
xcode-select --install
To run in live development mode, run wails dev in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
If you are using a Linux distribution that does not have webkit2gtk-4.0 (such as Ubuntu 24.04), you will need to run wails dev -tags webkit2_41.
The app can install the background task as a systemd user service (no sudo, runs while you’re logged in). There’s also an optional system-wide install path, which requires admin privileges.
To build a redistributable, production mode package, use wails build (again with the -tags webkit2_41 if you don't have webkit2gtk-4.0).