D-Bus interfaces
Luft’s services talk to apps over D-Bus, each under a com.lantharos name, and the checks hold every copy of an interface to one source of truth. The interfaces only Luft’s own helpers may call are in Kestrel’s prompts.
Errors
Section titled “Errors”A failed call says what went wrong in a way apps can show in the person’s language.
- An error is named
<interface>.Error.<Kind>, such ascom.lantharos.Accounts1.Error.Unsynced. Apps decide what to show by the kind, so a kind doesn’t change once shipped. NotAuthorized, when polkit said no, andFailed, for anything without a kind of its own, exist on every service. A service adds a kind whenever an app needs to tell that failure apart: to translate it, to offer a way out, or to ask the person something.NotInstalledcarries the missing model’s id, so the app can offer the download.- The message is one plain English sentence the service wrote itself, which an app shows when it has no translation for the kind. It never carries what a tool printed, a system error or a path the person didn’t name; those go to the journal.
In a service, luft_dbus::errors! declares the kinds:
luft_dbus::errors!("com.lantharos.Windows1.Error" { DriveOpen, NotShutDown,});Code that returns anyhow::Result names a failure by returning the error itself, Err(Error::DriveOpen("…".to_owned()).into()), and it keeps its kind on the way out. Any other error becomes Failed, with the words of its outermost context, bail! or anyhow! when the service wrote those, and “Something went wrong. Try again.” when it’s a raw error from a tool or the system. So put what the person should read in .context("…") and leave the cause underneath. luft_dbus::polkit::authorize answers NotAuthorized by itself.
In an app, luft_dbus::error::kind(&error) gives the kind of a failed call and luft_dbus::explain(&error) its message. Map the kinds the page cares about to translated strings, and fall back to the message for the rest.
Kestrel
Section titled “Kestrel”These are on com.lantharos.Kestrel on the session bus. Sandboxed apps may only read Appearance, which Colours and motion describes, and make the three calls marked below.
| Interface and path | Does |
|---|---|
com.lantharos.Kestrel.OpenWindows, /com/lantharos/Kestrel/OpenWindows |
List returns each app’s desktop file ID with its windows, each as the process ID, title and whether it answers Kestrel’s checks; Changed follows. Barometer uses it to group apps by window and mark the ones not responding |
com.lantharos.Kestrel.Share, /com/lantharos/Kestrel/Share |
Send(a(sh) files) opens the Send sheet for files handed over as names and open file descriptors, where people pick a device nearby or an app. Only the app whose window is in front may call it, sandboxed or not, and at most five sheets a minute |
com.lantharos.Kestrel.Sounds, /com/lantharos/Kestrel/Sounds |
Play(s name) plays a sound of the theme, following the sound switches, at most four a second per caller; sandboxed apps may call it. Preview plays regardless of the switches and Check says whether a file can be a custom sound, both for Settings |
com.lantharos.Kestrel.DriveAccess, /com/lantharos/Kestrel/DriveAccess |
Ask(h app, s drive) → b asks whether a sandboxed app may use a drive. Only Schelf may call it; Kestrel’s prompts has the rules |
com.lantharos.Kestrel.WindowCapture, /com/lantharos/Kestrel/WindowCapture |
RequestAccess() asks the person once whether the calling app may record windows and show notes over games, and returns once it may, or fails with com.lantharos.Kestrel.WindowCapture.Error.Denied. Sandboxed apps may call it; Recording windows has the rest |
com.lantharos.Kestrel.Sharing, /com/lantharos/Kestrel/Sharing |
List returns who sees the screen or sends input now and who may again, Revoke(s id) ends one, and Changed follows. Settings uses it under Privacy; sandboxed apps can’t call it |
com.lantharos.Kestrel.Pens, /com/lantharos/Kestrel/Pens |
The Devices property lists the seat’s pens and drawing tablets, each with the VVVV:PPPP ID GNOME’s tablet settings use, its name, and whether it’s a pen on a screen or a separate tablet |
luft_app::share::send calls Share for a Luft app, handing over the files it holds, so it works from a sandbox.
kestrel-post speaks LocalSend’s protocol for Post. D-Bus starts it as com.lantharos.Kestrel.Post the first time Kestrel calls it. /com/lantharos/Kestrel/Post has the devices nearby, whether it’s looking, its name and the folder files go to as properties, and methods to send files or text, answer offers and PINs, cancel, and pair. Kestrel calls Configure with what people chose in com.lantharos.kestrel.post whenever that changes and whenever kestrel-post starts again, and Settings calls StartPairing and StopPairing. The rest of kestrel-post knows nothing of LocalSend, whose parts live in src/localsend, so another protocol could sit beside it. Network covers who it answers.
Printing
Section titled “Printing”kestrel-settings serves com.lantharos.Settings.Printing at /com/lantharos/Settings/Printing on com.lantharos.Settings, talking to CUPS over its socket with Luft’s own IPP client in packages/system/cups. It subscribes to CUPS’s notifications and sends Changed when printers or jobs change, including each page a printer reports. Jobs returns the jobs not yet done, with the pages printed and the total when CUPS knows it, from job-impressions or else job-media-sheets. CUPS only has a total its client gave it, so jobs sent through Settings and the print portal carry job-impressions: the pages of a PDF in the chosen ranges, or one for a picture, times the copies. Status(s printer) returns a printer’s name for people, its printer-state-reasons and its supplies as (name, level, colors), where colors holds one #rrggbb per colour of a cartridge and a level of -2 means unknown and -3 some left. JobFinished(u job, s printer, s name, u state) follows each of the caller’s jobs that completed, was canceled or aborted. Kestrel’s printing panel uses these, and Settings and the print portal use the rest.
Keyring
Section titled “Keyring”com.lantharos.Keyring1.AppSecrets at /com/lantharos/Keyring1 keeps tokens of an app’s own, without prompts. Secrets travel through file descriptors, never in the message.
| Method | Does |
|---|---|
Store(s app, s name, h secret) |
Keeps up to 1 MiB read from the file descriptor |
Load(s app, s name, h output) → b |
Writes the secret to the file descriptor; false when there is none |
Delete(s app, s name) → b |
Removes it |
List(s app) → as |
The names the app has kept |
app is the caller’s app ID. A sandboxed app can only name its own, so no other sandboxed app reads its secrets. Programs outside a sandbox all run as you, so naming an ID keeps their secrets apart without keeping them from each other (Who an app is). Luft apps use it through luft_app::secrets:
use luft_app::secrets;
secrets::store(APP_ID, "account-token", token.as_bytes()).await?;let token: Option<Vec<u8>> = secrets::load(APP_ID, "account-token").await?;secrets::delete(APP_ID, "account-token").await?;A new kind of data for the keyring gets its own place in the vault’s Contents, and its own module and interface in the daemon next to ssh and manage.
Changing a password
Section titled “Changing a password”com.lantharos.Password1 at /com/lantharos/Password1 on the system bus changes the caller’s own password, for people in an active session at the computer: ChangePassword(h current, h new), both through file descriptors. It checks the new password against the system’s rules, then runs the kestrel-password PAM rules, which need the current password and lock Luft Keyring with the new one in the same step. It answers WrongPassword, TooWeak with the broken rule as its message (too-short, too-similar, dictionary-word, contains-name, too-simple or rejected), or Failed.
It runs as kestrel-password.service, which D-Bus starts for the call and which quits half a minute later, so the login screen’s own settings service has no way to write /etc.
Signing in
Section titled “Signing in”com.lantharos.SignIn1 at /com/lantharos/SignIn1 on the system bus is luft-sign-in, which keeps security keys and smart cards (Security keys and smart cards). Ways(u uid) lists how an account signs in, best first, for anyone. Present lists the accounts whose enrolled key or card is plugged in or in a reader now, only for root. The rest is about the caller’s own account: Methods lists its keys as (id, name, lock_on_removal) and cards as (id, name), whether it signs in with its password and whether it could turn that off; FindSecurityKey, AddSecurityKey(s pin), RemoveSecurityKey(s id), SetLockOnRemoval(s id, b lock), FindSmartCard, AddSmartCard(s pin), RemoveSmartCard(s id) and SetPasswordSignIn(b allowed) change them. TouchSecurityKey(u step) says when adding waits for a touch, and Changed(u uid) follows every change. Errors are NotAuthorized, NoKey, NoCard, WrongPin, Blocked, PinTooSimple, TimedOut, AlreadyEnrolled, NothingElse and Failed.