toggle_mouse_grab(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

✨ 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 πŸŽ€

  1. 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