# Nexus Windows Replacement Plan — Layer 1.0

**Principle:** Hide Windows by **replacing functions**, not lockdown/registry/GPO.

---

## Phase 1 (this sprint) — Foundation ✅

### Deliverables

1. **Dependency audit** — `WINDOWS-DEPENDENCY-AUDIT.md`
2. **Nexus-branded dialogs**
   - `NexusOpenFileDialog` / `NexusOpenFileDialogWindow`
   - `NexusSaveFileDialog` / `NexusSaveFileDialogWindow`
   - `NexusOpenWithDialog` / `NexusOpenWithDialogWindow`
3. **Default apps model (JSON only)**
   - `NexusFileAssociations` — built-in extension → category → app mapping
   - `NexusDefaultAppsService` — `%LocalAppData%/NinjaNexus/default-apps.json`
4. **Settings integration** — Nexus Settings → **Nexus Default Apps** section
5. **Proof migration**
   - Settings wallpaper browse → `NexusOpenFileDialog`
   - Files double-click → `NexusFileOpenService` (Nexus apps, not ShellExecute)

### Constraints honored

- No registry changes
- No Windows file association changes
- No lockdown changes
- Associations design-only in local JSON

---

## Phase 2 — Dialogs & file open

| Task | Detail |
|------|--------|
| Custom file picker UI | Replace Win32 browse inside Nexus dialog windows with WPF tree + list |
| Files context menu | "Åbn med…" → `NexusOpenWithDialog` |
| Remove ShellExecute default | Delete or dev-gate `TryOpenWithDefaultApp` |
| Extension overrides UI | Per-extension override editor in Default Apps settings |
| Photos/Media open by path | Polish `OpenFilePath` flows (window focus, viewer state) |

---

## Phase 3 — App completeness

| Windows app | Nexus app | Gap |
|-------------|-----------|-----|
| Explorer | Nexus Files | Copy/move/rename, search indexing, zip |
| Photos | Nexus Photos | Full-screen from Files, metadata edit |
| Media Player | Nexus Media | Streaming, codecs, subtitles |
| Settings | Nexus Settings | Network/Bluetooth write, printer install |
| Calculator | Nexus Calculator | Scientific mode parity |
| Notepad | — | **New:** Nexus Notes or Files text editor |

---

## Phase 4 — Platform integration

- Launcher default handlers read `NexusDefaultAppsService` before catalog
- Store packages declare handled extensions
- Control Center policy: allowed default-app overrides per org
- Optional: protocol handler `nexus://open?path=` for external triggers (no registry until approved)

---

## Architecture

```
User action (open file)
        │
        ▼
NexusFileOpenService
        │
        ├─► NexusDefaultAppsService.ResolveHandler(path)
        │         └─► default-apps.json (user prefs)
        │         └─► NexusFileAssociations (built-in map)
        │
        ├─► INexusFileOpenRouter (MainWindow)
        │         ├─► Photos / Media / Files / Browser
        │
        └─► NexusOpenWithDialog (manual pick)
```

---

## File association map (v1 built-in)

| Category | Extensions | Default app |
|----------|------------|-------------|
| Images | jpg, jpeg, png, webp, gif, bmp | Nexus Photos |
| Video | mp4, mkv, avi, webm, mov | Nexus Media |
| Audio | mp3, wav, flac, aac, ogg | Nexus Media |
| Documents | pdf | Nexus Files (preview) |
| Text | txt, md, log, csv | Nexus Files (preview) |

User overrides stored by category in JSON; extension overrides reserved for Phase 2.
