Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
336a471
docs: Adds the Linux port plan.
BenAuerDev Nov 26, 2026
effd3d6
feat: Adds the Linux runner with CEF wired in by hand.
BenAuerDev Nov 26, 2026
144eefa
feat: Gives Linux its data folder, menu strip, fonts and Ctrl shortcuts.
BenAuerDev Nov 26, 2026
9209030
test: Runs the legacy toolchain tests on macOS only.
BenAuerDev Nov 26, 2026
c066eec
Merge pull request #1 from BenAuerDev/linux/1-app-runs
BenAuerDev Nov 26, 2026
e41abcf
Merge branch 'main' into linux/port
BenAuerDev Nov 26, 2026
73b1c89
feat: Checks Linux's system packages and gives the distro's command t…
BenAuerDev Nov 26, 2026
4e9c945
feat: Installs Flutter and the Serverpod CLI on Linux where their own…
BenAuerDev Nov 26, 2026
484e995
Merge pull request #2 from BenAuerDev/linux/2-setup
BenAuerDev Nov 26, 2026
f5918c6
fix: Answers the Linux preview's method calls on GTK's main thread.
BenAuerDev Nov 27, 2026
8ebaeb9
fix: Keeps the Linux preview's frames and renderers safe across CEF's…
BenAuerDev Nov 27, 2026
c835c75
build: Stops the Linux plugin from patching the app's runner at confi…
BenAuerDev Nov 27, 2026
798098c
fix: Gives CEF its own cache folder inside App Studio's data folder o…
BenAuerDev Nov 27, 2026
ab31c4d
fix: Lets App Studio's shortcuts through while the Linux preview has …
BenAuerDev Nov 27, 2026
acf9b60
fix: Copies and pastes between the Linux preview and other apps throu…
BenAuerDev Nov 27, 2026
ef5bc32
Merge pull request #3 from BenAuerDev/linux/3-preview
BenAuerDev Nov 27, 2026
72d7cd8
Merge branch 'main' into linux/port
BenAuerDev Nov 27, 2026
04af55d
fix: Keeps the Linux preview from asking for a desktop keyring.
BenAuerDev Nov 27, 2026
335fac7
Merge pull request #4 from BenAuerDev/linux/3b-keyring
BenAuerDev Nov 27, 2026
038135b
fix: Ends App Studio without exit handlers once Flutter quits on Linux.
BenAuerDev Nov 27, 2026
b2bdddb
fix: Waits for the running exit teardown on a second exit request on …
BenAuerDev Nov 27, 2026
7d2ce49
Merge pull request #5 from BenAuerDev/linux/1b-clean-exit
BenAuerDev Nov 27, 2026
5af84d8
Merge branch 'main' into linux/port
BenAuerDev Nov 27, 2026
c5bbafd
feat: Packs the Linux build into an AppImage.
BenAuerDev Nov 27, 2026
0203a32
fix: Lets launchers find App Studio by typing "appstudio".
BenAuerDev Nov 27, 2026
4721041
Merge pull request #6 from BenAuerDev/linux/4-packaging
BenAuerDev Nov 27, 2026
3e4dd74
feat: Says why the AppImage cannot start on a system that cannot load…
BenAuerDev Nov 27, 2026
2a51c15
docs: Adds the plan for adding the AppImage to the app menu.
BenAuerDev Nov 27, 2026
2efdaa1
feat: Offers to add the AppImage to the app menu on Linux.
BenAuerDev Nov 28, 2026
9cd4e51
feat: Updates the Linux AppImage from inside the app.
BenAuerDev Nov 28, 2026
97a09ac
fix: Shows App Studio's icon in the app menu right after Add.
BenAuerDev Nov 28, 2026
a428f6c
Merge pull request #7 from BenAuerDev/linux/4b-appimage
BenAuerDev Nov 28, 2026
e543bc0
fix: Keeps a version from the update feed out of the menu entry's oth…
BenAuerDev Nov 28, 2026
1ce7049
fix: Keeps the Linux update offer off New Project and Settings.
BenAuerDev Nov 28, 2026
6428ac6
fix: Lets Cancel stop a Linux update download at once.
BenAuerDev Nov 28, 2026
e4f5988
fix: Updates the app menu's copy after Add had to copy rather than move.
BenAuerDev Nov 28, 2026
c660b3a
fix: Skips closed browsers when Ctrl+F12 looks for the focused one.
BenAuerDev Nov 28, 2026
d01718f
fix: Stops the Linux release scripts early on a setup they cannot use.
BenAuerDev Nov 28, 2026
be89778
test: Makes two Linux desktop entry tests able to fail.
BenAuerDev Nov 28, 2026
17d197b
docs: Describes the Linux port as built.
BenAuerDev Nov 28, 2026
2cf728b
Merge pull request #8 from BenAuerDev/linux/4c-review-fixes
BenAuerDev Nov 28, 2026
991a080
fix: Lets App Studio start from a terminal as a background job on Linux.
BenAuerDev Nov 28, 2026
c7f1031
fix: Says Add copies the AppImage where it cannot move it.
BenAuerDev Nov 28, 2026
b2bce8d
Merge pull request #9 from BenAuerDev/linux/4d-terminal-start
BenAuerDev Nov 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ migration:
- platform: windows
create_revision: abaf9c523780a608bd46686fd5e53740a07077f8
base_revision: abaf9c523780a608bd46686fd5e53740a07077f8
- platform: linux
create_revision: 737ba8f885dc774b53b442759999a312c9461e4e
base_revision: 737ba8f885dc774b53b442759999a312c9461e4e

