toggle_mouse_grab(3)
β¨ toggle_mouse_grab(3) β¨
okay so bestie, welcome to toggle_mouse_grab(3) from the Arcan Lua API β this is the page that explains how to switch the lock state of the mouse device, and honestly? iconic little utility energy. π
πΈ NAME πΈ
toggle_mouse_grab β switch the lock state of the mouse device. periodt. no cap, thatβs the whole name vibe.
π SYNOPSIS π
grabstate
toggle_mouse_grab( optmode )
π DESCRIPTION π
So for some control schemes, itβs genuinely important to stop mouse input from being dropped by window managers in the underlying OS. thatβs the whole reason this function exists, bestie. π¦
toggle_mouse_grab lets you toggle that state, or explicitly set it to MOUSE_GRABON or MOUSE_GRABOFF. calling this function always returns the current active state β thatβs the grabstate in the synopsis, iykyk. β¨
π NOTES π
- always provide escape options for the user to disable grab, so poor desktop environments can recover in the event of a live-lock. literally do not skip this, bestie. π
π¦ EXAMPLE π¦
this is the little demo vibe check π«Ά
function toggle_mouse_grab0()
print( tostring( toggle_mouse_grab() ) );
print( tostring( toggle_mouse_grab() ) );
print( tostring( toggle_mouse_grab(MOUSE_GRABON) ) );
print( tostring( toggle_mouse_grab(MOUSE_GRABOFF) ) );
end
π MISUSE π
not me showing you the βdo not do thisβ corner π the vibe check failed hard here:
function toggle_mouse_grab0()
toggle_mouse_grab(100);
end
mwah π this page is brought to you by iodev, dated October 2026, and starring toggle_mouse_grab(3). slay. π
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms