Make your Go application installable with Soft
Add a soft.toml to your module, so that Soft gives your application a menu entry with its name and its logo.
Soft installs any Go program, as go install does. For a desktop application it also writes a menu entry and installs the icons, and for that it needs to know which of your programs are desktop applications. You say so in one file.
Add a soft.toml#
Put a soft.toml at the root of your module, with one [[app]] for each desktop application:
[[app]]
cmd = "./cmd/viewer"
name = "Viewer"
comment = "Looks at pictures"
categories = ["Graphics", "Viewer"]
icons = ["packaging/icons/viewer-*.png", "packaging/viewer.svg"]
| Key | What it says |
|---|---|
cmd | The package of the program, as a path inside the module |
name | The name in the menu |
comment | One line that says what the application does |
categories | The categories of the menu |
icons | The icon files, as paths or patterns inside the module |
A program of your module that has no [[app]] is taken for a command-line program: Soft installs it, and writes no menu entry for it.
An application that runs in a terminal#
Set terminal = true on an [[app]] that runs in a terminal. Soft’s Open then starts it in a terminal window.
[[app]]
cmd = "./cmd/tviewer"
name = "Viewer (terminal)"
terminal = true
An application that needs another program#
Some applications are two programs: a window, and a command-line program that the window cannot work without. Say so with requires, and Soft installs the second program with the first:
[[app]]
cmd = "./cmd/gviewer"
name = "Viewer"
requires = ["./cmd/viewer"]
Each item is written like cmd, so it can only name a program of your own module. This is what Soft does with it:
- When a user installs
gvieweralone, Soft installsviewerfirst, at the same version, and says why. Ifviewercannot be installed,gvieweris not installed either. - While
gvieweris installed,soft remove vieweris refused. The user removesgviewerfirst, or both at once. - A
viewerthat is already installed is left as it is.soft updatekeeps it up to date like any program.
requires needs Soft 0.21 or newer. An older Soft leaves the key out with a warning.
Tube uses it: its window, gtube, requires tube.
An application for Android#
For an application that also runs on Android phones, add the platforms and an id that is its Android application ID:
[[app]]
cmd = "./cmd/viewer"
name = "Viewer"
platforms = ["linux", "macos", "android"]
id = "io.github.someone.viewer"
Soft builds it with glutter-android when your go.mod requires Glutter, or with gomobile when it requires golang.org/x/mobile.
Without a soft.toml#
Without one, Soft reads packaging/<program>.desktop and the icons beside it.
Let people find it#
Give your repository the topic soft-app on GitHub. Soft’s Discover and soft search list the repositories with that topic.
Try it#
Push your changes, and install your application as a user would:
soft install github.com/someone/viewer
soft info viewer
soft info shows everything Soft knows of the program, its menu files among it. Then look for the application in your desktop’s menu.
Soft’s guide has every key and rule of soft.toml.