# Screen Lock

> Khoa man hinh mem: phim tat hoac tu khoa khi idle, hoat anh 2 con mat phan ung theo du lieu he thong, o nhap mat khau tuong lai.

| | |
|---|---|
| Version | 1.0.0 |
| Category | Security |
| Permissions | process.control |
| Depends on | ai-chat |

# Screen Lock

Soft screen lock: global-hotkey or idle auto-lock, a fullscreen kiosk overlay with two
animated eyes that react to live system data, and a futuristic password field to unlock.

**Type:** `backend`. This is an app-level SOFT lock (immersive overlay), NOT an OS lock — a
determined user can still bypass it via Task Manager. Password is stored as a salted SHA-256 hash.

## Files

- `manifest.json` — metadata, `defaultSettings`, `defaultWidgetConfig`.
- `main/index.ts` (+ compiled `index.js`) — main process: global shortcut, idle watcher
  (`powerMonitor`), one fullscreen kiosk `BrowserWindow` per display, password verify + lockout,
  1 Hz CPU/mem/duration stats feed.
- `main/lock-preload.ts` (+ `lock-preload.js`) — `contextBridge` bridge (`window.screenLock`).
- `main/lock.html` / `main/lock.css` / `main/lock.js` — the lock window UI (real BrowserWindow):
  aurora backdrop, HUD telemetry, two reactive eyes, neon unlock panel.
- `widget.html` / `js/widget.js` / `css/widget.css` — status + "Lock now" + settings overlay.
- `settings.html` / `js/settings.js` / `css/settings.css` — standalone settings page.
- `js/settings-form.js` / `css/form.css` — the settings form shared by both the widget overlay
  and the settings page (same plugin origin → one shared script instead of duplicated markup).
- `locales/en.json5` / `locales/vi.json5` — UI strings (`widget.*` / `settings.*`).
- `icon.svg` — padlock carrying two eyes.

## Default settings

- `hotkey` — `"Ctrl+Alt+L"` (global shortcut to lock)
- `autoLock` — `true` (auto-lock when idle)
- `idleMinutes` — `5`
- `maxAttempts` — `3` (wrong tries before a lockout)
- `lockoutSeconds` — `15`
- `coverAllMonitors` — `true`
- `passwordHash` / `pwSalt` — `""` (set via Settings; blank = unlock is free)

## Test

Open Kazuo AI → Plugin Manager — the plugin appears automatically → Install → Enable. Trigger with
the **Lock now** button, `Ctrl+Alt+L`, or by staying idle for `idleMinutes`. With no password set,
press Enter on the lock screen to unlock.

After editing `main/*.ts`, recompile before testing: `npx tsc -p tsconfig.plugins.json` (from the
project root). `lock.html/css/js` are static and are not compiled.
