The Process Monitor is implemented in
processmonitor.ts (305 lines) and provides a terminal-style interface for viewing active windows and simulated system processes.Opening Process Monitor
Access the Process Monitor through:- Application Manager
- Keyboard Shortcut
- Open Application Manager from the front panel
- Click the Process Monitor icon (task manager icon)
Interface Overview
The Process Monitor displays a terminal-style interface with:System Header
Time, load average, uptime, and task counts
Memory Bars
Visual memory and swap usage with percentage indicators
Process Table
PID, name, CPU%, MEM% columns for all processes
Status Updates
Live updates every 1000ms with real-time data
Process Listing
Active Windows
The Process Monitor scans for active windows and displays them as processes:- Window Elements: All
.windowand.cde-retro-modalelements - PID Assignment: Starting from 1000, incrementing for each window
- Name Detection: From window ID or titlebar text
- Visibility: Shows whether window is currently visible
- Resource Usage: Simulated CPU (0.1-5.0%) and memory (2-12%) values
processmonitor.ts:19-46
System Processes
The monitor also displays simulated system processes:- init (PID 1) - System init process, 0.3% CPU, 1.2% memory
- kthreadd (PID 2) - Kernel thread daemon, 0.0% CPU
- ksoftirqd/0 (PID 3) - Kernel software interrupt daemon, 0.1% CPU
These system processes are simulated for authenticity. They represent typical Unix/Linux system processes that would appear in a real htop display.
Keyboard Navigation
The Process Monitor supports full keyboard control:Process Selection
| Key | Action |
|---|---|
↑ | Move selection up one process |
↓ | Move selection down one process |
Home | Jump to first process |
End | Jump to last process |
Process Actions
| Key | Action |
|---|---|
k or K | Kill selected process (close window) |
q or Q | Quit Process Monitor |
Escape | Close Process Monitor |
processmonitor.ts:114-143
System Information Display
Header Information
Time & Load:- Version: Time Capsule version from package.json
- Current Time: HH:MM:SS format
- Uptime: Time since page load (minutes:seconds)
- Load Average: Simulated 1, 5, and 15-minute load averages
- Total: Number of active processes
- Running: Visible windows (display !== ‘none’)
- Sleeping: Hidden/minimized windows
Memory Display
Memory Bar:- Visual Bar: 40-character bar with filled/empty indicators
- Used/Total: Simulated memory values (4096MB used, 8192MB total)
- Percentage: Calculated usage percentage
- Visual Bar: Similar to memory bar
- Used/Total: Simulated swap values (512MB used, 2048MB total)
- Percentage: Calculated swap usage
Process Table
The process table displays columns:| Column | Description |
|---|---|
| PID | Process ID (1000+ for windows, 1-3 for system) |
| NAME | Window name or process name |
| CPU% | Simulated CPU usage (0.0-5.0%) |
| MEM% | Simulated memory usage (0.0-12.0%) |
- Highlighted in white/cyan color scheme
- Displays process details with ANSI-style color codes
- Updates in real-time as you navigate
processmonitor.ts:145-162
Live Updates
The Process Monitor automatically refreshes every 1 second:- Scan Processes: Re-scans all window elements
- Update Counts: Recalculates task counts (running/sleeping)
- Refresh Display: Re-renders header, memory bars, and process table
- Maintain Selection: Preserves selected process index across updates
processmonitor.ts:241-250
Updates only trigger a full re-render if the process list has changed. This optimization prevents unnecessary DOM updates and improves performance.
Killing Processes
To close a window via the Process Monitor:
Kill Function:
processmonitor.ts:173-190
Technical Implementation
ProcessInfo Interface
Defined in:processmonitor.ts:9-17
Process Monitor Singleton
TheProcessMonitor is implemented as a singleton module pattern:
open()
Opens the monitor, starts updates, and focuses the window
close()
Closes the monitor and stops the update interval
scanProcesses()
Scans DOM for active windows and returns ProcessInfo array
renderContent()
Renders the full terminal-style display with colors
startUpdates()
Begins 1-second update interval
stopUpdates()
Clears the update interval
ANSI Color Codes
The Process Monitor uses ANSI-style color codes for terminal aesthetics:\x1b[36m- Cyan (column headers)\x1b[33m- Yellow (PIDs)\x1b[37m- White (selected row)\x1b[32m- Green (process names)\x1b[0m- Reset (default color)
processmonitor.ts:164-172
Use Cases
Monitor Active Windows
Monitor Active Windows
Keep the Process Monitor open to see which windows are currently active, their visibility status, and simulated resource usage. This helps track what applications are running.
Close Unresponsive Windows
Close Unresponsive Windows
If a window becomes unresponsive or difficult to close normally, use the Process Monitor to kill it with the keyboard shortcut
k. This provides an alternative to clicking the close button.System Monitoring Experience
System Monitoring Experience
Use the Process Monitor to experience an authentic Unix/Linux system monitoring tool similar to
htop or top. It recreates the terminal-style interface and keyboard navigation.
