Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AirCoding

Control your keyboard and voice input with hand gestures through your camera. No wearable devices needed β€” pure vision-based recognition, built for vibecoding workflows.

Supported Gestures

Gesture Action Description
πŸ‘Œ OK Enter Confirm
βœ‹ Open Palm Escape Cancel
✌️ Scissor Ctrl+Z Undo
🀏 Pinch Toggle Mode Switch Auto-Approve / Manual Confirm
πŸ€™ Phone Call Voice Input Detects foreground AI app and injects its voice shortcut

Tech Stack

  • Python 3.10 - 3.12
  • MediaPipe β€” 21-point hand + 468-point face real-time landmark detection
  • PySide6 (Qt6) β€” GUI framework, frameless transparent always-on-top panel
  • OpenCV β€” camera capture and image preprocessing
  • pynput β€” keyboard event injection
  • pywin32 / psutil β€” Windows foreground window detection & process identification
  • PyYAML β€” configuration file management

Language Support

The UI ships with English (default) and Simplified Chinese. Switch in Settings β†’ Interface β†’ Language, then restart the app.

πŸ‡¨πŸ‡³ δΈ­ζ–‡η‰ˆζ–‡ζ‘£θ§ README.cn.md

Directory Structure

aircoding/
β”œβ”€β”€ main.py                      # App entry: startup flow & signal wiring
β”œβ”€β”€ test_runner.py               # Test program (real camera + log analysis)
β”œβ”€β”€ start.bat                      # Windows launcher (silent, pythonw)
β”œβ”€β”€ AI-SETUP.md                  # AI-agent environment setup guide (read by AI tools)
β”œβ”€β”€ requirements.txt             # Python dependencies
β”œβ”€β”€ config/
β”‚   └── default_config.yaml      # Default config (gesture mapping, thresholds, AI app registry)
β”œβ”€β”€ resources/
β”‚   β”œβ”€β”€ aircoding.ico            # App icon (multi-size)
β”‚   └── aircoding.png            # App icon PNG
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ core/                    # Core modules
β”‚   β”‚   β”œβ”€β”€ enums.py             # Enums (gesture types, light states, system modes)
β”‚   β”‚   β”œβ”€β”€ config_manager.py    # Config manager (default + user config merge)
β”‚   β”‚   β”œβ”€β”€ gesture_config.py    # Default gesture mappings
β”‚   β”‚   β”œβ”€β”€ i18n.py              # Internationalization (en/zh)
β”‚   β”‚   └── state_machine.py     # State machine (light effect transitions)
β”‚   β”œβ”€β”€ camera/                  # Camera modules
β”‚   β”‚   β”œβ”€β”€ camera_manager.py    # Camera capture (dedicated thread, auto-reconnect)
β”‚   β”‚   └── image_processor.py   # Image preprocessing (brightness, denoise)
β”‚   β”œβ”€β”€ recognition/             # Recognition modules
β”‚   β”‚   β”œβ”€β”€ recognition_engine.py # Recognition engine (multi-threaded inference)
β”‚   β”‚   β”œβ”€β”€ hand_classifier.py   # Gesture classifier (per-finger thresholds, 5 gestures)
β”‚   β”‚   β”œβ”€β”€ phone_call_detector.py # Phone-call gesture detection (thumb + pinky)
β”‚   β”‚   β”œβ”€β”€ gesture_validator.py # Gesture validator (multi-frame confirm, cooldown)
β”‚   β”‚   β”œβ”€β”€ calibrator.py        # Calibrator (registration, feature extraction, adaptive)
β”‚   β”‚   └── face_expression.py   # Facial expression (eyebrow raise detection)
β”‚   β”œβ”€β”€ action/                  # Action modules
β”‚   β”‚   β”œβ”€β”€ gesture_mapper.py    # Gesture β†’ keyboard mapping
β”‚   β”‚   β”œβ”€β”€ keyboard_injector.py # Keyboard injection (pynput first, SendInput fallback)
β”‚   β”‚   β”œβ”€β”€ ai_software_detector.py # AI app detection (foreground window match)
β”‚   β”‚   └── auto_approval.py     # Auto-approval controller
β”‚   β”œβ”€β”€ ui/                      # UI modules
β”‚   β”‚   β”œβ”€β”€ main_window.py       # Main window (frameless, tray, calibration)
β”‚   β”‚   β”œβ”€β”€ privacy_preview.py   # Privacy preview (skeleton drawing, valid area)
β”‚   β”‚   β”œβ”€β”€ settings_dialog.py   # Settings dialog (hotkeys, AI apps, calibration)
β”‚   β”‚   β”œβ”€β”€ onboarding.py        # First-run tutorial
β”‚   β”‚   β”œβ”€β”€ light_effect_widget.py # Light effect animations
β”‚   β”‚   └── toast.py             # Toast notifications
β”‚   └── utils/
β”‚       β”œβ”€β”€ logger.py            # Logging (file + console)
β”‚       └── audio.py             # Audio feedback
└── tests/                       # Unit tests
    β”œβ”€β”€ test_hand_classifier.py
    β”œβ”€β”€ test_gesture_validator.py
    └── test_state_machine.py

