How koekeishiya/skhd works
Main Components Identification
a) Core Components:
• Event Tap System (event_tap.c/h)
• Hotkey Manager (hotkey.c/h)
• Config Parser (parse.c/h, tokenize.c/h)
• Hot Reload System (hotload.c/h)
• Key Synthesizer (synthesize.c/h)
b) Supporting Components:
• Logging System (log.h)
• Notification System (notify.c)
• Service Management (service.h)
• Locale Handler (locale.c/h)
┌─────────────────────────────────────────────────┐
• macOS System │
• ┬─────────────────┬──────────────┘
• ▼ ▼
┌──────────────────────┐ ┌──────────────┐
• Accessibility API │ │ File System │
• ┬───────────┘ └───────┬──────┘
┌──────────▼──────────────────────▼──────────────┐
• SKHD │
• ┌─────────────┐ ┌──────────────────┐ │
• Event Tap ◄────────► Hotkey Manager │ │
• ┬───────┘ └────────┬─────────┘ │
• ┌─────▼───────┐ ┌───────▼─────────┐ │
• Synthesizer │ │ Config Parser │ │
• ┘ └───────┬─────────┘ │
• ┌───────▼─────────┐ │
• Hot Reloader │ │
• ┘ │
• ┘
Data Flow Indicators
• Bidirectional communication between Event Tap and Hotkey Manager
• One-way flow from Config Parser to Hotkey Manager
• Event flow from Accessibility API to Event Tap
• Configuration file monitoring from File System to Hot Reloader
Additional Details
Config File → Tokenizer → Parser → Hotkey Manager
Implementation Notes
• Use of hashtable for efficient hotkey lookup
• Modal hotkey system support
• Application-specific hotkey handling
• Blacklist functionality