Sneakysnek
Dead simple cross-platform keyboard & mouse global input capture solution for Python 3.6+
Install / Use
/learn @SerpentAI/SneakysnekREADME
sneakysnek
sneakysnek is a minimalistic, cross-platform global input capture solution for Python 3.6+. While there are certainly already offerings in terms of input libraries, they generally focus more on sending input, with capturing only being an afterthought. sneakysnek is dead simple in both its design and how you end up using it. You will be up and running in less than 5 lines of code and will start receiving lean & universal events on all 3 supported platforms (Linux, Windows, macOS).
This library was built with the goal of powering the Gameplay Recording feature in the Serpent.AI Framework where keyboard & mouse inputs are collected alongside frame sequences to build machine learning datasets.
Feel free to study the code to learn more about input capturing and use it responsibly!

Installation
pip install sneakysnek
Zero dependencies on Windows. Will install pyobjc-framework-Quartz on macOS and python-xlib on Linux.
Demo
Once installed in your Python environment, you can take it for a quick spin to test it on your platform. Just run sneakysnek.
Usage
Using sneakysnek is ridiculously simple:
from sneakysnek.recorder import Recorder
recorder = Recorder.record(print) # Replace print with any callback that accepts an 'event' arg
# Some blocking code in your main thread...
sneakysnek runs its capturing and callbacks in separate threads. It should not leave anything behind in most cases. For optimal cleanliness, run recorder.stop() from your main thread when you are done recording.
Events
The callback you provide your recorder with will receive one of the following 2 event objects:
KeyboardEvent
Represents an event captured from the keyboard.
Attributes
- event: One of
KeyboardEvents.DOWN,KeyboardEvents.UP - keyboard_key: One entry from the KeyboardKey enumeration
- timestamp: A
time.time()timestamp
MouseEvent
Represents an event captured from the mouse.
Attributes
- event: One of
MouseEvents.CLICK.MouseEvents.SCROLL,MouseEvents.MOVE - button: One entry from the MouseButton enumeration
- direction: One of
"DOWN","UP" - velocity: An integer representing the velocity of scroll events (only >1 on macOS)
- x: An integer representing the x coordinate of the mouse position
- y: An integer representing the y coordinate of the mouse position
- timestamp: A
time.time()timestamp
Enjoying this?
Awesome! For more content, feel free to:
- Learn more about the Serpent.AI Python Framework - Website - Blog - Repo
- Watch some Python development on Twitch & YouTube
- Follow Serpent.AI on Twitter
<3
Related Skills
node-connect
340.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
84.2kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
84.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
340.5kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
