# DVX Task Manager (taskmgr.lib) A separate DXE3 module that provides the system Task Manager window. Built as `taskmgr.lib` and loaded alongside the other libs at startup. The Task Manager is a shell-level component, not tied to any app -- it persists even if the desktop app (Program Manager) is terminated. ## Registration The module uses a GCC `__attribute__((constructor))` function to register itself with the shell at load time. The constructor sets the `shellCtrlEscFn` function pointer (declared in `shellApp.h`) to `shellTaskMgrOpen`. The shell calls this pointer when Ctrl+Esc is pressed. If `taskmgr.lib` is not loaded, the pointer remains NULL and Ctrl+Esc does nothing. ## Features - **App list**: 6-column ListView showing Name, Title, File, Type, Memory, and Status for all running apps - **Memory column**: Per-app memory usage from `dvxMemGetAppUsage()`, displayed in KB or MB - **Switch To**: Raises and focuses the selected app's topmost window; restores it if minimized. Also triggered by double-clicking a row. - **End Task**: Force-kills the selected app via `shellForceKillApp()` - **Run...**: Opens a file dialog to browse for and launch a `.app` file - **Accelerator keys**: `&Switch To` (Alt+S), `&End Task` (Alt+E), `&Run...` (Alt+R) - **Status bar**: Shows running app count and system memory usage - **Live refresh**: Registers a desktop update callback so the list refreshes automatically when apps are loaded, reaped, or crash ## Window Behavior - Owned by the shell (appId = 0), not by any app - Single-instance: if already open, Ctrl+Esc raises and focuses it - Closing the window unregisters the desktop update callback and cleans up dynamic arrays ## API ```c // Open or raise the Task Manager window. void shellTaskMgrOpen(AppContextT *ctx); // Refresh the task list (called by desktop update notification). void shellTaskMgrRefresh(void); ``` ## Dependencies Loaded after: `dvxshell`, `libtasks`, `libdvx`, `texthelp`, `listhelp` (via `taskmgr.dep`). ## Files | File | Description | |------|-------------| | `shellTaskMgr.h` | Public API (open, refresh) | | `shellTaskMgr.c` | Task Manager window, list, buttons, DXE constructor | | `Makefile` | Builds `bin/libs/taskmgr.lib` + dep file | ## Build ``` make # builds bin/libs/taskmgr.lib + taskmgr.dep make clean # removes objects, library, and dep file ```