Chaos Keyboard
A deliberately hostile Android keyboard. Every character costs a charge, the keys refuse to stay still, typing serves you an ad, and sending a message means winning a timing mini-game first.
Inspiration
Typing is the most invisible interface we own. We wanted to know what happens if it demands something back — attention, patience, luck — without ever breaking.
What it does
A real, installable Android IME that refuses to be convenient:
- Drifting keys. All 36 character keys bounce around the screen on collision. Speed adjustable 0.5x–3x.
- Character quotas. Spend a key's last use and it dims out. Reloading succeeds 100% → 75% → 50% → 25% before cooldown.
- Ads while typing. Each keypress has a 25% chance of a full-screen, unskippable 5-second ad.
- Sending is a mini-game. Your draft never commits directly. Press Confirm and a pointer sweeps a dial — only the red zone submits. Miss it, or hit the 10-second timer, and the draft is wiped.
- Nine themes, each with its own physics feel and palette.
How we built it
Pure WebView — no custom Java UI.
- Patched a decompiled APK shell, swapping only
assets/. - Native bridge via
window.prompt('KQ/op')+onJsPromptfor wallet, delivery, clipboard, and links. - A shared SVG dial engine (
KQDial) so all nine themes reuse one hit-detection routine. - IME-safe input: dual
pointerdown/touchstarthandling, plus slide-off detection so drags don't count as taps. - Frame loop races
requestAnimationFrameagainst an 80ms timer, since Android suspends rAF while an IME attaches. - Pure-Python build pipeline: a hand-written
resources.arscpatcher and a v2+v3 signer — no JDK, no Android SDK.
Challenges we ran into
- No Android toolchain. Rebuilding the binary resource table from scratch meant getting the UTF-8 string pool's two length fields and the 12-byte table header right — we broke it twice before it parsed.
- The dial timed out on frame one. Reset
vNowto0then stamped it as the round start; the next frame's real timestamp made the remaining time negative instantly. - The results overlay never closed. It's an independent
position:fixedlayer, and only the game modal was being hidden. - Ads rendered black. Cross-origin
file://iframes need explicitallow="autoplay", one ad was HEVC-encoded, and dark first frames looked like failures — fixed with autoplay delegation, an H.264 transcode, and poster frames. - The dial showed only a sliver of arc. Not a render failure — a collapsed box. An absolutely positioned wrapper meant the height rule never applied, so
meetscaled the SVG by width and cropped the circle.
Accomplishments that we're proud of
- End-to-end APK pipeline in pure Python, producing a properly v2+v3-signed, installable artifact with no Android tooling present.
- Nine themes, one physics core — new looks are HTML/CSS only.
- Five tunable layers of friction, each adjustable rather than arbitrary.
- A pixel reskin that kept the original's aggressive palette — hard edges, offset shadows, a one-third-resolution dial.
What we learned
- "Not rendering" usually means "zero size." Measure the box before debugging the logic.
- An IME is a hostile runtime: frames get suspended, touch may arrive without pointer events, panels are ~250px tall.
- A clock needs one source of truth. Better to let state be briefly
nullthan fill it with a plausible placeholder. - Full-screen layers need one lifecycle owner, or you get "won't close" and "closes the wrong thing" as a pair.
What's next
- Real-device regression testing across IME panel heights.
- Align the last non-conforming theme with the IME structural contract.
- Difficulty tiers for all five friction parameters.
- Plug a real ad SDK into the existing
present(onDismiss)adapter. - Accessibility: reduced motion, contrast, keyboard-operable dial.
- Publish the theme spec so anyone can ship their own chaos.
Built With
- android
- css
- input
- javascript
- python
- svg
- xml