# Atlus — Project Context
## What Is Atlus?
Atlus is a lightweight, web-based desktop environment designed for headless single-board computers (SBCs) such as the Orange Pi, Raspberry Pi, and similar ARM-based Linux systems. It provides a browser-accessible interface that replaces the need for SSH or VNC for everyday system management tasks.
The goal is not to replicate a full desktop environment — it is to provide the *right* tools for managing a headless SBC in a way that feels natural, fast, and accessible from any device on the local network.
---
## Problem Statement
Headless SBCs are increasingly used as always-on servers, astrophotography rigs, NAS boxes, home automation hubs, and more. Current management options are:
- **SSH** — powerful but unfriendly for non-developers and tedious for routine tasks
- **VNC / noVNC** — requires a full desktop environment, heavy, slow, not purpose-built
- **Cockpit / Webmin** — generic server admin tools, not tailored to SBC use cases, complex UI
There is no lightweight, purpose-built web desktop for SBCs that feels like an OS rather than a server admin panel.
---
## Core Philosophy
- **Web-native first** — no X server required for core functionality
- **Purposefully minimal** — only the tools that matter for headless SBC management
- **Locally hosted** — runs entirely on the SBC, no cloud dependency
- **Accessible from anything** — phone, tablet, laptop — any browser on the local network
- **Tiling over floating** — apps open in the center stage, not as draggable windows
- **Extensible** — apps/widgets can be added as plugins
---
## Target Users
- Makers and hobbyists running headless SBCs for specific purposes (astrophotography, NAS, IoT, etc.)
- Home lab users who want lightweight management without full desktop overhead
- Anyone who currently lives in SSH and wishes there was something better
---
## ✅ Finalized Layout — Three-Column Shell
The Atlus UI is a fixed three-column layout inspired by tiling window managers (awesomewm, i3). There are no draggable or floating windows. Everything is tiled, cascaded, or tabbed within the center stage.
```
┌────────┬─────────────────────────────┬────────────────┐
│ │ Stage Tab Bar │ │
│ Left ├─────────────────────────────┤ Right Panel │
│ Dock │ │ │
│ │ Center Stage │ - Hostname │
│ App │ (active app view) │ - Date/Time │
│ Icons │ │ - Network │
│ │ One app at a time, │ - CPU/RAM/ │
│ (vert) │ or tiled side-by-side │ Disk/Temp │
│ │ │ - Services │
│ Gear ├─────────────────────────────┤ (toggles + │
│ (foot) │ Layout Controls (tab bar) │ open → ) │
└────────┴─────────────────────────────┴────────────────┘
```
### Left Dock
- Vertical strip of app launcher icons — no labels, tooltip on hover
- Top: Atlus "A" logo — opens a system menu (shutdown, restart, about)
- Core apps listed in order (configurable in settings)
- Separator line between core apps and plugins
- Bottom: Settings gear icon (always pinned)
- Active app highlighted with accent border/background
- Badge dot on plugin icons when they have status to report (e.g. ASI Bridge syncing)
### Center Stage
- The primary content area — full height, fills remaining width
- One app visible at a time by default
- **Tab bar** at top shows all open apps; click to switch (previous app minimizes)
- **Layout toggle buttons** (top-right of tab bar) switch between:
- Single pane (full width)
- Horizontal split (two panes side-by-side, 50/50 default)
- Vertical split (stacked, stretch goal)
- Each pane has its own macOS-style titlebar (traffic light dots + title)
- When a second app is opened in split mode, it takes the secondary pane
### Right Panel
- Always visible, fixed width (~220px), never replaced by an app
- **Top section:** Hostname, date, time (live), WiFi name + status, Ethernet status
- **Middle section:** Live system stats — CPU %, Memory used/total, Storage %, CPU temp
- Each stat: compact uppercase label + current value + colored progress bar
- Colors: green (healthy), amber (moderate), red (high)
- **Bottom section:** Services list
- Each service: toggle (on/off), name, ↗ open button
- Toggle maps to `systemctl start/stop`
- ↗ opens that service's detail/control view in the center stage
- Services list is configurable per deployment
---
## Architecture Overview
### Backend Daemon
- Language: **Python (FastAPI + asyncio)**
- Runs as a systemd service on boot
- Exposes a REST API and WebSocket endpoint
- Responsibilities:
- File system access and management
- Systemd service control (start/stop/restart/status)
- Process/task enumeration
- System stats (CPU, RAM, disk, network, temperature) via psutil
- Notification/event bus (watches logs, mount points, service states)
- X11 app process spawner (Xvfb + x11vnc per app — Phase 4 only)
### Frontend
- Language: **Vanilla JS + CSS** (no framework — keep it lightweight and portable)
- No build step — served directly as static files by the FastAPI backend
- Communicates via REST for actions, WebSocket for live stat updates
- CSS custom properties for theming
- IBM Plex Mono for system data; Inter for UI chrome
### X11 App Embedding (Phase 4 — Optional/Advanced)
- For GUI apps that require X (e.g., Nextcloud desktop client)
- Each app spawns its own Xvfb virtual framebuffer
- x11vnc streams that framebuffer over WebSocket via noVNC
- Embedded as a pane in the center stage — not a floating window
- Isolated per-app — no shared display, no full desktop environment needed
---
## Built-in Apps (Core)
### ⚙️ System Settings
The unified configuration hub for the SBC. Organized into sections:
- **General** — System name/hostname, date & time (manual or NTP), timezone
- **Users** — User management, password changes, add/remove users
- **Security** — Screen lock timeout, session timeout, auth settings
- **Applications** — Choose which apps appear in the dock; enable/disable on startup
- **Services** — Which systemd services appear in the right panel; autostart configuration
- **Network** — Per-interface settings (WiFi SSID/password, static IP vs DHCP, DNS); shown for all detected interfaces (eth0, wlan0, etc.)
- **Storage / Automount** — USB automount rules, mount point configuration, eject behavior
- **About** — Atlus version, system info, OS details
---
### 📟 Terminal
A fully functional web-based terminal. No restrictions, no simplifications — behaves identically to SSH or a local terminal session. Powered by xterm.js on the frontend and ptyprocess on the backend for a real PTY.
#### Custom On-Screen Keyboard (Critical)
The system keyboard (iOS/Android) is **never triggered**. Atlus uses its own purpose-built on-screen keyboard for all terminal input. This is non-negotiable — the native keyboard is hostile to terminal use (autocorrect, autocapitalize, no Escape, no function keys, unpredictable behavior).
**How it works technically:**
- The xterm.js terminal canvas is focused but never triggers a system keyboard (it is not an `` or `