sector-f-linux

Sector F Linux
git clone https://git.sectorflabs.com/sector-f-linux.git
Log | Files | Refs | README | LICENSE

0013-the-greeter-is-a-patina-app-of-our-own.md (4279B)


      1 # 0013. The greeter is a Patina egui app of our own, in this repository
      2 
      3 Date: 2026-11-21
      4 
      5 ## Status
      6 
      7 Proposed. Where it lives, that it has no window frame, and that it follows the desktop's lock
      8 screen are the user's directions; the rest below was my choice and waits for their say.
      9 
     10 ## Context
     11 
     12 [ADR-0012](0012-a-login-manager-of-our-own-greetd-and-a-patina-greeter.md) settled that the login
     13 screen is a Patina greeter on greetd, with the first-run setup built in. What was left was what that
     14 program is made of.
     15 
     16 The desktop's pieces (bar, launcher, lock screen) are egui on layer-shell surfaces through
     17 patina-shell's host. A greeter run by greetd under `cage` cannot do that: `cage` shows one ordinary
     18 window full screen and has no layer-shell or session-lock. The user pointed at the lock screen
     19 (`patina-desktop/lock/src/ui.rs`) as the best reference, and said the greeter should not have
     20 Patina's frame or window buttons: it is a login, not a window.
     21 
     22 ## Decision
     23 
     24 - **It lives in `greeter/` of this repository**, not in patina-desktop: it is OS code. It is its own
     25   cargo project; it depends on Patina through the published `patina-ui` crate and changes nothing
     26   in patina-desktop.
     27 - **A normal Patina app on eframe and `patina-ui`, a full-screen window with no frame, title bar or
     28   menu**: Patina's frame and its title-bar rules are for windows with menus. It is drawn from the
     29   skin and egui's stock widgets, as the lock screen is, and wears the desktop's skin, Everforest
     30   Dark, so the login and the desktop match.
     31 - **It looks and behaves like the lock screen**: the large clock and date, a round avatar, a pill for
     32   the password with dots, a caret, a spinner while the password is checked and a shake when it is
     33   refused. The first-run setup uses the same pill for its fields.
     34 - **Buttons: Patina's own, except one.** Restart and Shut down are text buttons in Patina's size
     35   (`patina::dialog::buttons`: 24 px high, ADR-0032), with tooltips. "Create account" is deliberately
     36   not: it is a pill as wide and as high as the fields above it (46 px), filled in the accent. Beside
     37   fields that size a 24 px button looked lost; the user compared it with compact 32 px fields and a
     38   standard button, and chose the big button. Patina's size rule is for rows of buttons in dialogs,
     39   panels and popups, and the greeter's form is sized to its own controls, as the login's arrow is.
     40 
     41 - **A password is never in an egui `TextEdit`**, whose undo history would keep copies. A `Field` of
     42   our own reads the key events, shows dots for a secret, and zeroes it when cleared or sent, with
     43   the length capped, as patina-lock does. Editing is at the end of the text only.
     44 - **The system is behind one `Backend` trait**: who can log in, whether it is the first run, logging
     45   in, making the first account, power. Work runs on worker threads and answers over a channel, since
     46   PAM and D-Bus can take seconds. A `Mock` backend runs the screens and the tests without greetd; the
     47   real one (greetd's socket, AccountsService, logind) is the next step.
     48 - **The logic is kept out of the drawing**: what a name or a password has to be, the suggested user
     49   name, the form's first problem, are plain functions with tests; the screens are tested by feeding
     50   them events and watching the state, not by looking at pixels.
     51 
     52 ## Consequences
     53 
     54 - The greeter is security-critical code of our own, as patina-lock is: a bug that ends it leaves the
     55   screen with nothing to type into. greetd restarts a greeter that fails, until it gives up, so a text
     56   console login has to stay available.
     57 - The pill field, the avatar and the arrow button are written again here, beside the lock screen's.
     58   Patina's own rule is that a component a second app wants moves into Patina and is not copied
     59   (its ADR-0001), so they are candidates to move into `patina-ui` once the greeter is done.
     60 - Avatars are an initial on the accent for now; pictures need AccountsService, which knows where
     61   each user's is, so they come with the real backend.
     62 - Editing at the end only is a limit a person will notice in a long name; it can be lifted when a
     63   text field with a caret that moves is worth its undo history.
     64 - It runs on a mock until the real backend is written, and says so and exits if started without one.