Files
mac_without_borders/TODO.md
T

178 lines
9.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TODO — mwb-mac backlog, one lane at a time
Lanes run strictly in this order (`docs/loop.md`). Each lane ticks only
its own lines. Items name the Windows behaviour to port and the
`docs/protocol.md` section (§) or Windows file that specifies it. There
are no test-writing items: the user tests the app (CLAUDE.md).
Target: a native macOS app with a menu-bar status item and a settings
window that supports every function of the PowerToys module except the
ones in §Out of scope.
---
## 0. bootstrap — done 2026-09-15
- [x] SwiftPM skeleton, `tools/gates.sh`, `tools/bundle.sh`,
`mwb --version` / `--check-permissions`, `docs/loop.md`.
## 1. wire-core (core) — `Sources/MWBCore/Packet.swift`, `Framing.swift`, `MagicHash.swift`, `CipherStream.swift`
- [x] `PackageType` (raw `UInt8`, every value §1.2), big/small rule §1.1,
unknown values tolerated.
- [x] `Packet` over a 32/64-byte little-endian buffer with union views:
mouse, keyboard, nonce, postAction, machineName, 48-byte clipboard
payload at offset 16.
- [x] ASCII space-padded 32-byte machine name; non-ASCII refused.
- [x] `Framing.seal` / `open` exactly §1.3 (checksum bytes 2..31, magic
top 16 bits, bytes 1–3 zeroed on open).
- [x] `magicNumber(for:)` §2.1 (50 001 SHA-512 rounds, `<< 23` overlap,
UTF-16 unit truncated to a byte, 32-byte buffer).
- [x] PBKDF2-HMAC-SHA512 100 000 rounds / 32 bytes via CommonCrypto;
`CipherWriter` / `CipherReader` with 16+16 header, sacrificial
block, streaming AES-256-CBC no padding §2.3. No secrets in
descriptions or logs.
- [x] Key rules §2.4: 16-char minimum, generator with the four charsets,
display grouping.
## 2. session-matrix (core) — `Sources/MWBCore/Sequencing.swift`, `Session.swift`, `Matrix.swift`, `MachinePool.swift`, `Switching.swift`, `Edge.swift`, `Coordinates.swift` — done 2026-09-16
- [x] `Session`: sans-I/O state machine, `feed(bytes) -> [Event]`,
`outgoing() -> Data`, `SocketStatus` NA…Connected §3.2, injected clock.
- [x] Handshake §3.2: 10× `Handshake`, nonce complement, `HandshakeAck`,
adopt peer name/id, >10 untrusted ⇒ InvalidKey, self-connect close,
>10 failures ⇒ give up. *(The per-endpoint failure counter is the
control-channel's — see that lane's §3 and the session-matrix
Handshakes request.)*
- [x] Dedup ring of 50 ids with the four exemptions §1.4; `Id` counter
persisted via settings hook.
- [x] Heartbeat 60 s / 300 s, `Awake` vs `Heartbeat`, `Hi`, `ByeBye`,
25 min liveness §3.3.
- [x] `Matrix` (4 slots, one/two rows, wrap) and `MachinePool`
(`Name:Id,…`, alive) §4.1; `Matrix` packet encode/decode §4.2;
learning peers from Heartbeat/Hello/Awake; `LiveMachineMatrix`.
- [x] Switching: move left/right/up/down, `desMachineID`, ALL mode,
`MachineSwitched`, `NextMachine` (id in `WheelDelta`) §4.4.
- [x] Edge detection §4.3 (primary-vs-desktop rule, 100 ms debounce,
corner blocking) and coordinate normalisation §4.4 (four rectangle
cases, `MOVE_MOUSE_RELATIVE` / `XY_BY_PIXEL` biases).
## 3. control-channel (net) — `Sources/MWBNet/ControlChannel.swift`, `PeerConnection.swift`, `Resolver.swift`
- [ ] `NWListener` on port+1, both IP families; one client per non-local
matrix name; 1 s retry for 30 s; one connected client per peer §3.1.
- [ ] `PeerConnection`: one `Session` + cipher pair; serialised sends with
500 ms timeout; 32-then-32 receive; status reported for the UI colours.
- [ ] `Resolver`: `getaddrinfo` + `Name2IP` lines; optional /16 and
reverse-lookup checks off by default §7.
- [ ] Reconnect triggers §3.3: `NWPathMonitor` change, wake, reset,
hotkey; `reopenAll()`; delete `Placeholder.swift`.
- [ ] Machine-ID collision ⇒ regenerate and reopen (§1.5).
## 4. input-capture (mac) — `Sources/MWBMac/EventTap.swift`, `Permissions.swift`, `Screens.swift`, `Cursor.swift`, `Hotkeys.swift`, `Sources/MWBCore/KeyMap.swift`
- [ ] `Permissions.request…` added to the preflight file.
- [ ] Session-level head-insert swallowing `CGEventTap` for keys, flags,
mouse, scroll; classify → enqueue → return; pass tagged injected
events; re-enable on timeout/user-input disable (invariants 3, 4).
- [ ] `KeyMap`: macOS keycode ↔ Windows VK, `flagsChanged` → modifier VK
pairs, `LLKHF` flags §5.1; `WM_*` mouse mapping, wheel ×120,
X-buttons, absolute 0..65535 moves §5.2.
- [ ] Hotkeys §4.5 with D4 (⌘=Win, ⌥=Alt): switch machine ⌃⌥F1–F4,
lock (double-press ⇒ ALL + lock), reconnect, toggle Easy Mouse,
switch-to-all; ignore when Shift/⌘ also held; Easy Mouse modes.
- [ ] `Screens`: displays, primary, desktop union, corners; refresh on
change. `Cursor`: park (centre-x, y=4) / hide, decouple while
controlling remote, restore; `HideMouse (50)`; clamp while
controlled §5.3.
## 5. input-inject (mac) — `Sources/MWBMac/Injector.swift`, `KeyState.swift`
- [ ] `Keyboard` packet → `CGEvent` down/up via KeyMap; modifiers as
`flagsChanged`; repeats as repeated downs; 10 ms after key-up like
Windows only if needed.
- [ ] `Mouse` packet → absolute move (de-normalise onto desktop bounds
§4.4), buttons with click-count, wheel (`WheelDelta`/120), X-buttons.
- [ ] Injected-event tag (shared constant with the tap);
`ReleaseAllKeys` on switch/lock/mode change; remote Win+L ⇒ lock
(`CGSession -suspend`); remote Ctrl+Alt+Del ⇒ ignored, logged.
## 6. app-shell (app + core + mac) — `Sources/mwb/*`, `Sources/MWBCore/Settings.swift`, `Sources/MWBMac/StatusItem.swift`, `Sources/MWBMac/SettingsWindow/*.swift`, `Sources/MWBMac/Notifications.swift`
- [ ] `Settings`: PowerToys schema (README §Settings), JSON load/save at
`~/Library/Application Support/mwb-mac/settings.json` (0600),
file watch, random key / `MachineID` / `DeviceID` on first run,
`LastX/LastY/PackageID` persistence.
- [ ] Menu-bar `NSStatusItem`: per-machine status dot in the documented
colours (`doc/devdocs/modules/mousewithoutborders.md`), current
controlled machine, Reconnect, Easy Mouse toggle, Lock all, Open
Settings, Quit.
- [ ] Settings window (SwiftUI): machine matrix editor (4 slots,
drag-reorder, one/two rows), security key (show/generate/copy),
port, every boolean in README §Settings, Easy Mouse picker, hotkey
recorders, Name2IP editor, permissions status with "Open System
Settings" buttons, LaunchAgent toggle.
- [ ] Status messages (`ShowClipboardAndNetworkStatusMessages`) via
`UserNotifications`.
- [ ] Wiring: tap → edge → session → channel → injector; single instance;
logs at `~/Library/Logs/mwb-mac/` without key material.
- [ ] **Hand `dist/mwb.app` to the user** (docs/loop.md §7) with a
checklist: switch by edge and hotkey, wrap, one/two rows, keyboard
with modifiers and function keys, wheel, reconnect after sleep,
wrong key, peer killed mid-control.
## 7. clipboard (core + net + mac) — `Sources/MWBCore/ClipboardCodec.swift`, `Sources/MWBMac/Pasteboard.swift`, `Sources/MWBNet/BulkChannel.swift`, `Sources/MWBMac/ReceivedFile.swift`
- [ ] Text codec `TXT`/`RTF`/`HTM` + SEP, UTF-16LE, raw DEFLATE §6.1
(Foundation `.zlib` is raw DEFLATE like .NET `DeflateStream`; say so);
PNG images; single file path.
- [ ] In-band: 48-byte chunks at offset 16, `ClipboardDataEnd`,
zero-padding, 1 MB limit §6.2.
- [ ] Bulk channel §6.3: listener on port, `Clipboard (69)` broadcast,
pull on `MachineSwitched`, push on `ClipboardAsk`, cipher layout,
64-byte `DATA` each way, `"<len>*<name>"` 1024-byte UTF-16LE header,
1 MB chunks, 32-byte file padding, exact-length read.
- [ ] Files: atomic temp-file commit to `~/Desktop/MouseWithoutBorders/`,
100 MB limit, folders refused, `TransferFile` flag; reveal in Finder.
- [ ] `Pasteboard`: `changeCount` poll 500 ms, 1 s suppression, write on
receive (text/RTF/HTML/PNG/file URL), `ShareClipboard` flag.
## 8. extras (mac + core) — `Sources/MWBMac/Awake.swift`, `Sources/MWBMac/Fullscreen.swift`, `Sources/MWBMac/FakeCursor.swift`
- [ ] `BlockScreenSaverOnOtherMachines`: hold an `IOPMAssertion`
(`PreventUserIdleDisplaySleep`) while `Awake` packets arrive within
the heartbeat window; release on `Heartbeat`/timeout (§3.3).
- [ ] `DisableEasyMouseWhenForegroundWindowIsFullscreen` +
`EasyMouseFullscreenSwitchBlockExcludedApps`: frontmost app via
`NSWorkspace`, fullscreen via the Accessibility API; excluded-apps
editor in the settings window.
- [ ] `DrawMouseCursor` / `DrawMouseEx`: a borderless transparent overlay
window drawing a cursor image where the remote pointer is, so the
user sees where the pointer went (Windows `CustomCursor.cs`).
- [ ] `BlockMouseAtScreenCorners` end-to-end; `MoveMouseRelatively`
end-to-end with `NextMachine` §4.4.
## 9. polish — driven by the user's testing
- [ ] Each finding from the user becomes a line here with the file that
owns the fix.
## Later (post-v1)
- [ ] Keychain storage for `SecurityKey` (D3).
- [ ] `Heartbeat_ex` key propagation (§3.3).
- [ ] "Swap ⌘/⌃ when controlling Windows" option.
- [ ] Non-US layouts: VKs by position vs by character.
- [ ] Finder drag-and-drop file transfer (the Windows Explorer
choreography §6.4, re-designed for Finder).
- [ ] CI on the Gitea runner running `tools/gates.sh`.
- [ ] Updates, notarization, Homebrew cask.
## Out of scope, with reasons (D6)
- Windows service / logon-screen / UAC secure-desktop control: the macOS
login window cannot be driven from a user-session event tap.
- Screen capture to Paint (`CaptureScreenCommand`): niche; packets are
ignored and logged.
- GPO, telemetry, `ShowOriginalUI`, `UseService`: Windows-only.