| """ | |
| Read Aloud Earbud Remote | |
| ------------------------- | |
| Listens for your earbuds' Play/Pause, Next and Previous media | |
| button presses and translates them into Read Aloud's global | |
| keyboard shortcuts (Ctrl+Z / Ctrl+Right / Ctrl+Left) -- so it | |
| works no matter which app/window is focused. | |
| Install (one time): | |
| pip install keyboard | |
| Run: | |
| python read_aloud_remote.py | |
| If your earbud buttons don't respond, close this and re-run your | |
| terminal "as Administrator" -- some Windows setups need that for | |
| global key hooks. | |
| Stop: | |
| Press Ctrl+C in this window, or just close the window. | |
| """ | |
| import keyboard | |
| # ---- Earbud button -> Read Aloud shortcut ---- | |
| # Change the right-hand values if you ever change Read Aloud's | |
| # shortcuts in chrome://extensions/shortcuts | |
| MAPPING = { | |
| "play/pause media": "ctrl+z", | |
| "next track": "ctrl+right", | |
| "previous track": "ctrl+left", | |
| } | |
| def make_handler(shortcut): | |
| def handler(): | |
| keyboard.send(shortcut) | |
| return handler | |
| for media_key, shortcut in MAPPING.items(): | |
| keyboard.add_hotkey(media_key, make_handler(shortcut)) | |
| print(f"Mapped '{media_key}' -> '{shortcut}'") | |
| print("\nRead Aloud Earbud Remote is running. Press Ctrl+C to quit.") | |
| keyboard.wait() # blocks forever, keeping the hotkeys active | |
Xet Storage Details
- Size:
- 1.27 kB
- Xet hash:
- 05732f31f4317d42cd1c853be1a89ce70a507dc506eb01b3d81613c822fddbf6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.