Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kindle Writer

Turn a Kindle into a distraction-free typewriter using a Bluetooth keyboard, an Android phone as a relay, and a Python HTTP server for text sync.

How It Works

BT Keyboard  ->  Android Phone (Chrome /keyboard)  ->  Python Server (port 3333)  ->  Kindle Browser (/writer)
  1. A Python HTTP server holds the document state (text, cursor, version) in memory.
  2. The keyboard page (/keyboard) captures keystrokes from a paired BT keyboard via a hidden textarea and sends them to the server over XHR.
  3. The writer page (/writer) polls the server every 2s and renders the document with a cursor — optimized for Kindle's e-ink display (serif font, black-on-white, minimal CSS).
  4. The server auto-saves to drafts/ every 30s and supports save/load to GitHub Gists.

Project Structure

.
├── kindle_writer.py          # Main server — serves /writer, /keyboard, and JSON API
├── setup_termux.sh           # Termux (Android terminal) setup script
├── kindle_bookmark.html      # Bookmark page for Kindle browser with quick-connect links
├── google_apps_script.js     # Google Apps Script to save documents to Google Docs
├── webcam_server.py          # Separate utility — webcam live view + video recording (port 8080)
│
├── KindleWriter/             # Android app (Kotlin + NanoHTTPD) — native alternative to Termux
│   ├── app/
│   │   ├── build.gradle.kts
│   │   └── src/main/java/com/kindlewriter/
│   │       └── WriterService.kt
│   ├── build.gradle.kts
│   └── settings.gradle.kts
│
├── drafts/                   # Auto-saved documents (markdown)
└── clips/                    # Recorded webcam clips (mp4)

Server API

Endpoint Method Description
/writer GET E-ink reader page (polls for text)
/keyboard GET Keyboard input page (captures keystrokes)
/api/text GET Returns current document state as JSON
/api/keystroke POST Process a single keystroke
/api/batch POST Insert a batch of text at cursor
/api/config POST Set title, GitHub token, gist ID
/api/save POST Save document to GitHub Gist
/api/load POST Load document from a GitHub Gist
/api/new POST Reset to empty document

Keyboard Shortcuts

  • Ctrl+A — Move cursor to start of line
  • Ctrl+E — Move cursor to end of line
  • Ctrl+K — Kill (delete) to end of line
  • Ctrl+S — Save to Gist
  • Arrow keys, Home, End — Navigation
  • Ctrl+Arrow — Word-level navigation

Deployment

Option A: Termux on Android

pkg update && pkg install python
python kindle_writer.py

See setup_termux.sh for full setup.

Option B: Native Android App (KindleWriter/)

A Kotlin Android app that runs the same HTTP server as a foreground service with a wake lock. Uses NanoHTTPD instead of Python's http.server.

Option C: Run on Mac/PC

python3 kindle_writer.py

Open /keyboard in any browser and point the Kindle to /writer.

Webcam Server (webcam_server.py)

A separate utility (port 8080) for live webcam preview and video recording. Uses imagesnap for frame capture and ffmpeg for recording. Used for documenting the project.

About

Turn a Kindle into a distraction-free typewriter using a Bluetooth keyboard, Android phone relay, and Python HTTP server

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages