How 10xrashed/webos works
Project Type and Purpose
• This is a client-only, browser-based “operating system” environment implemented as a single-page HTML/CSS/JS application (webOS.html).
• It simulates a Linux-like desktop: window manager, terminal emulator, virtual file system (VFS), built-in apps, games, and persistent storage via LocalStorage.
Key Architectural Components
a. Browser Host Environment
• The web browser is the runtime container (Chromium, Firefox, Safari).
• Provides DOM, CSS rendering, JavaScript engine, LocalStorage API, event loop.
b. UI & Window Management Layer
• Window manager: handles creation, dragging, resizing, minimizing/maximizing, closing.
• Taskbar & system tray: tracks open windows, clock, indicators.
• Start menu & context menus: dynamic menus bound to right-click or start button.
• Theme engine: CSS classes for Dark, Light, Retro, Neon.
c. Core Services Layer
• Virtual File System (VFS) service: in-memory directory tree mirrored to LocalStorage.
• Persistence module: serializes VFS state on each file operation and on shutdown to LocalStorage; restores at boot.
• Settings manager: stores user preferences (theme, wallpaper) in LocalStorage.
d. Terminal & Command Interpreter
• Terminal UI component: text input/output, history buffer, prompt.
• Command parser/executor: maps commands (ls, cd, cat, git, docker, etc.) to JS functions.
• Extensions: tab completion, command history navigation, sudo simulation, neofetch display.
e. Applications Suite
• Built-in apps loaded dynamically in windows—each is a JS module that interfaces with Core Services and UI.
• File Explorer: graphical tree view of VFS.
• Code Editor: text editing, syntax highlighting.
• Web Browser: simulated multi-page environment.
• Music Player, Calculator, Email Client, Calendar, System Monitor, Games (Snake, TTT, Guessing).
f. System Monitor
• Polls browser performance APIs (memory, CPU usage, FPS) and renders charts.
Interactions & Data Flows
• User → Browser UI → Window Manager → App Modules
• App Modules ↔ Core Services (VFS, Settings) via service APIs
• Terminal ↔ Core Services & App Modules (e.g., file operations, launching apps)
• Core Services ↔ LocalStorage (persistence)
• System Monitor ← Browser performance APIs
Architectural Patterns & Design Principles
• Modular, single-page architecture: discrete JS modules for core services, UI components, applications.
• MVC-like within each app: e.g., File Explorer separates view (tree UI), model (VFS node), controller (user actions).
• Pub/Sub or event bus for inter-module communication (e.g., file system events trigger UI updates).
• Client-side persistence: LocalStorage as durable store.