0004-app-toml-format-1.md (3918B)
1 # 0004. app.toml, format 1 2 3 Date: 2026-10-16 4 5 ## Status 6 7 Proposed 8 9 ## Context 10 11 An app is a folder, `~/Apps/Name.app`, with an `app.toml` saying how to run it (ADR-0002), and 12 it will run in a thin jail on the base it names (ADR-0003). People will package apps against 13 this file, so it needs settling before code depends on it: what's required, what's optional, 14 how it grows, and what a launcher must refuse. 15 16 The runner doesn't exist yet. The first launcher to read the format (patina-desktop's) runs 17 every app straight on the running system, so the format has to make sense both before and 18 after the runner arrives. 19 20 ## Decision 21 22 ```toml 23 format = 1 # required: the version of this file's format 24 name = "Teleprinter" # required: shown in the launcher 25 exec = "bin/teleprinter" # required: the program, inside the folder 26 27 id = "com.sectorflabs.Teleprinter" # reverse-DNS; the default is the folder's name 28 summary = "Messages" # one line under the name, like a .desktop GenericName 29 comment = "Chat over the terminal" 30 keywords = ["chat", "messages"] # searched as well as the name 31 categories = ["Network"] # freedesktop main categories 32 icon = "icon.svg" # inside the folder: SVG or PNG 33 args = ["--window"] # passed to the program, after it 34 terminal = false # run it in a terminal 35 platform = 1 # the Patina platform it's built for (ADR-0005) 36 base = "patina-os:1@sha256:..." # the image it runs on (ADR-0002); see below 37 ``` 38 39 A program for more than one OS or CPU names one per target, as `{os}-{arch}` (Rust's 40 `std::env::consts::OS` and `ARCH`), the way a macOS app can carry Intel and Arm binaries: 41 42 ```toml 43 [exec] 44 linux-x86_64 = "bin/linux-x86_64/teleprinter" 45 linux-aarch64 = "bin/linux-aarch64/teleprinter" 46 freebsd-x86_64 = "bin/freebsd-x86_64/teleprinter" 47 ``` 48 49 The rules a launcher follows: 50 51 - **Only folders named `*.app`** directly in `~/Apps` are apps; others, and hidden ones, are 52 left alone. 53 - **Paths stay inside the folder**: `exec` and `icon` are relative, and may not be absolute or 54 climb out with `..`. An app that breaks this isn't listed. 55 - **`exec` must be there and executable** on this platform, or the app isn't listed. With a 56 table and no entry for this platform, it isn't listed either. 57 - **`format` decides what's understood**: a launcher lists only formats it knows, and says why 58 it skipped the others. Within a format, keys it doesn't know are ignored, so optional keys 59 can be added without a new format; a new format is for changes old launchers would get wrong. 60 - **The program runs from the user's home folder**, with `args` after it. It finds its own 61 folder from its executable's path (`std::env::current_exe`), not from anything the launcher 62 sets, so it works however it's started. 63 - **`platform` is optional**: the Patina platform the app is built for (ADR-0005), which it 64 relies on for everything it doesn't bring. It's what most apps name. 65 - **`base` is optional in format 1.** Until the runner (ADR-0003) exists, every app runs on the 66 running system, and `base` is only recorded. Without one, an app runs on the running system 67 for good: its author takes on what that means. 68 - **File types, URL schemes and commands** (ADR-0002) aren't in format 1. They come when 69 something opens files and links by them, as optional keys. 70 71 ## Consequences 72 73 - Packaging an app is a folder, a binary and a few lines of TOML; nothing is installed and 74 nothing needs root. 75 - The same file works on Linux and FreeBSD, with one binary for each. 76 - A launcher written for format 1 keeps working as optional keys are added, and refuses, with a 77 reason, an app it can't run correctly. 78 - Apps without `base` run on whatever system they're on, as AppImages do; with one, the runner 79 will give them that base exactly, once it exists.