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.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
Dock: docs, screenshots and poof without a scaled raster
Federico Pereirac25133d01375
diff --git a/docs/DOCK.md b/docs/DOCK.mdindex b091a4d..cf7c633 100644--- a/docs/DOCK.md+++ b/docs/DOCK.md@@ -5,7 +5,10 @@ In **Settings → Desktop & Dock** you choose:- where the Dock goes (bottom, left or right);- its size, magnification and how much it magnifies;- whether it hides automatically;-- whether it shows recent apps.+- whether it shows recent apps;+- **Reset Dock to defaults** (the theme's apps, after a confirmation in the page).++Which apps are in the Dock, and in which order, is up to you: see "Customizing the Dock" below.In the Classic theme, the same section chooses the taskbar position: bottom, top, left or right.Everything is applied live, without restarting, and is saved in@@ -35,7 +38,148 @@ Everything is applied live, without restarting, and is saved in| `taskbarPosition` | `bottom`, `top`, `left`, `right` (Classic theme) | `bottom` |The SDK records recent apps in `dockRecentApps` every time an app opens a window-(`useDockEntries(fijadas, { recents: 3 })`).+(`useDockEntries(defaults, { recents: 3 })`).++## Customizing the Dock (0.8.1)++Every app can go in the Dock: LordOS apps, installed `.lpk` packages and Linux apps from their+`.desktop` files (Firefox, Chromium, GTK and Qt apps). The arrangement is saved per user in+`~/.config/lordos/settings.json` → `dockPinned`.++| | |+|---|---|+|  |  |+| Dragging Firefox: its neighbours slide aside to show where it lands | The same in dark mode |+|  |  |+| Dragged out and held: the remove cue | Dark mode |+|  |  |+| Released: the «poof» | Settings → Desktop & Dock → Reset Dock to defaults, confirmed in the page |+|  |  |+| Reordering with the Dock on the left | Arabic: the bottom Dock reads right to left (Files on the right, the Trash on the left) |+|  | |+| Classic theme: Firefox dragged from the start menu, with the drop line | |++**Adding an app:**++- drag it from the app launcher onto the Dock: the launcher steps aside as soon as the drag starts,+ and the app lands exactly where it is dropped (the neighbours open a gap);+- right click in the app launcher → **Keep in Dock**;+- right click on a running app's icon → **Options › Keep in Dock**. A running Linux app is pinned+ through its `.desktop` id (the same match that groups its windows, `sdk/wayland.js`); a window+ with no `.desktop` can't be pinned;+- drag a running app's icon into the pinned part of the Dock.++**Reordering:** drag an icon along the Dock. Neighbours slide aside in 150 ms (instantly with+Settings → Appearance → Reduce motion). A drag starts after 6 px, so a click never moves anything,+and the click that ends a drag doesn't open the app. It works at the bottom, left and right, in+right-to-left languages, with magnification on (it pauses while dragging) and with a touchpad or a+touchscreen (they drive the same pointer). Escape cancels a drag.++**Removing:** drag the icon more than about 60 px away from the Dock and hold it there for a moment+(350 ms): the icon dims and shows «Remove». Releasing it then removes it with a short «poof»;+releasing before that, or back near the Dock, puts it back. Dropping it on the Trash, or right click+→ **Options › Remove from Dock**, does the same. A running app that is removed stays in the Dock as+an unpinned running item until it quits.++### Rules++- **Files** is always the first item: it can't be moved or removed.+- **The Trash** is always the last item, after a separator: it can't be moved or removed.+- **Settings** and the **app launcher** can't be removed (no «Remove from Dock»; dragging them out+ or onto the Trash puts them back) but move freely between Files and the Trash.+- Every other app is added, moved and removed freely.+- Nothing lands before Files or after the Trash: a drop there goes right after Files or right+ before the Trash. «First» and «last» follow the Dock's reading order (a bottom Dock is mirrored in+ right-to-left languages; on the sides it reads top to bottom).+- **Reset Dock to defaults** keeps these rules. An older settings file that lacks Files, Settings or+ the launcher gets them back on load.++### Data model (`sdk/dockmodel.js`, `sdk/dock.js`)++`dockPinned` holds **typed ids**, so the three kinds can never collide:++| Id | What | Opened with |+|---|---|---|+| `app:<id>` | a LordOS app bundled with the theme | `wm.open` (`launchApp`) |+| `lpk:<id>` | an installed `.lpk` package | `lord.apps.launchPackage(id)` |+| `desktop:<desktop id>` | a Linux app's `.desktop` | `lord.apps.launch(id)` |+| `shell:launcher` | the theme's app launcher | the theme |++Only these existing paths open a Dock item (`launchDockItem`): no new way to run anything, no+commands, no paths. Ids are validated with the server's rules (`lpk_valid_id`, `valid_id` in+`apps.c`). On load, lists written before 0.8.1 (untyped ids such as `"files"`) are migrated+(`lpk:` if a package with that id is installed, `app:` otherwise); malformed ids and windows without+a `.desktop` (`linux:…`) are dropped. An uninstalled app keeps its place hidden and comes back if it+is reinstalled; nothing broken is shown.++```js+dock.pin(id, index) // index: position among the items the Dock shows (Files is 0)+dock.move(id, index)+dock.unpin(id) // refused for Files, Settings and the launcher+dock.reset() // the theme's defaults (dockPinned: null)+dock.isPinned(id) · dock.canRemove(id) · dock.canMove(id)+```++The methods take a typed id or a plain launcher id. Both themes use the same calls and the same+drag logic (`beginDockDrag`, `registerDockTarget`, `dockDrag`, `dockPoof`): the Dock draws the gap+and the poof; the Classic taskbar draws a drop line, unpins with the same drag-out-and-hold, pins+from the start menu (drag, or right click → Pin to taskbar) and keeps its Start button fixed (the+launcher item isn't shown there). The model is tested by `server/tests/dock_model_test.mjs` (in+`make test` when node is installed).++## The Dock's menu: quick actions++| | |+|---|---|+|  |  |+| Right click on Settings: every section, in the sidebar's order (here moved with the keyboard) | Dark mode |+|  | |+| A Linux app's desktop actions (`Actions=` in its `.desktop`) | |++From the top: the app's **quick actions**, its windows (when it runs), the app's own items+(`registerDockMenu`, e.g. the Terminal's New Window and New Tab) or New Window, **Options ›**+(Keep in Dock / Remove from Dock; Show in Files for a `.lpk` and for the user's own `.desktop`+files), then Show All Windows, Hide and Quit, or Open. The menu follows `DESIGN.md`'s look, is+keyboard navigable (↑ ↓ Home End, Enter or Space, → opens a submenu and ← closes it, Escape) and+scrolls when it is taller than the screen.++Quick actions are generic. An app declares them in its manifest or from its module:++```js+// manifest.json: "dockActions": [{ "id": "new", "label": "myapp.newThing", "args": { "mode": "new" } }]+registerDockActions('settings', () => [{ id: 'network', label: 'settings.section.network', args: { section: 'network' } }]);+```++`label` is an i18n key; `args` (strings, numbers, booleans) reach the app as `useAppWindow().args`+(plus `action`), the app opening or coming to the front; `new: true` opens another window. Today:+Settings (one per section, built from its own section list so it never drifts), Files (Home,+Downloads, Documents, Trash), Mail (New Message), Monitor (Network, Cooling); the Terminal keeps its+own New Window and New Tab. A `.lpk` app gets none (it starts with `launchPackage(id)` and no+arguments). A Linux app shows its `.desktop`'s desktop actions, run through the same launcher (see+`WAYLAND.md`, "Desktop actions").++## The Trash++| | |+|---|---|+|  |  |+| The Trash, full, and its menu | Dark mode |+|  |  |+| Empty Trash asks first, in the desktop (never `alert()`) | Dark mode |++- Always the last item, after a separator; empty or full (papers in the basket), light and dark.+ The state comes from a `stat` of `~/.local/share/Trash/files` every 2 s while the Dock shows it,+ and the full list only when that changed or every 30 s (disks' trashes too): no busy loop.+- **Click:** opens Files on the Trash (`args.place = 'trash'`).+- **Drop files from Files on it:** they go to the Trash through Files' own `fs.trash` (the node+ carries `dropTrash`), with the same rules: the home and the user's mounts only.+- **Drop a Dock icon on it:** removes it from the Dock (not Files, Settings or the launcher).+- **Right click:** Open, and Empty Trash, which asks for confirmation and says that deleting is+ permanent and can't be undone.+- **Drives:** dropping a removable drive to eject it isn't supported: Files has no draggable drive+ items, so there is nothing to drop; eject stays in Files and Disks.+- **Classic theme:** the Trash is the last button of the taskbar, with the same click, drop, menu+ and confirmation.## Work area@@ -84,3 +228,7 @@ Settings says so below "Position on screen".- Minimize effect (genie or scale): the engine doesn't have `transform: scale` yet.- Auto-hide for the Classic theme's bar.- Dragging the Dock to another edge with the mouse (⇧ on the separator).+- Quick actions for `.lpk` apps (they would need to reach the isolated process through the broker).+- Ejecting a drive by dropping it on the Trash (Files has no draggable drive items yet).+- "Open at Login" in the Options submenu (LordOS has no login items yet).+- The Classic taskbar shows a drop line, without the Dock's sliding neighbours.diff --git a/docs/WAYLAND.md b/docs/WAYLAND.mdindex cad28b0..6efd2cf 100644--- a/docs/WAYLAND.md+++ b/docs/WAYLAND.md@@ -84,6 +84,18 @@ shell. The user approved it for M7. Limits:- it's run with `execve`, without a shell;- the program is looked up in a fixed PATH (`/usr/local/bin`, `/usr/bin`, `/bin`, games, and`~/.local/bin` only for the user's `.desktop` files).+- **Desktop actions (0.8.1):** the Dock's right-click menu lists the `Actions=` of an app's+ `.desktop` (a browser's "New Private Window", for instance). `lord.apps.actions(id, language)`+ returns `[{ id, name }]` and `lord.apps.launchAction(id, action)` runs one, through the **same**+ launcher (`apps_launch_action` → `launch()`): same id rules and filters, same scope, restrictions+ and fixed PATH, no shell, no caller arguments, no file. Only that action's `Exec` line replaces the+ main one, and only if:+ - the action is listed in the main group's `Actions=` key;+ - its name is `[A-Za-z0-9-]`, at most 63 characters;+ - its `[Desktop Action <name>]` group has a `Name` and an `Exec`.++ Anything else (an unlisted group, a bad name, no `Exec`) is refused. Tested by+ `build/apps-actions-test` (in `make test`).- The app starts as an orphaned grandchild, in its own session, with normal signals and no otherdescriptors. Its output goes to `~/.cache/lordos/apps.log`, which is trimmed when it passes 1 MB.- A `.desktop` can't be created from JS:diff --git a/docs/dock-customize-classic.png b/docs/dock-customize-classic.pngnew file mode 100644index 0000000..a181214Binary files /dev/null and b/docs/dock-customize-classic.png differdiff --git a/docs/dock-customize-left.png b/docs/dock-customize-left.pngnew file mode 100644index 0000000..dbcd2aaBinary files /dev/null and b/docs/dock-customize-left.png differdiff --git a/docs/dock-customize-poof-dark.png b/docs/dock-customize-poof-dark.pngnew file mode 100644index 0000000..3621d85Binary files /dev/null and b/docs/dock-customize-poof-dark.png differdiff --git a/docs/dock-customize-remove-dark.png b/docs/dock-customize-remove-dark.pngnew file mode 100644index 0000000..4a46186Binary files /dev/null and b/docs/dock-customize-remove-dark.png differdiff --git a/docs/dock-customize-remove-light.png b/docs/dock-customize-remove-light.pngnew file mode 100644index 0000000..21ed625Binary files /dev/null and b/docs/dock-customize-remove-light.png differdiff --git a/docs/dock-customize-reorder-dark.png b/docs/dock-customize-reorder-dark.pngnew file mode 100644index 0000000..468851eBinary files /dev/null and b/docs/dock-customize-reorder-dark.png differdiff --git a/docs/dock-customize-reorder-light.png b/docs/dock-customize-reorder-light.pngnew file mode 100644index 0000000..cdf5ff5Binary files /dev/null and b/docs/dock-customize-reorder-light.png differdiff --git a/docs/dock-customize-reset-dark.png b/docs/dock-customize-reset-dark.pngnew file mode 100644index 0000000..994b5e7Binary files /dev/null and b/docs/dock-customize-reset-dark.png differdiff --git a/docs/dock-customize-rtl.png b/docs/dock-customize-rtl.pngnew file mode 100644index 0000000..76023bbBinary files /dev/null and b/docs/dock-customize-rtl.png differdiff --git a/docs/dock-menu-desktop-actions.png b/docs/dock-menu-desktop-actions.pngnew file mode 100644index 0000000..8429528Binary files /dev/null and b/docs/dock-menu-desktop-actions.png differdiff --git a/docs/dock-menu-settings-dark.png b/docs/dock-menu-settings-dark.pngnew file mode 100644index 0000000..c871b37Binary files /dev/null and b/docs/dock-menu-settings-dark.png differdiff --git a/docs/dock-menu-settings-light.png b/docs/dock-menu-settings-light.pngnew file mode 100644index 0000000..5d7f7e4Binary files /dev/null and b/docs/dock-menu-settings-light.png differdiff --git a/docs/dock-trash-confirm-dark.png b/docs/dock-trash-confirm-dark.pngnew file mode 100644index 0000000..333f0daBinary files /dev/null and b/docs/dock-trash-confirm-dark.png differdiff --git a/docs/dock-trash-confirm-light.png b/docs/dock-trash-confirm-light.pngnew file mode 100644index 0000000..08a3091Binary files /dev/null and b/docs/dock-trash-confirm-light.png differdiff --git a/docs/dock-trash-dark.png b/docs/dock-trash-dark.pngnew file mode 100644index 0000000..5046115Binary files /dev/null and b/docs/dock-trash-dark.png differdiff --git a/docs/dock-trash-light.png b/docs/dock-trash-light.pngnew file mode 100644index 0000000..b7163adBinary files /dev/null and b/docs/dock-trash-light.png differdiff --git a/server/src/apps.c b/server/src/apps.cindex 0baee9c..7e8393e 100644--- a/server/src/apps.c+++ b/server/src/apps.c@@ -150,7 +150,9 @@ static int parse_desktop(const char *file, const char *lang, Entry *e) {for (int i = 0; i < e->nact; i++) if (!strcmp(e->act[i].name, name)) dup = 1;if (valid_action(name) && !dup && e->nact < APPS_MAX_ACTIONS) {act = &e->act[e->nact++];- memcpy(act->name, name, strlen(name) + 1); /* valid_action: shorter than the field */+ /* bounded copy (valid_action already keeps it shorter than the field); the+ * precision keeps -Wformat-truncation quiet */+ snprintf(act->name, sizeof act->name, "%.*s", (int)sizeof act->name - 1, name);}}continue;diff --git a/themes/classic/index.jsx b/themes/classic/index.jsxindex a4f29ca..46db4d0 100644--- a/themes/classic/index.jsx+++ b/themes/classic/index.jsx@@ -375,9 +375,10 @@ function PoofFade() {return () => cancelAnimationFrame(raf);});if (!poof || p >= 1 || reduce) return null;+ const k = Math.round(28 * (1 - 0.5 * p));return (- <View style={{ position: 'absolute', left: poof.x - 14, top: poof.y - 14, pointerEvents: 'none', opacity: 1 - p, transform: `scale(${1 - 0.5 * p})` }}>- {poof.Icon ? <poof.Icon size={28} /> : null}+ <View style={{ position: 'absolute', left: poof.x - k / 2, top: poof.y - k / 2, pointerEvents: 'none', opacity: 1 - p }}>+ {poof.Icon ? <poof.Icon size={k} /> : null}</View>);}diff --git a/themes/default/components/Dock.jsx b/themes/default/components/Dock.jsxindex 1911197..aa46690 100644--- a/themes/default/components/Dock.jsx+++ b/themes/default/components/Dock.jsx@@ -170,9 +170,15 @@ function Poof({ poof, size, reduce }) {const s = size;return (<View style={{ position: 'absolute', left: poof.x - s, top: poof.y - s, width: s * 2, height: s * 2, pointerEvents: 'none' }}>- <View style={{ position: 'absolute', left: s / 2, top: s / 2, width: s, height: s, opacity: 1 - p, transform: `scale(${1 - 0.6 * p})` }}>- {poof.Icon ? <poof.Icon size={s} /> : null}- </View>+ {(() => {+ // the icon shrinks (drawn smaller, not scaled: a scaled raster would show its box) and fades+ const k = Math.round(s * (1 - 0.6 * p));+ return (+ <View style={{ position: 'absolute', left: s - k / 2, top: s - k / 2, width: k, height: k, opacity: 1 - p }}>+ {poof.Icon ? <poof.Icon size={k} /> : null}+ </View>+ );+ })()}{[0, 72, 144, 216, 288].map((a) => {const r = s * (0.25 + 0.75 * p), d = s * (0.22 + 0.2 * p);const cx = s + Math.cos((a * Math.PI) / 180) * r, cy = s + Math.sin((a * Math.PI) / 180) * r;