Shell Ecosystem
Overview
The Shell Ecosystem provides the desktop environment, taskbar, and application launching functionality for FreeWorld OS. It includes DesktopWindow, Taskbar, and ShellExecute components that work together to provide a complete Windows-like shell experience.
Components
1. DesktopWindow
The DesktopWindow provides the desktop background and icon management:
- Full-Screen Window: Desktop window covering entire screen
- Icon Management: Add, remove, and manage desktop icons
- Right-Click Menu: Context menu for desktop
- Z-Order: Very low z-order (behind all windows)
Key Functions
init()- Initialize desktop windowaddIcon(name, x, y, iconPath, targetPath)- Add desktop iconhandleRightClick(x, y)- Handle right-click on desktop
2. Taskbar
The Taskbar provides task management and notification area:
- Task Buttons: Buttons for each open window
- Notification Area: System tray icons
- App Bar: Reserves screen space (windows can't maximize over it)
- Positioning: Bottom of screen (configurable)
Key Functions
init()- Initialize taskbaraddTask(hwnd, title, icon)- Add task buttonremoveTask(hwnd)- Remove task buttonsetActiveTask(hwnd)- Set active taskaddNotificationIcon(icon, tooltip)- Add notification iconsetVisible(visible)- Show/hide taskbarsetPosition(position)- Set taskbar positionsetAutoHide(autoHide)- Enable/disable auto-hide
3. ShellExecute
ShellExecute provides application launching and file association management:
- File Execution: Launch files based on extension
- File Associations: Registry-integrated file type associations
- Verb Support: open, edit, print, etc.
- Process Launching: Launch processes with proper working directories
Key Functions
execute(filePath, operation, parameters, directory, show)- Execute fileexecuteVerb(filePath, verb)- Execute with verblaunchProcess(command, args, directory, show)- Launch processregisterAssociation(extension, progId, command, args)- Register file associationunregisterAssociation(extension)- Unregister associationgetAssociation(extension)- Get file associationgetVerbs(filePath)- Get available verbs for filelistAssociations()- List all associations
File Associations
ShellExecute manages file associations through the Registry:
- Registry Integration: Uses HKEY_CLASSES_ROOT for associations
- ProgID Support: Supports programmatic identifiers
- Command Templates: Supports %1, %L, %* placeholders
- Default Associations: Built-in defaults for common file types
Usage Example
const { DesktopWindow, Taskbar, ShellExecute } = require('./system/shell');
const Registry = require('./system/registry');
const PathParser = require('./system/path');
const registry = new Registry();
const pathParser = new PathParser();
const shellExecute = new ShellExecute(registry, pathParser);
// Execute a file
const result = shellExecute.execute('/path/to/document.txt', 'open');
if (result.success) {
console.log(`Process launched: PID ${result.processId}`);
}
// Register file association
shellExecute.registerAssociation(
'txt',
'txtfile',
'notepad.exe',
'%1'
);
// Get available verbs
const verbs = shellExecute.getVerbs('/path/to/document.txt');
// Returns: ['open', 'edit', 'print']
Integration
The Shell Ecosystem integrates with:
- Registry: File association storage
- Path Parser: Path resolution for executables
- Window Manager: Desktop and taskbar windows
- Process Management: Process launching
- Event System: Taskbar updates via EventBus