Core Features

Gesture Recognition

  • MediaPipe 21-point hand landmarks, gesture decided by finger extension/curl ratios
  • Per-finger independent thresholds (personalized after calibration)
  • Dual-threshold hysteresis (extend/curl/gray zone) reduces boundary jitter
  • False-trigger blacklist (finger spacing, direction checks)

Gesture Calibration

  • Guided registration: each gesture captures 30 frames Γ— 2 angles
  • Extracts 8 features (5 finger ratios, thumb direction, thumb-index distance, index-middle angle)
  • Computes per-finger thresholds, persisted to %APPDATA%/AirCoding/calibration_profile.json
  • Continuous adaptation at runtime (auto-updates every 100 successful recognitions)

Phone Call Gesture & Voice Input

  • Rising edge (gesture appears) β†’ detect foreground AI app β†’ inject voice hotkey β†’ start recording
  • Falling edge (gesture released) β†’ inject hotkey again β†’ stop recording
  • Supported apps: WorkBuddy, Doubao, Feishu, WeChat, WeCom + custom entries

Camera Management

  • Dedicated thread at 10fps with frame queue buffering
  • Auto-releases camera when occupied by other apps, auto-recovers when freed
  • Multi-person detection: pauses recognition when a second person appears

Valid Area

  • Circular area centered on the face (radius = face width Γ— 1.625)
  • Hands outside the circle are ignored
  • Dashed circle guide drawn in the preview

Startup Optimization

  • UI window shows first (~0.6s)
  • MediaPipe import and camera open run in parallel in the background (~4s total)
  • QTimer polling checks background init completion

Installation & Running

Requirements

  • Windows 10/11
  • Python 3.10, 3.11 or 3.12 (MediaPipe does not support 3.13+ yet)
  • A webcam

Recommended: AI-Assisted Setup (for AI tool users)

AirCoding is designed to be set up by AI coding assistants (Claude Code, WorkBuddy, Cursor, Windsurf, etc.). The repository ships with AI-SETUP.md β€” a step-by-step environment configuration guide written for AI agents.

  1. Download the project β€” git clone https://github.com/mushi888/AirCoding.git (or download the ZIP and extract it)
  2. Open the folder as a local task in your AI tool β€” point your AI assistant at the project root (the folder containing main.py)
  3. Tell the AI to read AI-SETUP.md and configure the environment β€” the AI will follow the guide: check Python 3.10~3.12, create the .venv_run virtual environment, install all dependencies (~400MB), and verify the install (unit tests included)
  4. Launch the app β€” double-click start.bat (silent launcher, no console window) and allow camera access

πŸ’‘ For AI agents: AI-SETUP.md contains everything needed β€” prerequisites (Gate 0), installation steps, verification gates, troubleshooting, and a Definition of Done checklist. Follow it strictly in order.

Install (Manual)

For users who prefer to set up without an AI assistant:

# Clone
git clone https://github.com/mushi888/AirCoding.git
cd AirCoding

# Create virtual environment (name MUST be .venv_run)
python -m venv .venv_run

# Install dependencies
.venv_run\Scripts\pip install -r requirements.txt
# Global users: pip uses PyPI by default (no flags needed)
# China users: add -i https://pypi.tuna.tsinghua.edu.cn/simple

Run

# Method 1: launcher script (silent, no console window) β€” recommended
start.bat

# Method 2: run directly
.venv_run\Scripts\pythonw.exe main.py

# Method 3: dev mode (console window + live logs)
.venv_run\Scripts\python.exe main.py

Test

# Unit tests
.venv_run\Scripts\python.exe -m pytest tests/ -q

# Gesture test program (real camera)
.venv_run\Scripts\python.exe test_runner.py --frames 30

# Analyze test logs
.venv_run\Scripts\python.exe test_runner.py --analyze <log-file-path>

Configuration

File Locations

File Path Description
Default config config/default_config.yaml Factory defaults, do not edit
User config %APPDATA%/AirCoding/user_config.yaml User overrides
Calibration profile %APPDATA%/AirCoding/calibration_profile.json Calibration data
Logs %APPDATA%/AirCoding/logs/aircoding.log Runtime logs

Global Hotkey

  • Ctrl+Alt+K β€” show/hide panel

Troubleshooting

Symptom Likely Cause Fix
UI shows, camera light on, but no video mediapipe β‰₯ 0.10.15 (legacy API removed) .venv_run\Scripts\pip install "mediapipe>=0.10.0,<0.10.15" --force-reinstall
Log: No module named 'mediapipe.python' mediapipe too new Same as above
Python venv not found on launch venv missing or wrong name Recreate with name .venv_run
No module named 'src' wrong working directory cd to project root first
Camera won't open occupied by another app Close the app holding the camera, restart
Gestures unresponsive not calibrated / hand outside valid area Keep hand in the dashed circle; run calibration

License

MIT License

Copyright (c) 2026 mushi888

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Camera-based gesture control for keyboard and voice input. Vision-only, no wearables, built for vibecoding workflows. Python + MediaPipe + PySide6, Windows 10/11.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages