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 window
  • addIcon(name, x, y, iconPath, targetPath) - Add desktop icon
  • handleRightClick(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 taskbar
  • addTask(hwnd, title, icon) - Add task button
  • removeTask(hwnd) - Remove task button
  • setActiveTask(hwnd) - Set active task
  • addNotificationIcon(icon, tooltip) - Add notification icon
  • setVisible(visible) - Show/hide taskbar
  • setPosition(position) - Set taskbar position
  • setAutoHide(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 file
  • executeVerb(filePath, verb) - Execute with verb
  • launchProcess(command, args, directory, show) - Launch process
  • registerAssociation(extension, progId, command, args) - Register file association
  • unregisterAssociation(extension) - Unregister association
  • getAssociation(extension) - Get file association
  • getVerbs(filePath) - Get available verbs for file
  • listAssociations() - 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

Related Documentation