refactor: unify desktop apps and Settings under item catalog

This commit is contained in:
2026-07-29 13:59:46 +01:00
parent 84ea28a978
commit 75ae7ede56
38 changed files with 322 additions and 797 deletions
+23 -6
View File
@@ -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