New keyboard shortcuts

This commit is contained in:
Muzhen Gaming
2025-10-16 10:23:45 +08:00
parent 5901254405
commit d9fc7d4b61
5 changed files with 68 additions and 31 deletions

View File

@@ -6,14 +6,14 @@
**Hotkeys**
- Alt+Shift+1 — Capture active window (added to input buffer)
- Alt+Shift+2 — Send payload (buffered images + prompt) to OpenAI; save response
- Alt+Shift+3 — Action 3 (depends on mode)
- Ctrl+Shift+1 — Capture active window (added to input buffer)
- Ctrl+Shift+2 — Send payload (buffered images + prompt) to OpenAI; save response
- Ctrl+Shift+3 — Action 3 (depends on mode)
- Mode 1: Type response char-by-char into current input field
- Mode 2: Clipboard mode: primes clipboard with first char; every Ctrl+V advances to next char
- Alt+Shift+4 — Reset program state (clears buffers and captured files)
- Alt+Shift+5 — Quit permanently (press 3x within 2 seconds); also deletes app data directory
- Alt+Shift+6 — Switch Action 3 mode (toggle between Mode 1 and Mode 2)
- Ctrl+Shift+4 — Reset program state (clears buffers and captured files)
- Ctrl+Shift+5 — Quit permanently (press 3x within 2 seconds); also deletes app data directory
- Ctrl+Shift+6 — Switch Action 3 mode (toggle between Mode 1 and Mode 2)
**Customize**
@@ -22,6 +22,14 @@
- `endpoint_base` (e.g., `https://api.openai.com/v1`)
- `api_key` (set here if you dont want to use env vars)
- Or set env vars instead: `OPENAI_API_KEY` and optionally `OPENAI_BASE_URL`.
- Hotkeys are easily customizable via env vars (override at launch):
- `BG_AGENT_SHORTCUT_CAPTURE` (default `ctrl+shift+1`)
- `BG_AGENT_SHORTCUT_SEND` (default `ctrl+shift+2`)
- `BG_AGENT_SHORTCUT_ACTION3` (default `ctrl+shift+3`)
- `BG_AGENT_SHORTCUT_RESET` (default `ctrl+shift+4`)
- `BG_AGENT_SHORTCUT_QUIT` (default `ctrl+shift+5`)
- `BG_AGENT_SHORTCUT_TOGGLE_MODE` (default `ctrl+shift+6`)
- Example (PowerShell): `$env:BG_AGENT_SHORTCUT_SEND='ctrl+shift+enter'`
- App data directory (captures, response, logs): `%LOCALAPPDATA%\BgVisionAgent`.
**Debug Logging**
@@ -33,6 +41,10 @@
- Additionally, the agent saves full OpenAI HTTP request/response JSON files (URL, headers, payload, status, headers, body) in `%LOCALAPPDATA%\BgVisionAgent\http`. Filenames include timestamps and attempt numbers. Secrets are redacted from headers.
- When not enabled, only warnings/errors go to stderr; no log file is written.
Hotkey behavior
- Global hotkeys are registered with `suppress=True` by default to avoid OS/app conflicts and ensure chords are detected reliably.
- To disable suppression (let the key chord also pass through), set `BG_AGENT_SUPPRESS_HOTKEYS=0` before launch.
**Notes**
- Windows is supported now; code is structured to later add macOS/Linux window capture backends.