# User provided section

Expand Down
92 changes: 91 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# App Studio — agent notes

macOS Flutter IDE for **Serverpod 4.1** projects: open a project, start or attach to its Serverpod runner, show the runner's structured log natively, and preview the Flutter web app in CEF at the URL the runner publishes.
Flutter IDE for **Serverpod 4.1** projects, on macOS, Windows and Linux: open a project, start or attach to its Serverpod runner, show the runner's structured log natively, and preview the Flutter web app in CEF at the URL the runner publishes.

## Project layout

Expand All @@ -21,8 +21,10 @@ widgetbook/ # `make widgetbook`: catalog, host, fakes (see Widgetbo
packages/
mac_menu_bar/ # Local fork — SF Symbol icons, separators, reset()
webview_cef/ # Local fork — CEF resize + skip Helper (Alerts)
linux/ # GTK runner (CEF hooks, _exit on quit), release.json
tool/
distribute_macos.sh, publish_*.sh, set_version.sh # releasing the app
linux/build_appimage.sh, linux/appcast.sh # the Linux AppImage and its feed
```

UI reference for design patterns: `../cloudui/cloudui_flutter/`.
Expand Down Expand Up @@ -889,6 +891,7 @@ Earlier builds kept every tool under
- **It is a fallback, not a replacement.** `_which` tries the inherited `PATH` first and only then spawns a shell (~80 ms). The result — including a failure — is memoised per `ToolProbe`.
- **Discovery only.** Candidates found this way are still executed by absolute path under the probe's own controlled environment.
- **Do not wait for the shell's stdout to reach EOF.** The shell's children inherit that pipe, so an rc that backgrounds anything holds it open long after the answer is written. The reader completes on the closing marker instead, which is also what makes the timeout fire. `${PATH}` is braced for the same class of reason: unbraced, the trailing marker is read as part of the variable *name* and the answer comes back silently empty.
- **On Linux the shell runs in a session of its own, with no terminal** (`ProcessStartMode.detachedWithStdio`, which calls `setsid`). Started from a terminal as a background job (`./AppStudio….AppImage &`), App Studio shares that terminal, and an interactive bash opens it for job control: the terminal stops the whole process group with SIGTTIN, App Studio included, and not even the timeout fires. Seen on Ubuntu as `Stopped (tty input)`. The pipes still carry the answer, and `kill` still reaches the shell. macOS keeps the normal start.
- **Serverpod's candidates check `~/Library/Application Support/Dart/install/bin` first**, ahead of `~/.pub-cache/bin`. That is where `dart install serverpod_cli` puts it; the pub-cache copy is the one that goes stale.
- `PUB_CACHE` is deliberately **not** set: `package_config.json` stores absolute paths, so a private cache would make every switch to an external editor re-resolve the project.
- Version rules live in `tool_version.dart`. A numeric-only suffix is a *packaging revision*, not a prerelease — `2.53.0-3` is newer than `2.53.0`, while `4.0.0-beta.1` is older than `4.0.0`.
Expand Down Expand Up @@ -2174,6 +2177,7 @@ Windows needs Developer Mode, then Git for Windows, Flutter and Serverpod
go to the page.
- **Menus:** a shad menu strip (`windows_app_menu.dart`) with Ctrl
shortcuts. It repeats `MacAppMenu`'s enable rules, so change both together.
Linux mounts the same strip (see Linux).
- **Tooltips and copy** use `shortcutHint()`.
- **Notifications:** toasts from the runner (`toast_notifications.cpp`). They
need the installer's Start menu shortcut.
Expand Down Expand Up @@ -2227,6 +2231,92 @@ The repository is public, so the GitHub API works without a token. It allows
not count against that limit. Logs need a GitHub sign-in, but annotations
do not, which is why the jobs report through `::notice`/`::error`.

## Linux

The plan and what was built are in `specs/linux_port.md`; the AppImage's
app menu entry and in-app updates are in `specs/linux_appimage.md`. As with
Windows, macOS and Windows must not regress: every Linux path is behind a
host check (`currentHost.isLinux`, `HostPlatform.linux` in tests), and
`packages/webview_cef/common/` changes only behind `__linux__`, or where the
change is behaviour-neutral on all three (a null check, say).

### Dev machine

- Flutter 3.44+ on `PATH`, plus Flutter's Linux desktop dependencies
(Ubuntu: `clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
libstdc++-12-dev`; Arch: `clang cmake ninja pkgconf gtk3`). CEF downloads on the first CMake configure.
- `flutter run -d linux`. The Makefile's run targets (`start`,
`widgetbook`, the `_driver` ones) are macOS only and run `pod install`, so
on Linux the Dart MCP server's rule "launch through `make`" cannot be
followed: run `flutter run -d linux` (or `-t widgetbook/main.dart`)
yourself, and check first that the user has no run of their own going.
- `make appimage` builds `dist/linux/AppStudio-<version>-x86_64.AppImage`.
The AppImage needs glibc 2.38 on the machine it runs on (Ubuntu 24.04+);
its `AppRun` says so on an older one. A release build rewrites
`linux/flutter/generated_plugin*` and the Windows ones; the script puts
them back. Never commit that change.
- `flutter test` and an IDE's automatic `pub get` rewrite `pubspec.lock` on
a machine with another Dart. Do not commit it.
- There is no AF_UNIX crash on Linux: the `process` tests run as on macOS.

### Where things are

| What | Linux |
|---|---|
| App data and preferences | `$XDG_DATA_HOME/dev.serverpod.appstudio` (`~/.local/share/…`), one folder |
| CEF cache | `<app data>/CEF`, set by `linux/runner/main.cc` before CEF starts |
| Flutter | `~/develop/flutter`, from `releases_linux.json` (`.tar.xz`) |
| Serverpod CLI | `$XDG_STATE_HOME/Dart/install/bin` (`~/.local/state/…`) |
| `PATH` | `~/.zshenv` (or `$ZDOTDIR/.zshenv`) for zsh, `~/.bashrc` for bash, `~/.profile` for sh and ksh; fish by hand |
| System packages | git, curl, unzip, xz: checked, never installed (no `sudo`); setup gives the distro's command and **Check again** |
| The app | an AppImage; after Add to Applications, `~/AppImages/AppStudio-x86_64.AppImage` |

### The window, CEF and keys

- **Quitting:** every way out (close button, the window manager's close,
File → Quit, Ctrl+Q) reaches `_onExitRequested`. A second request while
the teardown runs waits for it, at most 15 s (`_kLinuxExitWait`); macOS
and Windows answer at once. `linux/runner/main.cc` then ends with
`_exit()`: Flutter's Linux quit leaves the engine running, and `exit()`
raced Mesa's exit handlers against the raster thread and crashed. Do not
turn it back into a `return`.
- **CEF's helpers start from the app's own executable**, so
`initCEFProcesses` runs first in `main()`. The plugin's own patch script
targets a file current Flutter no longer generates and is out of its
CMake.
- **Minimum window** 670×600, Windows' (`my_application.cc`), not macOS's
720. No compact window: Wayland does not let a program place its window.
- **Keys in the preview:** the page gets them; Ctrl on any other character
key stays the app's shortcut. Ctrl+A/C/V/X/Y/Z stay with the page.
- **Clipboard goes through GTK.** On Wayland only a focused window may use
the clipboard, and CEF draws off-screen. Ctrl+C/X copy the page's
selection to GTK's clipboard; Ctrl+V types the clipboard's text into the
page. No paste event reaches the page, and a copy made by the page's own
code (`Clipboard.setData`) does not leave it.
- **Chromium's keyring is off** (`password-store=basic`): otherwise a
desktop without an unlocked keyring (a fresh Ubuntu, automatic login)
asks the user to create one as soon as the preview loads.
- **Menus:** the Windows strip (`windows_app_menu.dart`), with Quit on
Ctrl+Q instead of Exit on Alt+F4, Add to / Remove from Applications in
Help, and no Uninstall yet. **Fonts:** shad's Inter, as on Windows, and
the generic `monospace`. **URLs:** `xdg-open`.

### The AppImage

- **Add to Applications** (`lib/platform/linux/desktop_integration.dart`)
moves the AppImage to `~/AppImages` and writes
`dev.serverpod.appstudio.desktop` with an `X-AppStudio-AddedBy` marker,
recording the version and build. It is offered once per run over the
start page, unless another tool's entry already names App Studio.
- **Updates** (`lib/update/linux/`) are App Studio's own, from a Sparkle
appcast with an Ed25519 signature over the file, written by
`tool/linux/appcast.sh`. The feed URL and public key are in
`linux/release.json`; both empty means no updates, and the build refuses
only one. The feed itself is not signed: nothing from it but the file may
be trusted, which is why the version is validated before it reaches the
desktop entry. The automatic check only runs over the start page with
nothing pushed over it, since Install quits the app.

## Conventions for agents

- After a UI change, look at it running — Widgetbook through the Dart MCP
Expand Down
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
# make publish Upload the built zip + refresh downloads/macos.json
# make build_debug Unsigned zip, local only
#
# Linux:
# make appimage Release build packed as an AppImage in dist/linux
#
.DEFAULT_GOAL := help

# Recipes use [[ ]] and read -p.
Expand All @@ -33,7 +36,7 @@ CEF_STAMP := $(ROOT)/packages/webview_cef/macos/third/cef/version.txt

.PHONY: help start deps ensure_deps widgetbook start_driver widgetbook_driver \
clean clean_all \
set_version release build build_debug publish promote
set_version release build build_debug publish promote appimage

help:
@echo "Run locally:"
Expand All @@ -57,6 +60,9 @@ help:
@echo " make publish Upload the built zip + refresh the download links"
@echo " make build_debug Unsigned zip, local only"
@echo ""
@echo "Linux:"
@echo " make appimage Release build packed as an AppImage in dist/linux"
@echo ""
@echo "The app installs Flutter and the Serverpod CLI from their official"
@echo "sources on first run, so no toolchain is needed to build or ship it."

Expand Down Expand Up @@ -199,3 +205,16 @@ promote:
@read -r -p "Make this build the live auto-update for every install? [y/N] " a; \
[[ $$a == [yY]* ]] || { echo "aborted"; exit 1; }
cd "$(ROOT)" && ./tool/publish_appcast.sh

# ---------------------------------------------------------------------------
# Linux
#
# Builds on the machine it runs on and uploads nothing: hosting, the update
# feed and the release pipeline are Serverpod's. CEF downloads during the first CMake
# configure, so there is no deps step. FLUTTER, SKIP_BUILD, APPIMAGETOOL,
# APPIMAGE_UPDATE_INFO and APPIMAGE_FILE_URL are read from the environment;
# see the script.
# ---------------------------------------------------------------------------

appimage:
cd "$(ROOT)" && ./tool/linux/build_appimage.sh
5 changes: 5 additions & 0 deletions assets/toolchain_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"displayName": "Git for Windows",
"description": "The git Flutter runs on."
},
{
"id": "system_packages",
"displayName": "System packages",
"description": "git, curl, unzip and xz from your distribution. Flutter runs on them."
},
{
"id": "flutter",
"displayName": "Flutter",
Expand Down
Loading