applications
Installed desktop entries, indexed by window app_id.
text {
content = computed({ mantle.workspaces, mantle.applications }, function(workspaces, applications)
local client = workspaces and workspaces.active_client
if client == nil or applications == nil then
return ""
end
local index = applications.by_app_id[client.class]
return index and applications.entries[index].name or client.class
end),
}
State
mantle.applications:get() returns ApplicationsState, nil before the first push. A field marked ? may be absent.
mantle.applications payload.
| Field | Type | Description |
|---|---|---|
by_app_id | table<string, integer> | Window app_id to its 1-based index: entries[by_app_id[app_id]]. Keys are exact StartupWMClass and desktop ids, then lowercased and last-dot-segment guesses. |
entries | AppSummary[] | Installed entries, sorted by name (byte order). A change under an applications directory rescans 250 ms after the last event. |
AppSummary
One visible Type=Application desktop entry; display data only, argv stays private.
| Field | Type | Description |
|---|---|---|
comment? | string | Comment=, unlocalized, e.g. "Web Browser"; nil without the key. |
generic_name? | string | GenericName=, unlocalized, e.g. "Text Editor"; nil without the key. |
icon? | string | Icon= as written, a theme name or absolute path, both accepted by icon { name }; nil without the key. |
id | string | Desktop file id, e.g. "org.telegram.desktop"; the argument of "launch". |
keywords | string[] | Keywords= split on ;, for search; empty without the key. |
name | string | Name=, unlocalized: Name[xx] is not read. |
Actions
Call each as mantle.applications:<action>(arguments...); ? marks an argument you may omit.
| Action | Arguments | Description |
|---|---|---|
refresh | Rescans installed desktop entries. The directories are watched, so only a failed watch (logged) needs this. | |
launch | id: string | Launches entries[].id, detached; Terminal=true entries run in $TERMINAL. |
open_url | url: string | Opens an http, https or mailto URL with xdg-open. One over 2048 bytes or holding whitespace or a control character is refused. |
Backend
Reads applications/ under $XDG_DATA_HOME, then each $XDG_DATA_DIRS entry (default
/usr/local/share:/usr/share), subdirectories included. The first file for a desktop id wins, so a
copy under ~/.local/share/applications overrides the system one. Type=Application entries with
Name and Exec are listed; NoDisplay=true and Hidden=true ones are not. inotify watches every
directory, including ones created later.
How do I…
| Task | Answer |
|---|---|
| Hide an app from a launcher | Copy its .desktop file to ~/.local/share/applications and add NoDisplay=true; the rescan drops it |
Gotchas
| Trap | Fix |
|---|---|
launch of a terminal app does nothing | Terminal=true needs $TERMINAL in the Supervisor’s environment, not an interactive shell’s. mantle log names the refusal |
See also: App launcher recipe.