refactor: unify desktop apps and Settings under item catalog
This commit is contained in:
@@ -841,18 +841,36 @@ External standalone apps can be discovered by the desktop through TOML manifest
|
||||
|
||||
```toml
|
||||
[app]
|
||||
id = "my-app"
|
||||
name = "My App"
|
||||
binary = "myapp"
|
||||
binary = "myapp.elf"
|
||||
icon = "myapp_icon.svg"
|
||||
|
||||
[menu]
|
||||
category = "Applications"
|
||||
visible = true
|
||||
|
||||
[desktop]
|
||||
section = "apps"
|
||||
admin_only = false
|
||||
|
||||
[launch]
|
||||
pass_home_dir = true
|
||||
```
|
||||
|
||||
**Categories:** `Applications`, `Internet`, `System`, `Games`
|
||||
|
||||
The desktop scans `0:/apps/` at startup and adds matching entries to the application menu. The `binary` field is the executable name (looked up in the system path).
|
||||
The desktop scans `0:/apps/` at startup and builds one catalog used by the
|
||||
application menu, launcher search, and the Apps and Settings virtual folders.
|
||||
`app.id` must be unique; when omitted, the containing directory name is used.
|
||||
The `binary` field names an executable in that app's bundle.
|
||||
|
||||
`desktop.section` accepts `apps` (the default), `settings`, or `hidden`.
|
||||
Section placement is independent of `menu.visible`: a Settings item can be
|
||||
hidden from the application menu while remaining directly searchable in the
|
||||
launcher. Set `desktop.admin_only` to hide the item from non-administrator
|
||||
users. `launch.pass_home_dir` controls whether the current user's home path is
|
||||
passed as the executable's first argument.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -17,18 +17,34 @@ namespace gui {
|
||||
|
||||
static constexpr int MAX_WINDOWS = 8;
|
||||
static constexpr int PANEL_HEIGHT = 32;
|
||||
static constexpr int MAX_EXTERNAL_APPS = 32;
|
||||
static constexpr int MAX_LAUNCHER_ITEMS = 64;
|
||||
|
||||
// External app discovered from 0:/apps/ manifest
|
||||
struct ExternalApp {
|
||||
enum DesktopItemSection : uint8_t {
|
||||
DESKTOP_ITEM_SECTION_HIDDEN = 0,
|
||||
DESKTOP_ITEM_SECTION_APPS,
|
||||
DESKTOP_ITEM_SECTION_SETTINGS,
|
||||
};
|
||||
|
||||
enum DesktopItemLaunchKind : uint8_t {
|
||||
DESKTOP_ITEM_LAUNCH_EXECUTABLE = 0,
|
||||
DESKTOP_ITEM_LAUNCH_BUILTIN,
|
||||
};
|
||||
|
||||
// Launchable desktop item discovered from an app manifest or supplied by the
|
||||
// desktop's built-in registry.
|
||||
struct DesktopItem {
|
||||
char id[48];
|
||||
char name[48];
|
||||
char binary_path[128];
|
||||
char icon_path[128];
|
||||
char category[24];
|
||||
SvgIcon icon;
|
||||
DesktopItemSection section;
|
||||
DesktopItemLaunchKind launch_kind;
|
||||
int builtin_id;
|
||||
bool menu_visible;
|
||||
bool launch_with_home;
|
||||
bool admin_only;
|
||||
};
|
||||
|
||||
enum LauncherItemKind : uint8_t {
|
||||
@@ -152,9 +168,10 @@ struct DesktopState {
|
||||
|
||||
SvgIcon icon_volume;
|
||||
|
||||
// External apps discovered from 0:/apps/ manifests
|
||||
ExternalApp external_apps[MAX_EXTERNAL_APPS];
|
||||
int external_app_count;
|
||||
// Desktop items discovered from 0:/apps/ manifests (dynamically grown).
|
||||
DesktopItem* desktop_items;
|
||||
int desktop_item_count;
|
||||
int desktop_item_capacity;
|
||||
|
||||
bool ctx_menu_open;
|
||||
int ctx_menu_x, ctx_menu_y;
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* desktop_applet.hpp
|
||||
* Shared-library desktop applet ABI for MontaukOS
|
||||
* Copyright (c) 2026 Daniel Hammer
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace gui::desktop_applet {
|
||||
|
||||
inline constexpr uint32_t ABI_VERSION = 1;
|
||||
inline constexpr uint32_t CAP_SYSTEM_CONFIGURATION = 1u << 0;
|
||||
|
||||
struct Host {
|
||||
char current_user[32];
|
||||
char home_dir[128];
|
||||
char user_config_dir[128];
|
||||
bool is_admin;
|
||||
};
|
||||
|
||||
struct Descriptor {
|
||||
uint32_t abi_version;
|
||||
uint32_t capabilities;
|
||||
const char* applet_id;
|
||||
const char* display_name;
|
||||
const char* icon_path;
|
||||
};
|
||||
|
||||
using QueryFn = const Descriptor* (*)();
|
||||
using OpenFn = bool (*)(const Host* host);
|
||||
|
||||
inline constexpr const char* QUERY_SYMBOL = "desktop_applet_query_v1";
|
||||
inline constexpr const char* OPEN_SYMBOL = "desktop_applet_open_v1";
|
||||
|
||||
} // namespace gui::desktop_applet
|
||||
Reference in New Issue
Block a user