Anki add-on: The Simple Gamepad

Simple Gamepad Map gamepad buttons to Anki actions. No profiles, no overlays, just a button-to-action config. What it does Connects any standard gamepad (Xbox, PlayStation, 8BitDo, etc.) to Anki and lets you assign an action to each button: flip cards, answer Again/Hard/Good/Easy, undo, open browser, and more. Supports all standard gamepad buttons: A/B/X/Y, D-pad, shoulders, triggers, thumbstick buttons, options, and menu. Custom action slots let you simulate any keyboard shortcut, so you can trigger things in your card templates (e.g. toggle a hint field, play audio). How to use Connect your gamepad via USB or Bluetooth Press any button and you'll see a "Gamepad connected" tooltip Go to Tools > Simple Gamepad Settings to configure button mappings For custom actions: assign a keyboard shortcut to a Custom slot, then add a matching keydown listener in your card template Defaults A = Flip Card B = Undo D-pad Up = Good D-pad Down = Again D-pad Left = Hard D-pad Right = Easy Everything else = Nothing Custom action example (desktop) In the addon config, set Custom 1 to the key P. Map a gamepad button to Custom 1. In your card template, add: <script> document.addEventListener('keydown', function(e) { if (e.key === 'p') { var btn = document.querySelector('.replay-button') || document.querySelector('.replaybutton') || document.querySelector('.soundLink'); if (btn) btn.click(); } }); </script> Now the mapped gamepad button plays the card audio. Custom actions on iPhone (AnkiMobile) This addon is for Anki desktop only, but AnkiMobile has its own custom action support using userJs functions. In your card template, add a userJs1 function: <script> globalThis.userJs1 = function() { var btn = document.querySelector('.replay-button') || document.querySelector('.replaybutton') || document.querySelector('.soundLink'); if (btn) btn.click(); }; </script> In AnkiMobile, go to Settings > Review > Gamepads Map a button to "User Action 1" Now that the gamepad button plays the card audio on your phone. You can add userJs2, userJs3, etc. for more custom actions. The keydown listener (desktop) and the userJS function (mobile) can live in the same template. They don't interfere with each other. Requirements Anki 2.1.66+ Any gamepad recognised as a standard controller by your OS Credits Based on concepts from Contanki by Sam Bradshaw (MIT License).

GitHub repository: learnwithmra/anki-addon-the-simple-gamepad
Languages: Python, JavaScript