Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Checkpoint: UI engine (ellipsis, per-side borders, transforms, faster paint), QA fixes (Dock hit box, new-user audio, upgrade-safe helpers), greeter preselection, full test runner, version and channel

Federico Pereira976a06ce83fc
diff --git a/apps/about/index.jsx b/apps/about/index.jsx
index 6a177d8..22462e1 100644
--- a/apps/about/index.jsx
+++ b/apps/about/index.jsx
@@ -1,6 +1,6 @@
// About LordOS: real system data (/proc) and display server stats.
import { version as reactVersion } from 'react';
-import { View, Text, LordOSLogo, screen, system, useTheme, useSystemInfo, useServerStats, formatBytes, formatDuration, formatNumber, typeScale, t as tr } from '@lordos/sdk';
+import { View, Text, LordOSLogo, screen, lordosVersion, useTheme, useSystemInfo, useServerStats, formatBytes, formatDuration, formatNumber, typeScale, t as tr } from '@lordos/sdk';
export function Icon({ size }) {
return <LordOSLogo size={size} />;
@@ -25,11 +25,13 @@ export default function About() {
const info = useSystemInfo(5000);
const st = useServerStats(2000);
const cpu = info.cpu.replace(/\(R\)|\(TM\)|CPU|Processor/g, '').replace(/\s+/g, ' ').trim();
+ const ver = lordosVersion(info);
return (
<View style={{ flex: 1, alignItems: 'center', paddingHorizontal: 20, paddingTop: 20, paddingBottom: 16 }}>
<Icon size={64} />
<Text style={{ fontSize: typeScale.largeTitle, fontWeight: 600, color: t.text, marginTop: 12 }}>LordOS</Text>
- <Text style={{ fontSize: typeScale.callout, color: t.textDim, marginTop: 2 }}>{tr('about.version', { v: system.version, m: 'M7' })}</Text>
+ <Text style={{ fontSize: typeScale.callout, color: t.textDim, marginTop: 2 }}>{ver.channel ? tr('about.versionChannel', { v: ver.version, channel: ver.channel }) : tr('about.version', { v: ver.version })}</Text>
+ {ver.build ? <Text style={{ fontSize: typeScale.caption, color: t.textDim, marginTop: 1 }}>{tr('about.build', { b: ver.build })}</Text> : null}
<View style={{ alignSelf: 'stretch', marginTop: 16, gap: 2 }}>
<InfoRow k={tr('about.os')} v={info.os} />
<InfoRow k={tr('about.kernel')} v={`${info.kernel} (${info.arch})`} />
diff --git a/apps/files/views.jsx b/apps/files/views.jsx
index 4bc6408..24e08c2 100644
--- a/apps/files/views.jsx
+++ b/apps/files/views.jsx
@@ -1,6 +1,6 @@
// views.jsx — the four Files views: icons (cards), list (with expandable folders),
// columns (Miller, with a preview) and gallery.
-import { View, Text, Image, TextInput, ScrollView, EmptyState, useTheme, direction, formatBytes, formatDate, formatTime, typeScale, t as tr } from '@lordos/sdk';
+import { View, Text, Image, TextInput, ScrollView, EmptyState, useTheme, formatBytes, formatDate, formatTime, typeScale, t as tr } from '@lordos/sdk';
import { useEffect, useState } from 'react';
import { EntryIcon, TagDots } from './glyphs.jsx';
import { kindOf, isImage, isTextual } from './kinds.js';
diff --git a/apps/settings/General.jsx b/apps/settings/General.jsx
index 3a5eea6..501cae6 100644
--- a/apps/settings/General.jsx
+++ b/apps/settings/General.jsx
@@ -1,6 +1,6 @@
// Settings → General (machine and software details) and Updates (Debian and LordOS).
import {
- View, Text, Button, useTheme, useLocale, useSystemInfo, useServerStats, system, screen, formatBytes, formatDuration, formatNumber,
+ View, Text, Button, useTheme, useLocale, useSystemInfo, useServerStats, lordosVersion, screen, formatBytes, formatDuration, formatNumber,
admin, wm, LordOSLogo, spacing, typeScale,
} from '@lordos/sdk';
import { useState, version as reactVersion } from 'react';
@@ -21,12 +21,13 @@ export function General() {
const info = useSystemInfo(5000);
const st = useServerStats(3000);
const cpu = info.cpu.replace(/\(R\)|\(TM\)|CPU|Processor/g, '').replace(/\s+/g, ' ').trim();
+ const ver = lordosVersion(info);
return (
<Stack>
<View style={{ alignItems: 'center', gap: spacing.xs, paddingTop: spacing.xs }}>
<LordOSLogo size={72} />
<Text style={{ fontSize: typeScale.largeTitle, fontWeight: 600, color: t.text, marginTop: spacing.s }}>LordOS</Text>
- <Text style={{ fontSize: typeScale.callout, color: t.textDim }}>{tr('about.version', { v: system.version, m: 'M7' })}</Text>
+ <Text style={{ fontSize: typeScale.callout, color: t.textDim }}>{ver.channel ? tr('about.versionChannel', { v: ver.version, channel: ver.channel }) : tr('about.version', { v: ver.version })}</Text>
<Text style={{ fontSize: typeScale.caption, color: t.textDim }}>{`${info.hostname} · ${info.os}`}</Text>
</View>
<Card title={tr('settings.general.machine')} rows={[
@@ -38,7 +39,8 @@ export function General() {
[tr('about.uptime'), formatDuration(info.uptime)],
]} />
<Card title={tr('settings.general.software')} rows={[
- ['LordOS', system.version],
+ ['LordOS', ver.channel ? `${ver.version} ${ver.channel}` : ver.version],
+ ver.build ? [tr('about.buildLabel'), ver.build] : null,
[tr('about.os'), info.os],
[tr('about.kernel'), `${info.kernel} (${info.arch})`],
[tr('about.server'), 'lord-server (C · DRM/KMS · evdev · Wayland)'],
diff --git a/apps/settings/index.jsx b/apps/settings/index.jsx
index f6b6eca..551671b 100644
--- a/apps/settings/index.jsx
+++ b/apps/settings/index.jsx
@@ -386,7 +386,7 @@ function Session() {
const { t: tr } = useLocale();
return (
<Stack>
- <Section footer={tr('settings.session.hint')}>
+ <Section footer={tr(session.managed() ? 'settings.session.hintManaged' : 'settings.session.hint')}>
<SettingRow label={tr('shell.menu.logout')}>
<Button small label={tr('shell.menu.logout')} onClick={() => session.quit()} />
</SettingRow>
diff --git a/assets/locales/en/about.json b/assets/locales/en/about.json
index f073241..ad5852b 100644
--- a/assets/locales/en/about.json
+++ b/assets/locales/en/about.json
@@ -1,4 +1,10 @@
{
+ "build": "Build {b}",
+ "buildLabel": "Build",
+ "channelAlpha": "Alpha",
+ "channelBeta": "Beta",
+ "channelDev": "Development",
+ "channelRc": "Release candidate",
"cpu": "Processor",
"cpuUnknown": "Unknown",
"cpuValue": {
@@ -21,5 +27,6 @@
},
"server": "Display server",
"uptime": "Uptime",
- "version": "Version {v} · milestone {m}"
+ "version": "Version {v}",
+ "versionChannel": "Version {v} · {channel}"
}
diff --git a/assets/locales/en/settings.json b/assets/locales/en/settings.json
index ee3840d..700ad71 100644
--- a/assets/locales/en/settings.json
+++ b/assets/locales/en/settings.json
@@ -104,6 +104,7 @@
"section.users": "Users",
"section.wallpaper": "Wallpaper",
"session.hint": "Leaves LordOS and returns to the console.",
+ "session.hintManaged": "Ends your session and returns to the login screen. Open apps are closed.",
"sharing.allUsers": "All users",
"sharing.connected": "Connected now",
"sharing.disconnect": "Disconnect",
diff --git a/assets/locales/es/about.json b/assets/locales/es/about.json
index 06de2da..f194607 100644
--- a/assets/locales/es/about.json
+++ b/assets/locales/es/about.json
@@ -1,4 +1,10 @@
{
+ "build": "Compilación {b}",
+ "buildLabel": "Compilación",
+ "channelAlpha": "Alfa",
+ "channelBeta": "Beta",
+ "channelDev": "Desarrollo",
+ "channelRc": "Versión candidata",
"cpu": "Procesador",
"cpuUnknown": "Desconocido",
"cpuValue": {
@@ -21,5 +27,6 @@
},
"server": "Servidor gráfico",
"uptime": "Encendido hace",
- "version": "Versión {v} · hito {m}"
+ "version": "Versión {v}",
+ "versionChannel": "Versión {v} · {channel}"
}
diff --git a/assets/locales/es/settings.json b/assets/locales/es/settings.json
index 244f8af..af2b319 100644
--- a/assets/locales/es/settings.json
+++ b/assets/locales/es/settings.json
@@ -104,6 +104,7 @@
"section.users": "Usuarios",
"section.wallpaper": "Fondo de pantalla",
"session.hint": "Sale de LordOS y vuelve a la consola.",
+ "session.hintManaged": "Cierra tu sesión y vuelve a la pantalla de ingreso. Las apps abiertas se cierran.",
"sharing.allUsers": "Todos los usuarios",
"sharing.connected": "Conectados ahora",
"sharing.disconnect": "Desconectar",
diff --git a/assets/locales/pt/about.json b/assets/locales/pt/about.json
index c341144..e5be5f4 100644
--- a/assets/locales/pt/about.json
+++ b/assets/locales/pt/about.json
@@ -1,4 +1,10 @@
{
+ "build": "Compilação {b}",
+ "buildLabel": "Compilação",
+ "channelAlpha": "Alfa",
+ "channelBeta": "Beta",
+ "channelDev": "Desenvolvimento",
+ "channelRc": "Versão candidata",
"cpu": "Processador",
"cpuUnknown": "Desconhecido",
"cpuValue": {
@@ -21,5 +27,6 @@
},
"server": "Servidor gráfico",
"uptime": "Ligado há",
- "version": "Versão {v} · marco {m}"
+ "version": "Versão {v}",
+ "versionChannel": "Versão {v} · {channel}"
}
diff --git a/assets/locales/pt/settings.json b/assets/locales/pt/settings.json
index 3af1274..b26d880 100644
--- a/assets/locales/pt/settings.json
+++ b/assets/locales/pt/settings.json
@@ -104,6 +104,7 @@
"section.users": "Usuários",
"section.wallpaper": "Papel de parede",
"session.hint": "Sai do LordOS e volta ao console.",
+ "session.hintManaged": "Encerra a sua sessão e volta à tela de login. Os apps abertos são fechados.",
"sharing.allUsers": "Todos os usuários",
"sharing.connected": "Conectados agora",
"sharing.disconnect": "Desconectar",
diff --git a/docs/DESIGN.md b/docs/DESIGN.md
index e51f14c..ca16704 100644
--- a/docs/DESIGN.md
+++ b/docs/DESIGN.md
@@ -150,24 +150,34 @@ Check every pass on the VM with:
an Arabic UI still reads left to right);
- the **minimum window size** (`minSize` in the manifest) and a **large/maximized** window;
- no overlapping or clipped controls, and no toolbar that wraps. Text that can be long uses
- `whiteSpace: 'nowrap'` and `overflow: 'hidden'` inside a `flex: 1` box.
+ `whiteSpace: 'nowrap'` and `textOverflow: 'ellipsis'` inside a `flex: 1` box (see "Engine notes").
## Engine notes
-- `left`/`right` and `margin*` on absolute boxes are physical, and `marginInlineStart`/`insetInline*`
- are not supported: use `Hairline` or `[direction() === 'rtl' ? 'right' : 'left']`.
-- `flex: 0` means a zero flex basis, so a box with `flex: 0` and a `width` collapses to nothing.
- Pass `flex: 1` or `width`, not both (`style={[base, narrow ? { flex: 1 } : { width: 380 }]}`).
-- `getLayout` exported by the SDK is the **keyboard** layout. A box's size after layout is
- `lord.getLayout(ref.current.id)` → `[x, y, w, h]` (Logs measured its list with the wrong one).
-- A `flex: 1` box with wrapped word rows inside a row (a Markdown list item next to its bullet) can be
- measured shorter than it is drawn, and the next row overlaps it. Give it an explicit `width`
- (`<Markdown fitWidth width={exact} />`, as Help does).
-- A toolbar must not wrap: measure its width and move the actions that don't fit into a `MenuButton`
- (Disks' toolbar, the Backups browser) or narrow its fields (Logs).
+- **Long text:** truncate it, don't let it be cut at the edge. A file name, a song title or a
+ subject in a row: `whiteSpace: 'nowrap', textOverflow: 'ellipsis'` inside a `flex: 1` (or
+ `minWidth: 0`) box. A preview or a description: `numberOfLines: 2` (the last line ends in "…").
+ Text that has a fixed height and `textOverflow: 'ellipsis'` keeps the lines that fit. The cut
+ never splits a ligature, a mark or an emoji sequence, and the "…" goes where the text ends: on the
+ left in Arabic and Hebrew (screenshots: `engine-ellipsis-*.png`).
+- **Hairlines:** a separator that belongs to a box is a border of that box:
+ `borderBottomWidth: 1, borderBottomColor: t.separator` (or `borderTop…`, `borderStart…`/`borderEnd…`,
+ which follow RTL). Remember that a border is inside the box: add 1 px to a fixed height to keep the
+ content where it was. `Hairline` (an absolute 1 px view) is still the tool for a line inset from
+ the edges or over something else.
+- **Corners:** `borderTopLeftRadius`… or the logical `borderTopStartRadius`… for shapes rounded on one
+ side (a segmented control's ends, a bubble).
+- **Logical edges:** `marginInlineStart`/`End`, `paddingInlineStart`/`End` and `insetInlineStart`/`End`
+ follow the node's direction, so `[direction() === 'rtl' ? 'right' : 'left']` is no longer needed
+ (`left`/`right` and `margin*Left`/`Right` stay physical, as in CSS).
+- **Scale and rotate:** `transform: [{ scale: pressed ? 0.96 : 1 }]` for a press effect,
+ `transform: 'rotate(…deg)'` for a spinner; layout doesn't change and clicks follow what is painted.
+ lord-server paints the subtree once into a cached raster and composites it, so animating the scale
+ is cheap (the Dock's minimize effect does it on a whole window: `engine-dock-minimize.png`).
+- **`flex: 0`** is React Native's: the box keeps its `width`/`height` and doesn't grow or shrink (it
+ used to mean a zero basis, which collapsed a box with a `width`). `flex: 1` and a `width` on the same
+ box still mean "grow from 0" (the `width` is ignored): pass one or the other.
## Pending (engine)
-- The text engine has no ellipsis (`…`) for clipped text: long names are cut at the edge.
-- No per-side borders: hairlines are drawn as 1 px absolute `View`s.
- No vector icon set: icons are font glyphs (see above).
diff --git a/docs/ISO.md b/docs/ISO.md
index 29e4bc7..9399174 100644
--- a/docs/ISO.md
+++ b/docs/ISO.md
@@ -160,7 +160,10 @@ What `install-run` validates on the root side, without trusting the interface:
## What it ships
-- **LordOS** as its own package, `lordos_<version>_amd64.deb`, built by `tools/iso/mkdeb.sh`:
+- **LordOS** as its own package, `lordos_<version>_amd64.deb`, built by `tools/iso/mkdeb.sh`. The
+ version and the release channel come from `package.json` (`"version"` and `"lordos": {"channel": "beta"}`;
+ an empty channel is a stable release). `make -C server` bakes both, plus the build date and git
+ commit, into `lord-server`, and About and Settings → General show them. The package contains:
- `/usr/lib/lordos/bin/lord-sessiond` (root: sessions, login screen, remote desktop off, port
5673) and `/usr/lib/lordos/bin/lord-server` (each session);
- the prebuilt themes, in `/usr/lib/lordos/themes`;
diff --git a/docs/LANGUAGES.md b/docs/LANGUAGES.md
index a044bb3..334ef86 100644
--- a/docs/LANGUAGES.md
+++ b/docs/LANGUAGES.md
@@ -255,9 +255,29 @@ from the syllable it closes; Lao, only at spaces. To test breaks without a scree
on the line, it's broken anyway, but never inside a glyph cluster (a shaped syllable, a letter
with its marks).
-Each text is shaped once and stored in a small cache (48 entries): layout measures it and every
+Each text is shaped once and stored in a small cache (128 entries): layout measures it and every
repaint draws it without shaping it again.
+### Truncation with an ellipsis
+
+`textOverflow: 'ellipsis'` and `numberOfLines` (`themes/README.md`) cut a line with "…"
+(`text_ellipsize` in `text.c`, `text_layout_ellipsize` in `textlayout.c`):
+
+- **Where it may cut:** only between grapheme clusters, using the shaped line: never inside a glyph
+ that covers several characters (lam-alef, an Indic syllable, an emoji ZWJ family), before a mark
+ or a spacing mark (Thai and Lao SARA AM), after a ZWJ or a virama, inside a skin-tone sequence or
+ between the two regional indicators of a flag. Trailing spaces before the "…" are dropped.
+- **Shaping again:** the cut prefix plus "…" is shaped as a new text, so the last Arabic letter takes
+ its final form; if that made it wider than the box, one more cluster goes.
+- **Which side:** the "…" is the end of the paragraph for bidi, so it lands at the visual end: on the
+ left of Arabic and Hebrew text, on the right of Latin text, whatever the interface direction (the
+ text's own direction, like its alignment).
+- **Cost:** the widths come from the cached shaping (a prefix sum), and each cut is remembered like a
+ measurement, so a list repaints its labels without searching again.
+
+`server/tests/engine_test.c` checks it for Latin, Arabic, Hebrew, Thai, combining accents and emoji
+ZWJ sequences and flags at every box width from 8 to 400 px (`make -C server test`).
+
### Mirrored interface
If the language is right to left (`meta.json` → `"direction": "rtl"`; `i18n-pack` sets it
diff --git a/docs/SESSIONS.md b/docs/SESSIONS.md
index 373fe99..cf09eb2 100644
--- a/docs/SESSIONS.md
+++ b/docs/SESSIONS.md
@@ -119,7 +119,10 @@ an admin helper. Its runtime is in `/run/lordos/greeter` and its home in
`/var/lib/lordos-greeter`. It loads the special theme `themes/greeter` (React, the same engine):
- the date and a large clock;
-- the chosen user's avatar with the «Password» field (→);
+- the chosen user's avatar with the «Password» field (→). When the screen is shown it preselects
+ the locked user, otherwise the last user whose session was on the monitor (`last` in the `hello`
+ reply, kept in `/var/lib/lordos/last-user` across reboots), then a user with an open session, then
+ the first one. An avatar the person clicks always wins over a later `hello` reply;
- the other users below; a green dot marks those with an open session;
- bottom left, the machine's IP;
- bottom right:
@@ -140,7 +143,7 @@ greeter (JS) → RP_GREETER → lord-sessiond (root), over the login screen's so
| Request (greeter → sessiond) | Reply / notice (sessiond → greeter) |
|------------------------------------|---------------------------------------------------------------------------|
-| `{t:'hello'}` | `{t:'hello', mode, user, host, layouts, variants, lang, users:[…]}` |
+| `{t:'hello'}` | `{t:'hello', mode, user, last, host, layouts, variants, lang, users:[…]}` |
| `{t:'login', user, pass}` | `{t:'ok'}` and the monitor switches to the session · `{t:'fail', wait}` · `{t:'error'}` |
| `{t:'power', a:'reboot'│'poweroff'}` | (`systemctl reboot` / `poweroff`, a closed list) |
| | `{t:'mode', mode:'login'│'lock'│'switch', user}` when shown |
@@ -262,7 +265,11 @@ session. Everything that changes something goes through closed `admin.c` actions
`locale.conf`. The list lives in one place, `server/src/users/homedirs.c`, which the installer
uses too; it matches `lordos-live-prep`. Test: `build/homedirs-test`;
![new user ana, created with her folders](m9-sistema-usuario-nuevo.png)
- - the username is suggested from the full name.
+ - the username is suggested from the full name;
+ - it joins `pipewire` and `plugdev`, and `audio`, `video` and `render` when those groups exist:
+ `lord-sessiond` sessions have no logind seat, so there are no `uaccess` ACLs, and without
+ them a new user only got PipeWire's dummy output (integration QA, VM 122). `input` is not
+ added: `lord-sessiond` lends the input devices to the session on the monitor.
## Security
diff --git a/docs/TERMINAL.md b/docs/TERMINAL.md
index dc1addf..56679e8 100644
--- a/docs/TERMINAL.md
+++ b/docs/TERMINAL.md
@@ -285,7 +285,7 @@ RemoteHost (user@host, for automatic profile switching) and define
## Tests
```sh
-make -C server test # builds build/vt-dump and build/shape-test
+make -C server test # builds and runs every suite (tests/run_suites.sh: vt-dump, shape-test, ime-test…)
printf 'hola\033[31m rojo\r\n' | server/build/vt-dump 20 5 12 6 rojo
# columns rows → resizes to 12×6 and searches for "rojo"
printf 'e\xcc\x81\033[?2027h\xf0\x9f\x87\xa6\xf0\x9f\x87\xb7' | server/build/vt-dump 10 2 # [é][🇦🇷]
diff --git a/docs/VM-SETUP.md b/docs/VM-SETUP.md
index 27fa996..8ea4dfc 100644
--- a/docs/VM-SETUP.md
+++ b/docs/VM-SETUP.md
@@ -870,6 +870,17 @@ RAM and disappears on reboot.
replace `lord.pkg` in the harness with sample data (16 apps, 5 other packages). Extra sample
content: `Documentos/muestra.zip`. Nothing is installed with `apt`.
+- **UI engine pass (ellipsis, per-side borders, transforms):** same workflow on the live session
+ (`docs/WINDOWS.md`, "The UI engine pass"). Server binaries from the `debian:trixie` container; a
+ scratch-only demo app and harness bundled into the test theme (F9 steps through Files in list and
+ icon view in English and Arabic, the demo in LTR and RTL, the Dock's minimize effect slowed down to 6 s,
+ and the Player); sample files with long English, Arabic, Hebrew, Thai and emoji names in
+ `Documentos/Largos`. The drag was measured with a small static C uinput tablet (the live ISO has no
+ `python3`) run with `sudo` from the Terminal, switching only `lord-server` between the two builds.
+ Nothing is installed with `apt`. Once a React error in the scratch demo app (no `Icon` export) left the
+ session black; `system_reset` from the Proxmox monitor brought the live ISO back and the build was
+ deployed again.
+
## Step 21 — M8 app isolation: root-owned scopes, camera, several windows (VM 122 `lordos-sandbox`)
See `PRIVACY.md` («Root-owned app scopes», «Camera for isolated apps», «Several windows per
@@ -1045,3 +1056,33 @@ See `DISPLAYS.md`.
fractional-scale).
- The GPU path was tested by adding `Environment=LORD_GPU=1` to `lordos.service` in a temporary
drop-in, removed afterwards.
+
+## Step 25 — Pre-ISO integration QA (VM 122 `lordos-sandbox`, October 18)
+
+Clean build of the whole tree, the `.deb` installed with apt, and a smoke test from the login
+screen. Results and screenshots: `docs/qa/` (`all-apps.png`, `settings-pages.png`, one PNG per app).
+
+- **Packages** (build deps from `ISO.md`, "Build packages"): `libgbm-dev libegl-dev libgles-dev
+ libssl-dev libpoppler-glib-dev libarchive-dev libavcodec-dev libavformat-dev libavutil-dev
+ libswscale-dev libswresample-dev libva-dev clang lintian` (most were already there), plus
+ `linux-headers-6.12.113+deb13-amd64`: an apt run had upgraded the kernel to 6.12.113 and DKMS needed
+ the headers to rebuild `v4l2loopback` for the virtual camera (`/dev/video10`).
+- **The package instead of `/usr/local`:** `tools/iso/mkdeb.sh /tmp/lordos-qa-122.deb` and
+ `apt-get install /tmp/lordos-qa-122.deb` (this validates `Depends`). The VM's own units in
+ `/etc/systemd/system` (`lordos.service`, `lord-netperm.service`, pointing at `/usr/local/lib/lordos`)
+ were moved aside to `*.qa-122.bak` so the package's units in `/usr/lib/systemd/system` are used;
+ both enabled. `/usr/local/lib/lordos` is left in place, unused.
+- **Login screen instead of autologin:** `/etc/lordos/session.conf` is `AUTOLOGIN=` (the previous
+ file is `session.conf.qa-122.bak`).
+- **Test user:** `qa` («Qa Tester», standard), created from Settings → Users to check a new user's
+ defaults.
+- **Tree and scripts:** the tree is synced to `~/LordOS-qa` by the Mac's scratch script
+ `sync-qa-122.sh`; screenshots via `qm monitor 122` (`screendump`), mouse via
+ `/root/lord-qmp-input.py 122`, typing via `/root/lord-type.py 122`. Network untouched.
+- **QA fixes (login screen, `make test` runner):** `unicode-data` installed with apt so
+ `tests/run_suites.sh` finds `/usr/share/unicode/BidiCharacterTest.txt` (the bidi conformance suite).
+ The fixes were built in a separate copy, `~/LordOS-qafix-122`. The new `lord-sessiond` and the
+ greeter bundle are installed in `/usr/lib/lordos` (the package's originals are kept as
+ `*.qafix-122.bak`). To test "last user", `qa` was shown once through a one-time
+ `AUTOLOGIN=qa` (restored to `AUTOLOGIN=` right away) and its session was then ended, which follows
+ the same path in `lord-sessiond` as a logout. `/var/lib/lordos/last-user` now exists.
diff --git a/docs/WINDOWS.md b/docs/WINDOWS.md
index 5f616de..cc0e575 100644
--- a/docs/WINDOWS.md
+++ b/docs/WINDOWS.md
@@ -184,6 +184,43 @@ displays paint the window normally while it crosses. Dragging uses each display'
frame before, 6.73–6.94 ms after (≈ +5 %, the per-display bookkeeping); the layer still renders
once and is then only copied. Numbers with two displays and at 150 %: `DISPLAYS.md`.
+## The UI engine pass (2026-10-18)
+
+Adding per-side borders, logical edges, ellipsis and transforms (`docs/DESIGN.md`, "Engine notes")
+was checked against this path:
+
+- **Layout of what didn't change is skipped.** A node whose subtree had no change (`node_invalidate`
+ clears `layout_ok` up to the root) and that gets the same box keeps its children's layout. Moving a
+ window only changes its `left`/`top` (`grab.c` calls `node_moved`), so a frame of a drag lays out the
+ desktop's top level and places the rest (`place()`), instead of laying out every window.
+- **Text outside the clip is not laid out** (a list row scrolled away), and a cut "…" is remembered
+ like a measurement.
+- **The node stays small:** the rare styles (per-side edges, per-corner radii, scale/rotate,
+ `transformOrigin`) live in a separate `StyleExt`, so every walk over the tree touches the same
+ memory as before (a node 240 bytes larger made the benchmark's drag about 40 % slower).
+- **Transforms:** a scaled or rotated subtree is painted into its own raster and composited; inside
+ a dragged window it goes into the drag layer like anything else. A transformed window is not put in
+ the drag layer.
+
+`build/engine-test bench` (`server/tests/engine_test.c`, in the `debian:trixie` build container, i9-10900,
+medians of 3 interleaved runs; "before" is the same benchmark built against the tree of checkpoint
+03c2569): a 900 × 600 window with a 2000-row list (icon, name with ellipsis, size, date), a 520 × 360
+dialog dragged over it for 240 frames, and a Dock with a backdrop blur.
+
+| | Before | After |
+|---|---|---|
+| Layout of the list, cold / warm | 18.5 / 0.9 ms | 18.8 / 0.62 ms |
+| Full-screen paint | 12.5 ms | 4.8 ms |
+| Scroll frame (layout + damage + paint) | 11.9 ms | 3.8 ms |
+| Drag, one display (1280×800) | 1.74 ms per frame (layout 1.0) | 1.0 ms (layout 0.17) |
+| Drag, two displays (1280×800 + 1920×1200 at 150 %) | 11.3 ms | 2.5 ms |
+
+On VM 120 (live ISO, CPU path, 1280 × 800, the Terminal dragged in circles for 6 s with a uinput
+tablet, lord-server's `drag:` line), switching only `lord-server`: before 7.88–7.99 ms of work per
+frame (paint 7.30–7.41, layout 0.02, 104.7–105.8 FPS), after 7.98–8.37 ms (paint 7.41–7.76, layout
+0.01–0.02, 101.5–105.4 FPS). The difference is within the run-to-run spread; most of that frame is
+still the Dock's blur.
+
## Pending
- A real GPU layer (the window as its own texture that is only shifted), so nothing is painted on the
diff --git a/docs/engine-borders-transforms-rtl.png b/docs/engine-borders-transforms-rtl.png
new file mode 100644
index 0000000..e5f291c
Binary files /dev/null and b/docs/engine-borders-transforms-rtl.png differ
diff --git a/docs/engine-borders-transforms.png b/docs/engine-borders-transforms.png
new file mode 100644
index 0000000..2ced6a8
Binary files /dev/null and b/docs/engine-borders-transforms.png differ
diff --git a/docs/engine-dock-minimize.png b/docs/engine-dock-minimize.png
new file mode 100644
index 0000000..f89221e
Binary files /dev/null and b/docs/engine-dock-minimize.png differ
diff --git a/docs/engine-ellipsis-files-icons-ar.png b/docs/engine-ellipsis-files-icons-ar.png
new file mode 100644
index 0000000..19a77ea
Binary files /dev/null and b/docs/engine-ellipsis-files-icons-ar.png differ
diff --git a/docs/engine-ellipsis-files-icons.png b/docs/engine-ellipsis-files-icons.png
new file mode 100644
index 0000000..4452c0b
Binary files /dev/null and b/docs/engine-ellipsis-files-icons.png differ
diff --git a/docs/engine-ellipsis-files-list-ar.png b/docs/engine-ellipsis-files-list-ar.png
new file mode 100644
index 0000000..c40e998
Binary files /dev/null and b/docs/engine-ellipsis-files-list-ar.png differ
diff --git a/docs/engine-ellipsis-files-list.png b/docs/engine-ellipsis-files-list.png
new file mode 100644
index 0000000..f6eca34
Binary files /dev/null and b/docs/engine-ellipsis-files-list.png differ
diff --git a/docs/qa/about.png b/docs/qa/about.png
new file mode 100644
index 0000000..bccf5fc
Binary files /dev/null and b/docs/qa/about.png differ
diff --git a/docs/qa/all-apps.png b/docs/qa/all-apps.png
new file mode 100644
index 0000000..ffc2b6d
Binary files /dev/null and b/docs/qa/all-apps.png differ
diff --git a/docs/qa/backup.png b/docs/qa/backup.png
new file mode 100644
index 0000000..030686b
Binary files /dev/null and b/docs/qa/backup.png differ
diff --git a/docs/qa/calculator.png b/docs/qa/calculator.png
new file mode 100644
index 0000000..9cf83b2
Binary files /dev/null and b/docs/qa/calculator.png differ
diff --git a/docs/qa/calendar.png b/docs/qa/calendar.png
new file mode 100644
index 0000000..3c199b8
Binary files /dev/null and b/docs/qa/calendar.png differ
diff --git a/docs/qa/camera.png b/docs/qa/camera.png
new file mode 100644
index 0000000..6c441fe
Binary files /dev/null and b/docs/qa/camera.png differ
diff --git a/docs/qa/characters.png b/docs/qa/characters.png
new file mode 100644
index 0000000..320627e
Binary files /dev/null and b/docs/qa/characters.png differ
diff --git a/docs/qa/clock.png b/docs/qa/clock.png
new file mode 100644
index 0000000..b03f1de
Binary files /dev/null and b/docs/qa/clock.png differ
diff --git a/docs/qa/contacts.png b/docs/qa/contacts.png
new file mode 100644
index 0000000..c85ae7e
Binary files /dev/null and b/docs/qa/contacts.png differ
diff --git a/docs/qa/disks.png b/docs/qa/disks.png
new file mode 100644
index 0000000..78c8dfe
Binary files /dev/null and b/docs/qa/disks.png differ
diff --git a/docs/qa/editor.png b/docs/qa/editor.png
new file mode 100644
index 0000000..65affdf
Binary files /dev/null and b/docs/qa/editor.png differ
diff --git a/docs/qa/files.png b/docs/qa/files.png
new file mode 100644
index 0000000..bb08925
Binary files /dev/null and b/docs/qa/files.png differ
diff --git a/docs/qa/fonts.png b/docs/qa/fonts.png
new file mode 100644
index 0000000..c0f5ed4
Binary files /dev/null and b/docs/qa/fonts.png differ
diff --git a/docs/qa/help.png b/docs/qa/help.png
new file mode 100644
index 0000000..3845be0
Binary files /dev/null and b/docs/qa/help.png differ
diff --git a/docs/qa/logs.png b/docs/qa/logs.png
new file mode 100644
index 0000000..aa8ce70
Binary files /dev/null and b/docs/qa/logs.png differ
diff --git a/docs/qa/lpk-legit.png b/docs/qa/lpk-legit.png
new file mode 100644
index 0000000..d60d1bb
Binary files /dev/null and b/docs/qa/lpk-legit.png differ
diff --git a/docs/qa/mail.png b/docs/qa/mail.png
new file mode 100644
index 0000000..685b734
Binary files /dev/null and b/docs/qa/mail.png differ
diff --git a/docs/qa/monitor.png b/docs/qa/monitor.png
new file mode 100644
index 0000000..2c6de09
Binary files /dev/null and b/docs/qa/monitor.png differ
diff --git a/docs/qa/notes.png b/docs/qa/notes.png
new file mode 100644
index 0000000..5fb912c
Binary files /dev/null and b/docs/qa/notes.png differ
diff --git a/docs/qa/passwords.png b/docs/qa/passwords.png
new file mode 100644
index 0000000..5d32e51
Binary files /dev/null and b/docs/qa/passwords.png differ
diff --git a/docs/qa/pdf.png b/docs/qa/pdf.png
new file mode 100644
index 0000000..990e4b5
Binary files /dev/null and b/docs/qa/pdf.png differ
diff --git a/docs/qa/photos.png b/docs/qa/photos.png
new file mode 100644
index 0000000..a820a2b
Binary files /dev/null and b/docs/qa/photos.png differ
diff --git a/docs/qa/player.png b/docs/qa/player.png
new file mode 100644
index 0000000..b58e046
Binary files /dev/null and b/docs/qa/player.png differ
diff --git a/docs/qa/recorder.png b/docs/qa/recorder.png
new file mode 100644
index 0000000..2596f1b
Binary files /dev/null and b/docs/qa/recorder.png differ
diff --git a/docs/qa/reminders.png b/docs/qa/reminders.png
new file mode 100644
index 0000000..2a15d1e
Binary files /dev/null and b/docs/qa/reminders.png differ
diff --git a/docs/qa/scanner.png b/docs/qa/scanner.png
new file mode 100644
index 0000000..48a11c5
Binary files /dev/null and b/docs/qa/scanner.png differ
diff --git a/docs/qa/screenshots.png b/docs/qa/screenshots.png
new file mode 100644
index 0000000..9b08308
Binary files /dev/null and b/docs/qa/screenshots.png differ
diff --git a/docs/qa/settings-pages.png b/docs/qa/settings-pages.png
new file mode 100644
index 0000000..e949141
Binary files /dev/null and b/docs/qa/settings-pages.png differ
diff --git a/docs/qa/settings.png b/docs/qa/settings.png
new file mode 100644
index 0000000..338668b
Binary files /dev/null and b/docs/qa/settings.png differ
diff --git a/docs/qa/store.png b/docs/qa/store.png
new file mode 100644
index 0000000..bca0f2b
Binary files /dev/null and b/docs/qa/store.png differ
diff --git a/docs/qa/terminal.png b/docs/qa/terminal.png
new file mode 100644
index 0000000..d9dd1a7
Binary files /dev/null and b/docs/qa/terminal.png differ
diff --git a/package.json b/package.json
index 78ff45b..7914660 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,10 @@
"name": "lordos",
"private": true,
"version": "0.7.0",
- "description": "LordOS — temas y apps React para lord-server",
+ "description": "LordOS — React themes and apps for lord-server",
+ "lordos": {
+ "channel": "beta"
+ },
"scripts": {
"build": "node tools/build-theme.mjs",
"build:theme": "node tools/build-theme.mjs"
diff --git a/sdk/index.js b/sdk/index.js
index 36c3b8f..954471a 100644
--- a/sdk/index.js
+++ b/sdk/index.js
@@ -63,7 +63,7 @@ import { startAlarms } from './alarms.js';
import { maybeStartTour } from './help.js';
import { getApp as getAppOf, isLiveSystem as isLiveSystemOf, wm as wmOf } from './windows.js';
export const windowIcon = (w) => windowIconOf(w, getAppOf);
-export { systemInfo, useSystemInfo, useServerStats, useCpuUsage, formatBytes, formatDuration } from './system.js';
+export { systemInfo, lordosVersion, useSystemInfo, useServerStats, useCpuUsage, formatBytes, formatDuration } from './system.js';
export * as fs from './fs.js';
export { useDirectory } from './fs.js';
export { ThemeProvider, useTheme, DEFAULT_TOKENS } from './theme.js';
diff --git a/sdk/system.js b/sdk/system.js
index bd3acc6..008540f 100644
--- a/sdk/system.js
+++ b/sdk/system.js
@@ -1,9 +1,19 @@
// system.js — system and server information, as React hooks.
import { useEffect, useState } from 'react';
-import { formatNumber } from './i18n.js';
+import { formatNumber, t } from './i18n.js';
export const systemInfo = () => lord.system.info();
+// LordOS's own version, from the build (package.json "version" and "lordos": {"channel"}, see
+// server/Makefile): { version: '0.7.0', channel: 'Beta' (empty for a stable release), build }.
+export function lordosVersion(info) {
+ const i = info || systemInfo();
+ const id = String(i.channel || '');
+ const channel = id === 'beta' ? t('about.channelBeta') : id === 'alpha' ? t('about.channelAlpha')
+ : id === 'rc' ? t('about.channelRc') : id === 'dev' ? t('about.channelDev') : id ? id[0].toUpperCase() + id.slice(1) : '';
+ return { version: String(i.version || lord.version || ''), channel, build: String(i.build || '') };
+}
+
function usePoll(read, intervalMs) {
const [value, setValue] = useState(read);
useEffect(() => {
diff --git a/server/Makefile b/server/Makefile
index 005a31f..a8cd277 100644
--- a/server/Makefile
+++ b/server/Makefile
@@ -103,7 +103,7 @@ HDR += $(wildcard src/disk/*.h)
OBJ := $(SRC:src/%.c=build/obj/%.o)
HDR += $(wildcard src/tp/*.h)
-.PHONY: all clean test
+.PHONY: all clean test test-full
# lord-sessiond: sessions, login screen and remote desktop (docs/SESSIONS.md). It's the
# only one that links OpenSSL (TLS); without libssl-dev, only lord-server is built.
SESSIOND ?= $(shell pkg-config --exists openssl 2>/dev/null && echo 1 || echo 0)
@@ -159,7 +159,15 @@ all: $(ALL)
# HarfBuzz (tests/shape_test.c), bidi against BidiCharacterTest.txt (tests/bidi_test.c) and
# input methods (tests/ime_test.c); Thai line breaking (tests/thbrk_test.c, against libthai
# with tests/thbrk_compare.sh).
+#
+# Most suites run inside their own build rule (`./$@ || ...`). The ones below are only built here; once
+# every prerequisite of `test` is done, tests/run_suites.sh runs them (a few seconds) and fails if any
+# fails; a suite whose tool or data isn't installed says "skipped: needs X". `make test-full` adds the
+# helpers (lord-media, lord-doc), the sandbox (Landlock kernel) and the HarfBuzz comparison.
test: build/vt-dump build/shape-test build/bidi-test build/ime-test build/thbrk-test build/sound-test build/wasm-test build/net-test build/wasm-js-test build/pkg-test build/fsops-test build/sign-test build/mmdb-test build/canvas-test build/arcpath-test build/ipp-test build/tp-test build/media-test
+ @sh tests/run_suites.sh
+test-full: test build/sandbox-test build/doc-test $(filter build/lord-media build/lord-doc,$(ALL))
+ @sh tests/run_suites.sh full
SHAPE_SRC := src/ui/otf.c src/ui/shape.c src/ui/shape_indic.c src/ui/shape_syl.c src/ui/shape_khmer.c src/ui/shape_myanmar.c src/ui/shape_use.c src/ui/unicode.c
build/shape-test: tests/shape_test.c $(SHAPE_SRC) $(HDR)
$(CC) $(CPPFLAGS) $(CFLAGS) $(WARN) -std=c11 -o $@ tests/shape_test.c $(SHAPE_SRC)
@@ -325,6 +333,23 @@ build/obj/remote/pages.o: src/remote/login.html src/remote/client.html
build/lord-sessiond: $(SESSIOND_OBJ)
$(CC) $(LDFLAGS) -o $@ $^ $(shell pkg-config --libs openssl) -lcrypt -lpthread
+# Version, channel and build of LordOS, shown in About and Settings → General (lord.version and
+# lord.system.info()). Version and channel come from ../package.json ("version" and "lordos": {"channel"}),
+# the only place to set them; the build is the date (SOURCE_DATE_EPOCH if set) and the git commit, or
+# LORD_BUILD=... The header is rewritten only when its contents change.
+LORD_VERSION := $(shell sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' ../package.json 2>/dev/null | head -1 | tr -cd 'A-Za-z0-9.+~-')
+LORD_CHANNEL := $(shell sed -n 's/.*"channel": *"\([^"]*\)".*/\1/p' ../package.json 2>/dev/null | head -1 | tr -cd 'a-z0-9-')
+LORD_BUILD ?= $(shell d=$$(date -u -d "@$${SOURCE_DATE_EPOCH:-$$(date +%s)}" +%Y%m%d 2>/dev/null || date -u +%Y%m%d); \
+ c=$$(git -C .. rev-parse --short=8 HEAD 2>/dev/null); echo "$$d$${c:+.$$c}")
+build/gen/lord_version.h: FORCE
+ @mkdir -p build/gen
+ @printf '#define LORD_VERSION "%s"\n#define LORD_CHANNEL "%s"\n#define LORD_BUILD "%s"\n' \
+ '$(or $(LORD_VERSION),0.0.0)' '$(LORD_CHANNEL)' '$(shell printf %s '$(LORD_BUILD)' | tr -cd 'A-Za-z0-9.+~-')' > [email protected]
+ @if cmp -s [email protected] $@; then rm -f [email protected]; else mv [email protected] $@; fi
+build/obj/ui/js.o build/obj/ui/js_sys.o: build/gen/lord_version.h
+.PHONY: FORCE
+FORCE:
+
build/obj/%.o: src/%.c $(HDR)
@mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) $(WARN) -std=c11 -c -o $@ $<
diff --git a/server/src/app/appspawn.c b/server/src/app/appspawn.c
index 1a1a115..f88e55c 100644
--- a/server/src/app/appspawn.c
+++ b/server/src/app/appspawn.c
@@ -84,7 +84,7 @@ int app_spawn(const char *id) {
if (null >= 0) { dup2(null, 0); if (null > 2) close(null); }
/* el id lo pasa lord-server, ya validado; no hay argumentos del llamador */
char *const argv[] = { self, (char *)"--app", (char *)id, NULL };
- execve(self, argv, environ);
+ execve("/proc/self/exe", argv, environ); /* not `self`: after a package upgrade it is "<path> (deleted)" */
_exit(127);
}
close(sv[1]);
diff --git a/server/src/netperm/netperm.c b/server/src/netperm/netperm.c
index f54fe89..84835a9 100644
--- a/server/src/netperm/netperm.c
+++ b/server/src/netperm/netperm.c
@@ -194,6 +194,7 @@ static void load_rules(Session *s) {
/* ---- maps ------------------------------------------------------------------------------------ */
+#ifdef NP_HAVE_BPF /* the program loader's relocations (bpf_setup) */
static int map_fd(const char *name) {
if (!strcmp(name, "np_cfg")) return G.m_cfg;
if (!strcmp(name, "np_apps")) return G.m_apps;
@@ -205,6 +206,7 @@ static int map_fd(const char *name) {
if (!strcmp(name, "np_events")) return G.m_events;
return -1;
}
+#endif
static uint32_t idx_of(unsigned uid, const char *app) {
char key[FW_APP_MAX + 16];
@@ -584,8 +586,8 @@ static void on_event(void *u, const void *data, uint32_t len) {
ev.rule_id, flag ? flag : "", ev.record);
if (n > 0 && (size_t)n < sizeof j) send_uid(s->uid, NP_MSG_EVENT, j, (size_t)n, 1);
if (ev.verdict == NP_V_DENY)
- logf_("uid %u %s: denegada %s %s %s:%u (%s%s%s)", s->uid, sc->app, ev.dir == NP_D_IN ? "entrada" : "salida",
- ev.proto == NP_P_TCP ? "tcp" : ev.proto == NP_P_UDP ? "udp" : "otro", addr[0] ? addr : "?", ev.port, by_name(ev.reason),
+ logf_("uid %u %s: denied %s %s %s:%u (%s%s%s)", s->uid, sc->app, ev.dir == NP_D_IN ? "in" : "out",
+ ev.proto == NP_P_TCP ? "tcp" : ev.proto == NP_P_UDP ? "udp" : "other", addr[0] ? addr : "?", ev.port, by_name(ev.reason),
ev.flag ? " " : "", ev.flag && flag ? flag : "");
}
@@ -702,7 +704,7 @@ static int bpf_setup(void) {
NpCfg cfg = { SCOPE_LEVEL, 1, USER_LEVEL };
uint32_t zero = 0;
if (bpfs_map_update(G.m_cfg, &zero, &cfg, BPF_ANY)) { lerr_set(G.bpf_err, sizeof G.bpf_err, "fw.bpfConfig", "errno", lerr_errno(errno), NULL); return -1; }
- logf_("%d programas BPF cargados", np);
+ logf_("%d BPF programs loaded", np);
return 0;
#endif
}
diff --git a/server/src/remote/conn.c b/server/src/remote/conn.c
index f221b39..233ca9f 100644
--- a/server/src/remote/conn.c
+++ b/server/src/remote/conn.c
@@ -698,8 +698,8 @@ void rd_serve(SSL_CTX *ctx, int fd, const char *ip) {
if (!strcmp(r.method, "POST") && !strcmp(r.path, "/login")) {
if (!same_origin(&r)) {
- sd_log("ingreso rechazado: origen «%s» y host «%s»", r.origin, r.host);
- respond(403, "Forbidden", "text/plain", NULL, "origen", 6);
+ sd_log("login rejected: origin \"%s\" and host \"%s\"", r.origin, r.host);
+ respond(403, "Forbidden", "text/plain", NULL, "origin", 6);
return;
}
double wait = sd_fail_wait(peer);
diff --git a/server/src/remote/monitor.c b/server/src/remote/monitor.c
index 913be5c..f11ffa9 100644
--- a/server/src/remote/monitor.c
+++ b/server/src/remote/monitor.c
@@ -123,7 +123,7 @@ int sd_mon_show(int fd, const char *who) {
conn = fd;
drm = open(CARD, O_RDWR | O_CLOEXEC);
if (drm < 0) { sd_log("%s: %s", CARD, strerror(errno)); return -1; }
- if (ioctl(drm, DRM_IOCTL_SET_MASTER, NULL)) sd_log("aviso: DRM master: %s", strerror(errno));
+ if (ioctl(drm, DRM_IOCTL_SET_MASTER, NULL)) sd_log("warning: DRM master: %s", strerror(errno));
for (int i = 0; i < 64 && nin < MAX_IN; i++) {
char p[32];
snprintf(p, sizeof p, "/dev/input/event%d", i);
@@ -228,7 +228,7 @@ static void plug(const char *name) {
ins[nin++] = f;
char dev[80] = "";
ioctl(f, EVIOCGNAME(sizeof dev), dev);
- sd_log("entrada enchufada: %s (%s)", name, dev);
+ sd_log("input plugged in: %s (%s)", name, dev);
}
static void unplug(const char *name) {
@@ -238,7 +238,7 @@ static void unplug(const char *name) {
ins[i] = ins[nin - 1];
memcpy(inname[i], inname[nin - 1], sizeof inname[i]);
nin--;
- sd_log("entrada quitada: %s", name);
+ sd_log("input removed: %s", name);
return;
}
}
diff --git a/server/src/remote/remote_admin.c b/server/src/remote/remote_admin.c
index ec45565..309916d 100644
--- a/server/src/remote/remote_admin.c
+++ b/server/src/remote/remote_admin.c
@@ -73,6 +73,9 @@ static pid_t sessiond_pid(void) {
ssize_t l = readlink(link, exe, sizeof exe - 1);
if (l <= 0) return -1;
exe[l] = 0;
+ /* after a package upgrade the running binary was replaced: the link ends in " (deleted)" */
+ static const char deleted[] = " (deleted)";
+ if ((size_t)l > sizeof deleted - 1 && !strcmp(exe + l - (sizeof deleted - 1), deleted)) exe[l - (sizeof deleted - 1)] = 0;
const char *base = strrchr(exe, '/');
return base && !strcmp(base + 1, "lord-sessiond") ? (pid_t)pid : -1;
}
diff --git a/server/src/remote/sessiond.c b/server/src/remote/sessiond.c
index ee05ba3..4ea81ff 100644
--- a/server/src/remote/sessiond.c
+++ b/server/src/remote/sessiond.c
@@ -312,9 +312,41 @@ static void file_value(const char *path, const char *key, char *out, size_t n) {
static char greeter_mode[8] = "login", greeter_user[33];
+/* The last user whose session was shown on the monitor: the login screen preselects it. Kept in
+ * SD_LAST_USER (root's, 0644) so it survives a reboot; only a valid user name is read back. */
+#define SD_LAST_USER "/var/lib/lordos/last-user"
+static char last_user[33];
+
+static void load_last_user(void) {
+ last_user[0] = 0;
+ int fd = open(SD_LAST_USER, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
+ if (fd < 0) return;
+ char buf[40];
+ ssize_t n = read(fd, buf, sizeof buf - 1);
+ close(fd);
+ if (n <= 0) return;
+ buf[n] = 0;
+ buf[strcspn(buf, "\n")] = 0;
+ if (sd_valid_username(buf)) snprintf(last_user, sizeof last_user, "%.32s", buf);
+}
+
+static void save_last_user(const char *user) {
+ if (!sd_valid_username(user) || !strcmp(user, last_user)) return;
+ snprintf(last_user, sizeof last_user, "%.32s", user);
+ mkdir("/var/lib/lordos", 0755);
+ unlink(SD_LAST_USER ".new");
+ int fd = open(SD_LAST_USER ".new", O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, 0644);
+ if (fd < 0) return;
+ size_t n = strlen(last_user);
+ int ok = write(fd, last_user, n) == (ssize_t)n && write(fd, "\n", 1) == 1;
+ close(fd);
+ if (!ok || rename(SD_LAST_USER ".new", SD_LAST_USER)) unlink(SD_LAST_USER ".new");
+}
+
static void greeter_reply_hello(void) {
Str s = { 0 };
- sput(&s, "{\"t\":\"hello\",\"mode\":\"%s\",\"user\":\"%s\",\"host\":\"", greeter_mode, greeter_user);
+ sput(&s, "{\"t\":\"hello\",\"mode\":\"%s\",\"user\":\"%s\",\"last\":\"%s\",\"host\":\"", greeter_mode, greeter_user,
+ last_user);
char host[128] = "lordos";
gethostname(host, sizeof host - 1);
sput_esc(&s, host, 64);
@@ -524,6 +556,7 @@ static void from_worker(void) {
sd_log("monitor: %s's session", user);
set_shown('u', user);
if (sd_mon_show(fd, user)) { sd_mon_lost(); set_shown('-', NULL); show_greeter("login", NULL); }
+ else save_last_user(user);
return;
}
if (fd >= 0) close(fd);
@@ -659,6 +692,7 @@ int main(int argc, char **argv) {
sigaction(SIGHUP, &sh, NULL);
find_paths();
load_config();
+ load_last_user();
mkdir("/run/lordos", 0755);
/* delegated cgroup (Delegate=yes): sessiond moves into the "supervisor" leaf and each session gets
* its own subtree (cgroup_delegate_session in sess.c). Without delegation it works as before. */
diff --git a/server/src/ui/js.c b/server/src/ui/js.c
index d3b843f..043dbe8 100644
--- a/server/src/ui/js.c
+++ b/server/src/ui/js.c
@@ -29,6 +29,7 @@
#include "../media/media.h"
#include "ui.h"
#include "../term/term.h"
+#include "lord_version.h" /* build/gen: version, channel and build (Makefile) */
#include <libgen.h>
#include <stdio.h>
@@ -391,7 +392,7 @@ int js_init(const char *bundle_path) {
JS_SetPropertyStr(ctx, screen, "height", JS_NewFloat64(ctx, ui.height));
set_screen_displays(screen);
JS_SetPropertyStr(ctx, lord, "screen", screen);
- JS_SetPropertyStr(ctx, lord, "version", JS_NewString(ctx, "0.7.0"));
+ JS_SetPropertyStr(ctx, lord, "version", JS_NewString(ctx, LORD_VERSION));
js_sys_init();
js_sys_register(ctx, lord);
js_term_register(ctx, lord);
@@ -453,7 +454,7 @@ int js_init_app(const char *host_bundle, const char *app_id) {
JS_SetPropertyStr(ctx, screen, "width", JS_NewFloat64(ctx, ui.width));
JS_SetPropertyStr(ctx, screen, "height", JS_NewFloat64(ctx, ui.height));
JS_SetPropertyStr(ctx, lord, "screen", screen);
- JS_SetPropertyStr(ctx, lord, "version", JS_NewString(ctx, "0.7.0"));
+ JS_SetPropertyStr(ctx, lord, "version", JS_NewString(ctx, LORD_VERSION));
js_broker_register(ctx, lord, app_id); /* fs/clipboard/perms through the broker + appId */
js_vault_register_app(ctx, lord); /* Passwords only: its own channel to lord-vault */
js_sys_register_app(ctx, lord); /* lord.text (language, direction) and lord.image */
diff --git a/server/src/ui/js_sys.c b/server/src/ui/js_sys.c
index 4795bdd..5eb5010 100644
--- a/server/src/ui/js_sys.c
+++ b/server/src/ui/js_sys.c
@@ -27,6 +27,7 @@
#include "../keyboard.h"
#include "../fsops.h"
#include "../remote/mirror.h"
+#include "lord_version.h" /* build/gen: version, channel and build (Makefile) */
#include <ctype.h>
#include <fcntl.h>
@@ -235,6 +236,10 @@ static JSValue f_sys_info(JSContext *c, JSValueConst this_val, int argc, JSValue
JS_SetPropertyStr(c, o, "memTotalKB", JS_NewFloat64(c, mem_total));
JS_SetPropertyStr(c, o, "memAvailableKB", JS_NewFloat64(c, mem_avail));
JS_SetPropertyStr(c, o, "uptime", JS_NewFloat64(c, uptime));
+ /* LordOS itself: package.json's version and channel ("beta"; empty for a stable release) and the build */
+ JS_SetPropertyStr(c, o, "version", JS_NewString(c, LORD_VERSION));
+ JS_SetPropertyStr(c, o, "channel", JS_NewString(c, LORD_CHANNEL));
+ JS_SetPropertyStr(c, o, "build", JS_NewString(c, LORD_BUILD));
JS_SetPropertyStr(c, o, "user", JS_NewString(c, getenv("USER") ? getenv("USER") : ""));
/* full name (first GECOS field) and whether they are an administrator (sudo/admin/wheel) */
struct passwd *pw = getpwuid(getuid());
diff --git a/server/src/users/users_admin.c b/server/src/users/users_admin.c
index c0f6eef..273f5ff 100644
--- a/server/src/users/users_admin.c
+++ b/server/src/users/users_admin.c
@@ -215,6 +215,11 @@ void users_act_add(const AdminReq *r, const char *arg, size_t len) {
if (adm) { const char *const g[] = { "/usr/sbin/usermod", "--append", "--groups", ADMIN_GROUP, name, NULL }; admin_run(g); print_group(name, 1); }
if (getgrnam("pipewire")) { const char *const g[] = { "/usr/sbin/usermod", "--append", "--groups", "pipewire", name, NULL }; admin_run(g); } /* real-time sound (docs/SOUND.md) */
if (getgrnam("plugdev")) { const char *const g[] = { "/usr/sbin/usermod", "--append", "--groups", "plugdev", name, NULL }; admin_run(g); } /* FIDO2 security keys (docs/PASSWORDS.md) */
+ /* sound card, camera and GPU render node: lord-sessiond sessions have no logind seat, so
+ * there are no uaccess ACLs; without these groups a new user only gets a dummy output
+ * (same groups as the installer's first user, minus input, which lord-sessiond lends) */
+ for (const char *const *gr = (const char *const[]){ "audio", "video", "render", NULL }; *gr; gr++)
+ if (getgrnam(*gr)) { const char *const g[] = { "/usr/sbin/usermod", "--append", "--groups", *gr, name, NULL }; admin_run(g); }
prepare_home(pw);
admin_ok("users.created", "name", name, NULL);
}
diff --git a/server/tests/run_suites.sh b/server/tests/run_suites.sh
new file mode 100644
index 0000000..0452d78
--- /dev/null
+++ b/server/tests/run_suites.sh
@@ -0,0 +1,188 @@
+#!/bin/sh
+# run_suites.sh — runs the test programs that `make test` builds but whose own rules don't run
+# them (the other suites run inside their build rule). Called from server/ by the Makefile:
+#
+# make -C server test sh tests/run_suites.sh self-contained suites, a few seconds
+# make -C server test-full sh tests/run_suites.sh full also the helpers (lord-media, lord-doc),
+# the sandbox and the external comparisons
+#
+# Exits with 1 if any suite fails. A suite whose tool or data isn't installed is reported as
+# "skipped: needs X" and doesn't fail the run. Optional data: BIDI_TEST=<BidiCharacterTest.txt>.
+cd "$(dirname "$0")/.." || exit 1
+mode=${1:-quick}
+T=$(mktemp -d "${TMPDIR:-/tmp}/lord-suites.XXXXXX") || exit 1
+trap 'rm -rf "$T"' EXIT
+trap 'exit 130' INT TERM
+pass=0 fails=0 skips=0 failed=''
+
+ok() { pass=$((pass + 1)); printf ' ok %s\n' "$1"; }
+skip() { skips=$((skips + 1)); printf ' skipped %s: needs %s\n' "$1" "$2"; }
+bad() { # NAME [file with the details; default: the output]
+ fails=$((fails + 1)); failed="$failed${failed:+; }$1"
+ printf ' FAILED %s\n' "$1"
+ tail -n 30 "${2:-$T/out}" | sed 's/^/ | /'
+}
+# run NAME CMD...: passes when CMD exits with 0
+run() { n=$1; shift; if "$@" >"$T/out" 2>&1; then ok "$n"; else bad "$n"; fi; }
+# has_all FILE: every line of $T/want appears in FILE
+has_all() { while IFS= read -r l; do grep -qF -- "$l" "$1" || return 1; done <"$T/want"; }
+have() { command -v "$1" >/dev/null 2>&1; }
+
+# vt NAME INPUT COLS ROWS [COLS2 ROWS2 [SEARCH]] <<EOF (exact expected grid) — terminal emulator.
+# INPUT is a printf format (octal escapes: /bin/sh may be dash).
+vt() {
+ n=$1 in=$2; shift 2
+ cat >"$T/want"
+ # shellcheck disable=SC2059
+ printf "$in" | build/vt-dump "$@" >"$T/out" 2>&1
+ if cmp -s "$T/want" "$T/out"; then ok "$n"; else diff "$T/want" "$T/out" >"$T/diff"; bad "$n" "$T/diff"; fi
+}
+
+# ime NAME ENGINE KEYS DICT <<EOF (lines that must appear) — input methods; DICT is what to install
+# when the engine needs a dictionary ("" for none). Without it, ime-test prints an empty «».
+ime() {
+ n=$1 eng=$2 keys=$3 dict=$4
+ cat >"$T/want"
+ if ! build/ime-test "$eng" "$keys" >"$T/out" 2>&1; then bad "$n"; return; fi
+ if [ -n "$dict" ] && grep -qF '«»' "$T/out"; then skip "$n" "$dict"; return; fi
+ if has_all "$T/out"; then ok "$n"; else bad "$n"; fi
+}
+
+# shape NAME FONT MODE ARGS... <<EOF (exact glyphs) — OpenType shaping of the bundled fonts, against
+# the output of the last checked build (regression; the HarfBuzz comparison is hb_compare.py)
+shape() {
+ n=$1; shift
+ cat >"$T/want"
+ build/shape-test "$@" >"$T/out" 2>&1
+ if cmp -s "$T/want" "$T/out"; then ok "$n"; else diff "$T/want" "$T/out" >"$T/diff"; bad "$n" "$T/diff"; fi
+}
+
+quick() {
+ echo "== suites (tests/run_suites.sh)"
+ # terminal emulator (examples of docs/TERMINAL.md and docs/VM-SETUP.md)
+ vt "vt-dump: colors, resize and search" 'hello\033[31m red\r\n' 20 5 12 6 red <<'EOF'
+--- 20x5 cursor 0,1 history 0 alt 0
+ |hello red|
+ ||
+ ||
+ ||
+ ||
+--- 12x6 cursor 0,1 history 0 alt 0
+ |hello red|
+ ||
+ ||
+ ||
+ ||
+ ||
+search 'red': 1 matches
+EOF
+ # (the expected grid has "e" + U+0301, as the emulator keeps it)
+ vt "vt-dump: combining mark and flag (mode 2027)" 'e\314\201\033[?2027h\360\237\207\246\360\237\207\267' 10 2 <<'EOF'
+--- 10x2 cursor 3,0 history 0 alt 0
+ |[é][🇦🇷]|
+ ||
+EOF
+ vt "vt-dump: reflow with wide characters" '123456789日本語\r\n' 10 3 7 3 <<'EOF'
+--- 10x3 cursor 0,2 history 0 alt 0
+ +|123456789|
+ |日本語|
+ ||
+--- 7x3 cursor 0,2 history 1 alt 0
+h +|1234567|
+ +|89日本|
+ |語|
+ ||
+EOF
+
+ shape "shape-test: Inter kerning (GPOS)" ../assets/fonts/Inter-Regular.ttf ui latn 0 AVATAR <<'EOF'
+2@0,0|456@1273,0|2@2546,0|411@3785,0|2@4933,0|384@6346,0
+EOF
+ shape "shape-test: JetBrains Mono ligatures (GSUB)" ../assets/fonts/JetBrainsMono-Regular.ttf liga 'a->b != c' <<'EOF'
+189|1742|881|214|958|1742|912|958|215
+EOF
+
+ ime "ime-test: hangul" hangul gksrmf "" <<'EOF'
+committed: 한
+preedit: 글
+EOF
+ ime "ime-test: kana" kana toukyou_ "skkdic" <<'EOF'
+preedit: 東京
+EOF
+ ime "ime-test: pinyin" pinyin nihao_ "rime-data-pinyin-simp" <<'EOF'
+committed: 你好
+EOF
+
+ # bidi: the Unicode conformance file isn't in the repository
+ bidi=${BIDI_TEST:-}
+ for f in /usr/share/unicode/BidiCharacterTest.txt /usr/share/unicode-data/BidiCharacterTest.txt tests/BidiCharacterTest.txt; do
+ [ -z "$bidi" ] && [ -r "$f" ] && bidi=$f
+ done
+ if [ -n "$bidi" ] && [ -r "$bidi" ]; then run "bidi-test: $(basename "$bidi")" build/bidi-test "$bidi"
+ else skip "bidi-test" "BidiCharacterTest.txt (unicode-data, or BIDI_TEST=<file>)"; fi
+
+ # Thai word breaks: the dictionary is libthai-data's; the comparison needs libthai itself
+ if [ ! -r /usr/share/libthai/thbrk.tri ]; then skip "thbrk-test" "libthai-data (/usr/share/libthai/thbrk.tri)"
+ elif pkg-config --exists libthai 2>/dev/null && have python3; then run "thbrk-test against libthai" sh tests/thbrk_compare.sh
+ else
+ run "thbrk-test (dictionary)" sh -c 'build/thbrk-test < tests/th-break.txt'
+ skip "thbrk_compare.sh" "libthai-dev and python3"
+ fi
+
+ run "sound-test" build/sound-test
+ # WebAssembly modules: built by tests/wasm/build.sh (*.wasm is not committed)
+ if [ -f tests/wasm/demo.wasm ] && [ -f tests/wasm/api.wasm ] || { have clang && have wasm-ld && have wat2wasm && sh tests/wasm/build.sh >"$T/out" 2>&1; }; then
+ run "wasm-test" build/wasm-test
+ run "wasm-js-test" build/wasm-js-test
+ else
+ skip "wasm-test, wasm-js-test" "clang, lld (wasm-ld) and wabt (wat2wasm) to build tests/wasm"
+ fi
+ run "net-test crypto" build/net-test crypto
+ run "net-test errors" build/net-test errors
+ run "pkg-test" build/pkg-test
+ run "fsops-test" build/fsops-test
+ run "sign-test" build/sign-test
+ run "mmdb-test" build/mmdb-test
+ run "canvas-test" build/canvas-test
+ run "arcpath-test" build/arcpath-test
+ run "ipp-test" build/ipp-test
+ run "tp-test" build/tp-test
+}
+
+full() {
+ echo "== slow and environment-dependent suites (tests/run_suites.sh full)"
+ # media helper: a generated WAV (one second of a 440 Hz tone), probe, waveform and its confinement
+ if [ -x build/lord-media ] && have python3; then
+ python3 -I - "$T/tone.wav" <<'EOF'
+import math, struct, sys, wave
+w = wave.open(sys.argv[1], 'wb'); w.setnchannels(1); w.setsampwidth(2); w.setframerate(8000)
+w.writeframes(b''.join(struct.pack('<h', int(12000 * math.sin(2 * math.pi * 440 * i / 8000))) for i in range(8000)))
+EOF
+ run "media-test probe" build/media-test probe "$T/tone.wav"
+ run "media-test wave" build/media-test wave "$T/tone.wav" 50
+ run "media-test sandbox" build/media-test sandbox "$T/tone.wav"
+ else skip "media-test" "build/lord-media (FFmpeg -dev packages) and python3"; fi
+ # document helper: malicious archives and the confinement
+ if [ -x build/lord-doc ] && [ -x build/doc-test ] && have python3; then run "doc_evil.sh (lord-doc)" sh tests/doc_evil.sh
+ else skip "doc_evil.sh" "build/lord-doc (Poppler and libarchive -dev packages) and python3"; fi
+ # sandbox: Landlock and seccomp of the running kernel
+ if [ -r /sys/kernel/security/lsm ] && grep -q landlock /sys/kernel/security/lsm; then
+ run "sandbox-test (app)" build/sandbox-test
+ run "sandbox-test (app, net)" build/sandbox-test net
+ run "sandbox-test (helper)" build/sandbox-test helper
+ else skip "sandbox-test" "a kernel with Landlock enabled (run it in the VM)"; fi
+ # shaping against HarfBuzz, with the system's Noto fonts and the bundled ones
+ if have python3 && python3 -c 'import uharfbuzz' 2>/dev/null; then
+ mkdir -p "$T/fonts"
+ find /usr/share/fonts ../assets/fonts -name '*.tt[fc]' 2>/dev/null | while IFS= read -r f; do
+ ln -sf "$(cd "$(dirname "$f")" && pwd)/$(basename "$f")" "$T/fonts/$(basename "$f")"; done
+ run "hb_compare.py (HarfBuzz)" python3 tests/hb_compare.py "$T/fonts" build/shape-test
+ else skip "hb_compare.py" "python3 with uharfbuzz (pip install uharfbuzz) and fonts-noto-core/fonts-noto-cjk"; fi
+}
+
+case $mode in
+ quick) quick ;;
+ full) full ;;
+ *) echo "usage: sh tests/run_suites.sh [full]" >&2; exit 2 ;;
+esac
+printf '== %d passed, %d failed, %d skipped\n' "$pass" "$fails" "$skips"
+[ "$fails" -eq 0 ] || { echo "failed: $failed"; exit 1; }
diff --git a/themes/README.md b/themes/README.md
index 16c2205..6c411f8 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -104,17 +104,38 @@ A theme draws `<DesktopWidgets layer="below" />` between the wallpaper and the w
`wrap-reverse` or `alignContent`), `justifyContent`, `alignItems`, `alignSelf`, `flex`,
`flexGrow`, `flexShrink`, `flexBasis`, `gap`, `width`/`height` (px, `%`, `auto`),
`min*`/`max*`, `left`/`top`/`right`/`bottom`, `inset`, `margin*`, `padding*`, `overflow`, `zIndex`.
+ `flex` follows React Native: `flex: N > 0` grows and shrinks from a zero basis, `flex: 0` keeps its
+ `width`/`height` and doesn't flex, `flex: -N` only shrinks.
+- **Logical edges** (they follow the node's `direction`, and win over the physical side as in React
+ Native): `marginInlineStart`/`marginInlineEnd` (also `marginStart`/`marginEnd`, `marginInline`),
+ `paddingInlineStart`/`paddingInlineEnd` (`paddingStart`/`paddingEnd`, `paddingInline`),
+ `insetInlineStart`/`insetInlineEnd` (`start`/`end`, `insetInline`).
- **Visual:** `backgroundColor`, `background: linear-gradient(...)`, `borderRadius`, `border`,
`borderWidth`, `borderColor`, `opacity`, `boxShadow`, `backdropFilter: blur(px)`,
- `transform: translate(...)` / `translateX` / `translateY`, `pointerEvents`, `cursor` (`default`, `pointer`,
+ `pointerEvents`, `cursor` (`default`, `pointer`,
`text`, `move`, `grab`, `grabbing`, `not-allowed`, `wait`, `progress`, `crosshair`, `n-resize`… `ew-resize`,
`ns-resize`, `nesw-resize`, `nwse-resize`; the one of the first node upwards that has it applies).
-- **Text:** `color`, `fontSize`, `fontWeight`, `lineHeight`, `textAlign`, `whiteSpace: nowrap`.
+- **Per-side borders:** `borderTop`/`borderRight`/`borderBottom`/`borderLeft` (`'1px solid #ccc'`), their
+ `…Width` and `…Color`, and `borderStart`/`borderEnd` (also `borderInlineStart`/`borderInlineEnd`) with
+ `…Width`/`…Color`, which go on the right in RTL. A side's value replaces `borderWidth`/`borderColor`
+ for that side only; a side without a color uses `borderColor`.
+- **Per-corner radii:** `borderTopLeftRadius`, `borderTopRightRadius`, `borderBottomRightRadius`,
+ `borderBottomLeftRadius`, and the logical `borderTopStartRadius`/`borderTopEndRadius`/
+ `borderBottomStartRadius`/`borderBottomEndRadius` (CSS `borderStartStartRadius`… too). With
+ `overflow: 'hidden'` the children and images are clipped to that shape.
+- **Transform:** `transform: 'translate(x, y) scale(s) rotate(deg)'` or the React Native array
+ (`[{ translateX }, { scale }, { scaleX }, { rotate: '45deg' }]`; `rad` and `turn` work too), `translateX`,
+ `translateY`, and `transformOrigin` (`'50% 50%'` by default, `'left top'`, px). As in CSS, scale and
+ rotate only change how the box is painted and hit: layout doesn't move (translate does move the box).
+- **Text:** `color`, `fontSize`, `fontWeight`, `lineHeight`, `textAlign`, `whiteSpace: nowrap`,
+ `textOverflow: 'ellipsis'` (with `nowrap`: one line cut with "…"; without it, the lines that fit in
+ the box's height, the last one ending in "…"), `numberOfLines: N` (also `lineClamp`/`WebkitLineClamp`:
+ at most N lines, "…" at the end of the last one).
- **Image:** `objectFit` (`cover`, `contain`, `fill`).
Colors: `#rgb`, `#rrggbb`, `#rrggbbaa`, `rgb()`, `rgba()` and some names.
-Not available yet: `flexWrap`, per-side borders, per-corner radii, `transform: scale/rotate`,
-CSS animations (animate from JS with state and `requestAnimationFrame`).
+Not available yet: dashed or dotted borders, `transform: skew/matrix`, 3D transforms, CSS
+animations (animate from JS with state and `requestAnimationFrame`).
The full SDK is in `apps/README.md`.
diff --git a/themes/greeter/index.jsx b/themes/greeter/index.jsx
index db5272b..9a01f2b 100644
--- a/themes/greeter/index.jsx
+++ b/themes/greeter/index.jsx
@@ -7,7 +7,8 @@
// arrives through __lordGreeter: this JS never sees /etc/shadow.
//
// Requests: {t:'hello'} · {t:'login', user, pass} · {t:'power', a:'reboot'|'poweroff'}
-// Notices: {t:'hello', mode, user, host, layouts, variants, lang, users:[{name, full, color, image, admin, open}]}
+// Notices: {t:'hello', mode, user, last, host, layouts, variants, lang, users:[{name, full, color, image, admin, open}]}
+// (last: the user whose session was last shown on the monitor)
// {t:'mode', mode:'login'|'lock'|'switch', user} · {t:'ok'} · {t:'fail', wait} · {t:'error'} · {t:'busy'}
import { render, screen } from '@lordos/runtime';
import {
@@ -134,7 +135,12 @@ function Greeter() {
const [confirm, setConfirm] = useState(null); // 'reboot' | 'poweroff'
const [ip, setIp] = useState(lanAddress());
const timers = useRef([]);
- const reselect = useRef(true);
+ const reselect = useRef(true); // the next hello chooses the selected user
+ // when the person last clicked an avatar (0: not since the last login). Input only reaches the
+ // greeter while it's on the monitor, and until the 'mode' notice is handled the monitor still shows
+ // the previous showing's last frame: a click made there a moment before the notice belongs to this
+ // showing and must survive it.
+ const chosen = useRef(0);
const [focusRev, setFocusRev] = useState(0); // when shown again, focus goes back to the field
const doShake = () => {
@@ -156,23 +162,27 @@ function Greeter() {
const sys = String(m.lang || '').slice(0, 2);
setLanguage(['es', 'en', 'pt'].includes(sys) ? sys : 'en');
}
- // the selected user: the one from the locked screen, another (switch user) or the first;
- // only when the mode changes, so the refreshed list doesn't override what the person chose
- const pick = reselect.current;
+ // the selected user: the one from the locked screen, another (switch user), the last one
+ // shown on the monitor, one with an open session or the first. Only when the screen is shown
+ // again, and never over an avatar the person clicked: a late reply must not undo that click.
+ const choose = reselect.current && !chosen.current;
reselect.current = false;
setSel((cur) => {
- if (!pick && cur && m.users.some((u) => u.name === cur)) return cur;
- if (m.mode === 'lock' && m.user) return m.user;
+ const has = (name) => !!name && m.users.some((u) => u.name === name);
+ if (!choose && has(cur)) return cur;
+ if (m.mode === 'lock' && has(m.user)) return m.user;
if (m.mode === 'switch') return (m.users.find((u) => u.name !== m.user) || m.users[0] || {}).name || '';
- return (m.users[0] || {}).name || '';
+ if (has(m.last)) return m.last;
+ return (m.users.find((u) => u.open) || m.users[0] || {}).name || '';
});
} else if (m.t === 'mode') {
setPass(''); setMsg(''); setBusy(false); setMenu(null); setConfirm(null); setFocusRev((v) => v + 1);
setInfo((old) => ({ ...old, mode: m.mode, user: m.user }));
reselect.current = true;
+ if (Date.now() - chosen.current > 10000) chosen.current = 0; // a click from an earlier showing
send({ t: 'hello' }); // who has an open session, again
setIp(lanAddress());
- } else if (m.t === 'ok') { setPass(''); setMsg(''); setBusy(false); }
+ } else if (m.t === 'ok') { setPass(''); setMsg(''); setBusy(false); chosen.current = 0; }
else if (m.t === 'fail') {
setPass(''); setBusy(false); doShake();
setMsg(m.wait > 0 ? t('greeter.wait', { count: m.wait }) : t('greeter.wrong'));
@@ -195,7 +205,7 @@ function Greeter() {
setMsg('');
if (!send({ t: 'login', user: user.name, pass })) { setBusy(false); setMsg(t('greeter.error')); }
};
- const pick = (name) => { setSel(name); setPass(''); setMsg(''); };
+ const pick = (name) => { chosen.current = Date.now(); reselect.current = false; setSel(name); setPass(''); setMsg(''); };
const anyOpen = info.users.some((u) => u.open);
const power = (a) => { if (anyOpen && confirm !== a) setConfirm(a); else { setConfirm(null); send({ t: 'power', a }); } };