8BitDo Zero 2 for Anki (no Karabiner)
Anki add-on that maps the 8BitDo Zero 2 to reviewer actions. Written for
Anki 2.1.54 (Qt 6.3.1 / PyQt 6.3.1 / Python 3.9) on macOS.
Available on AnkiWeb: https://ankiweb.net/shared/info/1005118618
Instead of pairing the controller as a keyboard and remapping keystrokes
with Karabiner-Elements (which needs the Input Monitoring permission),
the controller is paired in gamepad mode and read through the Gamepad
API inside Anki's own webview. Nothing outside Anki sees it.
gamepad.js gets injected into Anki's pages, polls
navigator.getGamepads() at 30 Hz, and forwards button presses to
Python over the pycmd bridge. __init__.py maps them to actions via
the add-on config. The d-pad works whether the current mode reports it
as buttons or as an axis pair.
Install
From AnkiWeb: in Anki, go
to Tools โ Add-ons โ Get Add-ons and paste the code 1005118618.
From source:
cp -R zero2_controller "$HOME/Library/Application Support/Anki2/addons21/"
then restart Anki. Or build a package to install via Tools โ Add-ons โ
Install from file:
cd zero2_controller && zip ../anki-gamepad.ankiaddon __init__.py gamepad.js config.json config.md manifest.json
Controller setup (one-time)
- Remove any old keyboard-mode pairing from macOS Bluetooth settings
(each mode pairs as a different device).
- Power on in macOS gamepad mode: hold A + Start (LED blinks 3x per
cycle).
- Hold Select for 3 seconds, then pair with "Wireless Controller" in
Bluetooth settings.
- In Anki, press any button once โ the Gamepad API hides controllers
until the first press. A "Controller connected" tooltip appears.
- Later sessions: press Start to reconnect.
If macOS mode gives odd button numbers, try Switch mode (Y + Start) or
Android mode (B + Start) and remap. Pressing an unmapped button shows a
tooltip with its config key.
Default mapping
Follows Jesse Simon's layout:
(photo from Jesse Simon's post)
| Control |
Action |
| Y (left) |
Flip card / Good |
| X (top) |
Again |
| A (right) |
Hard |
| B (bottom) |
Easy |
| L |
Undo |
| R |
Bury card |
| Select |
Deck browser |
| Start |
Sync |
| D-pad up |
h (hint reveal add-on) |
| D-pad down |
n (cloze one-by-one) |
| D-pad left |
Scroll down |
| D-pad right |
Scroll up |
Grade buttons on the question side reveal the answer first, and also
step deck browser โ overview โ study. Everything is remappable in
Tools โ Add-ons โ Config, including arbitrary key:<x> bindings โ see
zero2_controller/config.md for the full action list.
License
AGPLv3, same as Anki itself.