Tracking Mouse Cursor
Tracking the mouse cursor and displaying an overlay near it.
Displaying an overlay near the cursor
You can import a ready-made example from here: https://eu.eyeauras.net/share/S20240224000701ZxH9BwnuQbRX
- Create an aura.
- Add HotkeyIsActive to it and bind it to a convenient button (this will be our on/off switch). In the example, it's
F1. - Add a C# Script action to WhileActive.
- Copy and paste the script itself.
- Now, when our aura is activated, a small colored square will be rendered near the cursor.

This top-level EyeAuras script requires Roxy and OSD. With the standard Windows Input backend, CursorPosition is a screen point; this example sends no input. The loop checks cancellation and pauses between updates. On exit, the rectangle is disposed before the canvas is cleared and disposed. A helper class must receive the services and token explicitly. See OSD ownership and monitor limits.
using System.Drawing;
using EyeAuras.Roxy.Api;
using EyeAuras.Shared.Scripting;
using EyeAuras.Blazor.Controls.ScreenOverlay;
{
var sendInputApi = GetService<ISendInputScriptingApi>();
using var canvas = GetService<IOnScreenCanvasScriptingApi>().Create();
try
{
using var rectangle = canvas.AddRectangle();
rectangle.BorderColor = Color.Azure;
rectangle.BorderThickness = 1;
rectangle.Size = new Size(32, 32);
Log.Info("Starting tracking");
while (!cancellationToken.IsCancellationRequested)
{
rectangle.Location = sendInputApi.CursorPosition;
Sleep(16);
}
}
finally
{
canvas.Clear();
Log.Info("Completed tracking");
}
}
Naturally, the overlay can render not only squares. It can be anything - text, image, even video.