lib/app-commands
Apps-panel command contract, shared by both dashboards.
The UI applies install and remove results optimistically, so every posted
command is tracked here until the server's command watch settles it: a
clean exit comes back as command_done and only clears the running state,
a failure as a command_error system action whose message ends with the
echoed command string, and matching that rolls the optimistic update back. Commands run through a shell on the server, in the environment of
the session the applications use, so ~ in a launch command is the
session user's home; the launch terminal is the one the server publishes as
app_terminal for the session's windowing system (foot on Wayland, st
on X11).
Variables
INSTALLED_APPS_ROLLBACK_EVENT
const INSTALLED_APPS_ROLLBACK_EVENT: "installedAppsRollback" = "installedAppsRollback";Defined in: lib/app-commands.js:19
Window event dispatched when a failed install or remove is rolled back.
APP_COMMAND_STATE_EVENT
const APP_COMMAND_STATE_EVENT: "appCommandState" = "appCommandState";Defined in: lib/app-commands.js:22
Window event dispatched whenever the set of running commands changes.
Functions
pendingAppAction()
function pendingAppAction(app): "install" | "remove" | "update" | "launch";Defined in: lib/app-commands.js:50
The action running for an app, so a list can show it and hold its buttons.
Parameters
| Parameter | Type | Description |
|---|---|---|
app | string | The app name. |
Returns
"install" | "remove" | "update" | "launch"
resolveFinishedAppCommand()
function resolveFinishedAppCommand(command): void;Defined in: lib/app-commands.js:62
Settles a command the server reported finishing cleanly. The optimistic update already holds, so this only stops it reading as still running.
Parameters
| Parameter | Type | Description |
|---|---|---|
command | string | The echoed command string. |
Returns
void
postAppCommand()
function postAppCommand(action, app): void;Defined in: lib/app-commands.js:82
Posts an app command to the core and records it as pending.
Parameters
| Parameter | Type | Description |
|---|---|---|
action | "install" | "remove" | "update" | "launch" | The command to build. |
app | string | The app name the command applies to. |
Returns
void
readInstalledApps()
function readInstalledApps(): string[];Defined in: lib/app-commands.js:97
Reads the stored installed-apps list.
Returns
string[]
The app names, empty when nothing valid is stored.
writeInstalledApps()
function writeInstalledApps(apps): void;Defined in: lib/app-commands.js:112
Parameters
| Parameter | Type | Description |
|---|---|---|
apps | string[] | The installed-apps list to store. |
Returns
void
resolveFailedAppCommand()
function resolveFailedAppCommand(errMsg): boolean;Defined in: lib/app-commands.js:127
Settles a failed-command notification against the pending map.
A matched launch command older than the failure window is application
lifecycle (the app ran, then exited nonzero), so it is suppressed. A
matched install or remove rolls back the stored installed-apps list and
notifies mounted lists through INSTALLED_APPS_ROLLBACK_EVENT; an
unmatched failure is someone else's command and passes through untouched.
Parameters
| Parameter | Type | Description |
|---|---|---|
errMsg | string | The command_error message. |
Returns
boolean
Whether the notice should be shown.