Linux
Bern compiles the Linux target (platform = "linux") to a native GTK 4 + libadwaita Rust binary linking the engine in-process, targeting distributions with GTK 4.14+ and libadwaita 1.5+ (such as Ubuntu 24.04+, Fedora 40+, Arch, and SteamOS). Linux targets must be built on Linux.
Prerequisites
- Rust 1.99+ (
rustup update). - pkg-config, GTK 4.14+, libadwaita 1.5+, and GStreamer (for media playback):
# Debian / Ubuntu 24.04+
sudo apt install pkg-config libgtk-4-dev libadwaita-1-dev gstreamer1.0-libav
# Fedora 40+
sudo dnf install pkgconf-pkg-config gtk4-devel libadwaita-develIf your target sets webview = true, also install the WebKitGTK 6 development package (e.g., libwebkitgtk-6.0-dev on Ubuntu/Debian or webkitgtk6.0-devel on Fedora).
Verify your toolchain with:
bern doctorConfiguration in Bern.toml
[app]
id = "tasks"
bundle_id = "com.example.tasks"
version = "0.1.0"
name = "Tasks"
publisher = "Example Inc" # Used in .deb Maintainer metadata
[app.icon]
default = "assets/icon.png"
linux = "assets/icons/hicolor" # Optional: square PNG or hicolor icon theme directory
[targets.linux]
platform = "linux"
ui = "gtk"Build, run, and debug
# Build the native binary, .desktop entry, app CLI, and Skill
bern build --target linux
# Build and start the app
bern run --target linuxBuild outputs under target/bern/linux/<Product>/:
<app>— native GTK 4 application binary.resources/— bundled assets, translations, and optional__bern_web_ui/.<bundle_id>.desktop— freedesktop launcher entry.bin/<app>— generated app CLI.skills/<app>/SKILL.md— generated agent Skill.
Drive the running app via its CLI:
target/bern/linux/Tasks/bin/tasks --help
target/bern/linux/Tasks/bin/tasks window screenshot --output linux.pngUseful debugging environment variables:
| Variable | Effect |
|---|---|
BERN_APPEARANCE=light|dark |
Overrides system light/dark color scheme. |
BERN_MOTION=reduce |
Disables spring animations and forces reduced motion. |
BERN_MOTION_LOG=1 |
Prints element motion transforms to stderr. |
BERN_TRACE=<rules> |
Enables performance tracing (or pass --trace to bern run). |
BERN_SNAPSHOT_DIR=<dir> |
Saves automatic window snapshots to <dir>. |
Platform behavior and adaptations
- Header bars & sidebar: Because libadwaita's sidebar header bar already displays the application title (and KDE's button layout shows the app icon),
SidebarHeader(role: title)is omitted automatically on Linux. - System tray & autostart:
StatusItemregisters a StatusNotifierItem with dbusmenu (works on GNOME with AppIndicator, KDE Plasma, and wlroots/Wayland status bars) and keeps the process running after all windows close.Switch(login_item: true)manages an XDG autostart.desktopentry. - Custom media core:
Videoexposes aFrameSinkand GTK frame clock when the engine installs a customMediaKernel. - WebPage and Ubuntu 24.04+ AppArmor: When
webview = trueis enabled,WebPageuses WebKitGTK 6. On Ubuntu 24.04+, AppArmor restricts unprivileged user namespaces for binaries outside an installed AppArmor profile. The.debpackage generated bybern packageinstalls the required AppArmor profile automatically; when running an unpacked.tar.gzor local dev build on Ubuntu 24.04+, either install that profile or setWEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1for local testing only. - File associations & icons:
[[app.opens]]writesMimeType=entries into the.desktopfile.[app.icon].linuxaccepts a PNG or an entirehicolortheme directory. - Native views: Co-located GTK 4 widgets mount via
NativeView(linux: "..."). See Native views.
Packaging and signing
bern package --target linuxbern package --target linux builds a release binary and creates two archives in target/bern/dist/:
<app>_<version>_<arch>.deb— Debian/Ubuntu package installing into/opt/<bundle_id>, symlinking the CLI/binary to/usr/bin/<app>, installing.desktop, hicolor icons, and (whenwebview = true) the WebKitGTK AppArmor profile.<app>-<version>-linux-<arch>.tar.gz— portable tarball with the app binary, resources,.desktop, CLI, and Skill.