Native Swift macOS menu bar utility that automatically detects Ducky One keyboards on USB and applies a scoped PC → Mac HID key mapping — leaving Apple Magic Keyboards and built-in MacBook keyboards untouched.
Live Project Page · Download DMG
- Real-time USB Detection (Zero Permissions Required): Watches macOS
IOHIDEventServicearrival/removal via IOKitIONotificationPortand recovers automatically after sleep/wake (NSWorkspace.didWakeNotification). Requires no Input Monitoring or Accessibility permissions. - Per-Device Scoped HID Mapping: Uses macOS's native
UserKeyMapping(hidutil, Apple Technical Note TN2450) scoped to the detected Ducky keyboard's exactVendorID,ProductID,LocationID, andUSBtransport. Works in password prompts, Spotlight, Terminal, and all apps with zero latency. - Native Menu Bar Status Indicator:
⌨ ⌘(filled): Ducky One USB detected and Mac-mapped⌨ PC: Ducky One USB detected, mapping paused⌨: Waiting for Ducky One USB keyboard
- Customizable PC → Mac Mapping Rules:
- Swap Left Alt ↔ Left ⌘ Command (Win) (default: ON)
- Swap Right Alt ↔ Right ⌘ Command (Win) (default: ON)
- Map Print Screen / Scroll Lock / Pause → F13 / F14 / F15 (default: ON)
- Remap Menu (App) key → Right ⌘ Command, Right ⌥ Option, or Unchanged (default: Right ⌘)
- Optional Caps Lock → ⎋ Escape or ⌃ Left Control
- Optional ISO
§ / ±↔` / ~swap - Optional Match any Ducky USB keyboard (expands matching beyond Ducky One series)
- Clean Lifecycle: Optional Launch at Login (
SMAppService.mainApp), a native About window with custom hero artwork and build info, bespoke macOS squircle app icon, auto-incrementing build numbers, and automatic restoration to default PC layout on app quit.
Every invocation of scripts/build-app.sh automatically increments Resources/build-number.txt and updates CFBundleVersion in Info.plist.
./scripts/build-app.sh
open build/DuckyKeyboardMod.app# Build into build/DuckyKeyboardMod.dmg
./scripts/build-dmg.sh
# Build and copy directly to ~/Desktop/DuckyKeyboardMod.dmg
./scripts/build-dmg.sh --desktop./scripts/install-app.shDEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift testSources/DuckyCore/— Pure Swift core library:HIDKeyCodes.swift: Apple HID Usage Page0x07key codes, mapping rules, andUserDefaults-persisted settings.HIDKeyboardDevice.swift: NDJSON service parser, multi-interface physical keyboard deduplication (6KRO + NKRO), andDuckyDeviceMatcher(USB transport + Ducky One product names & known USB VID/PID fallbacks).HIDUtilBackend.swift: Native/usr/bin/hidutilrunner for listing keyboards and scopingUserKeyMappingper physical USB device.USBDeviceWatcher.swift: IOKitIONotificationPorthot-plug watcher with debouncing and sleep/wake handling.KeyboardMapperController.swift:@MainActorstate machine coordinating detection, auto-mapping, verification, and cleanup.
Sources/DuckyKeyboardMod/— Native SwiftUI + AppKit menu bar app (LSUIElement = true).Tests/DuckyCoreTests/— Swift Testing suite covering matching, NDJSON parsing, rule generation, controller lifecycle, and read-only live macOS HID enumeration.
