Skip to content

cleverman606/CleanCursor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CleanCursor

A smooth, eased custom cursor overlay for Windows. Replaces your system cursor with a clean arrow sprite that lerp-eases toward your pointer at every frame, giving motion a polished, weighted feel.

How it works

Refresh rate detection

At startup the app queries the primary monitor's current refresh rate and runs the frame loop at exactly that speed — 60, 120, 144, 240 Hz, or whatever the display is set to. No manual configuration needed.

The easing constant is per-frame, not per-second, so it must scale with refresh rate. The formula:

ease = 1 − (1 − EASE_BASE) ^ (60 / fps)

At 60 Hz: ease = 0.16. At 120 Hz: ease ≈ 0.084. At 240 Hz: ease ≈ 0.043. The cursor always takes the same real-world time to settle regardless of refresh rate.

The easing algorithm

Every frame the rendered cursor position moves a fraction of the remaining distance to the real pointer:

cursorX += (mouseX - cursorX) × EASE
cursorY += (mouseY - cursorY) × EASE

This is linear interpolation (lerp). The result is an ease-out that feels silky: it accelerates instantly and decelerates naturally as it converges. A snap threshold (SNAP = 0.04 px) prevents infinite sub-pixel drift.

Click animation

On mouse-down the sprite grows from 32 × 32 px to 43 × 43 px instantly. 300 ms after mouse-up it shrinks back.

Platform

Refresh rate is read via EnumDisplaySettingsWdmDisplayFrequency. The overlay is a tkinter borderless window with WS_EX_TRANSPARENT | WS_EX_LAYERED so clicks pass through. The system cursor is hidden via ShowCursor(False). Chroma-key (#FF00FF) makes the window background transparent.


Performance

CleanCursor is designed to have a negligible footprint. Here is what it actually costs to run.

CPU

The core work per frame is two lerp operations (four float additions/multiplications) plus one Win32 GetCursorPos call and one window move. The lerp math alone accounts for less than 0.05% of a single CPU core even at 360 Hz — it is arithmetically cheaper than a single frame of a video game's physics engine doing anything meaningful.

The total measured CPU usage (Python runtime + tkinter event loop + window management) sits around 0.1–0.5% of one core at 60 Hz under Task Manager, rising proportionally at higher refresh rates but remaining well under 1% in all real-world cases. The thread spends the overwhelming majority of its time sleeping between frames — the OS scheduler wakes it at the next interval and immediately returns it to sleep.

GPU

None. The overlay is a plain Win32 window moved by the CPU each frame. No draw calls, no compositor involvement beyond what Windows already does for any window, no shaders.

RAM

Approximately 30–50 MB for the bundled Python runtime, tkinter, and Pillow. The two cursor sprites (32 × 32 and 43 × 43 px) are under 10 KB of image data combined. The memory footprint is fixed at startup and does not grow over time.

Input lag

None introduced. The overlay window carries WS_EX_TRANSPARENT, which means Windows treats it as invisible for hit-testing — all mouse events fall straight through to whatever is underneath. The easing effect is purely visual: the real cursor position (used by every other application) is always exactly where your hardware puts it.

Startup

The refresh rate is detected once at launch via a single EnumDisplaySettingsW call. There is no background scanning, no polling of hardware sensors, and no network activity of any kind.

Summary

Resource Cost
CPU (lerp math only) < 0.05% of one core @ 360 Hz
CPU (total, typical) < 0.5% of one core
GPU 0%
RAM ~30–50 MB (Python runtime)
Input lag added 0 ms
Network None

Requirements

  • Python 3.10+
  • Pillow (pip install Pillow)
  • PyInstaller (pip install pyinstaller)

Build

build.bat

Produces dist\MysterioCursor.exe. Double-click to run. Press Escape to restore your cursor and exit.


Run without building

python cursor_app.py

Configuration

Constant Default Effect
EASE_BASE 0.16 Lerp strength calibrated at 60 fps — scaled automatically
SIZE_IDLE 32 Normal cursor size in px
SIZE_CLICK 43 Cursor size on click
SNAP 0.04 Sub-pixel snap threshold in px
CLICK_SHRINK_MS 300 Ms after mouse-up before cursor returns to idle size

Project structure

CleanCursor/
├── cursor_app.py   # Windows overlay (tkinter + ctypes)
├── build.bat       # Build script → dist\MysterioCursor.exe
├── requirements.txt
└── LICENSE

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors