Garry's Mod

Garry's Mod

302 ratings
Toggle Mouse Cursor
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build
File Size
Posted
Updated
9.373 KB
8 Sep, 2024 @ 12:21am
8 Mar @ 8:52am
5 Change Notes ( view )

Subscribe to download
Toggle Mouse Cursor

Description
This utility addon adds a console command which unlocks the mouse cursor on toggle for context-menu-like behavior. This frees a finger from having to hold down the context menu button to enable similar behavior.

To use it, simply bind the command tmc_togglemousecursor to some key.
For example, bind b tmc_togglemousecursor.

Executing the command may show a notification and play a sound when toggling the mouse cursor. To disable it, set tmc_notifications 0.

You can block the context options from showing up when right-clicking on an entity by setting tmc_blockentitymenu 1. This is disabled by default, meaning that right-clicking on any entity will always open the context options. The entity context options will always show up if the context menu is open (by pressing 'C'), regardless if the entity menu is blocked.

Note
This addon overrides the following functions: gui.EnableScreenClicker()[wiki.facepunch.com] to preserve the locked/unlocked cursor state, and properties.OpenEntityMenu[wiki.facepunch.com] to block context options when tmc_blockentitymenu 1.

Customization
To replace text, navigate to "data/tmc/notification.json" in your GMod local filesystem. notification.json has the following contents:
{ "locked": "Cursor Locked", "unlocked": "Cursor unlocked" }
If you do not see notification.json, or the path "tmc/notification.json" in the GMod data folder, you can create your own file and copy and paste the above contents.
Replace the "locked" and "unlocked" text with your own!

To replace sound, you must have an mp3 file named "notification" located in the "sound/tmc" directory in some addon folder in addons or in the GMod local filesystem. For example, the following are valid
addons/my-sound-replacement/sound/tmc/notification.mp3 <-- In the local addons sound/tmc/notification.mp3 <-- In the GMod local file system


Source Code
https://github.com/vlazed/toggle-cursor
38 Comments
Jaxxon51 24 Jan @ 10:25pm 
just hold C
Internal 23 Dec, 2024 @ 12:43am 
Is there a way where I can hold down a button to use the unlocked cursor like how the Context menu cursor is like?
Graceful Jabberwocky 26 Oct, 2024 @ 1:52pm 
freakleiner
KAROX 25 Oct, 2024 @ 11:00am 
what the fuck is that thumbnail gif bruh new level of being creative
TheSecond 24 Oct, 2024 @ 4:19am 
this shaders dawgg, can i know what was you using?
blue master 21 Oct, 2024 @ 11:19pm 
NOW I CAN MAKE "it start with one thing, i don't know why"
Male_09 21 Oct, 2024 @ 6:40pm 
@dsans
LETHAL skill issue
Absolute Lambda 21 Oct, 2024 @ 8:56am 
Finally i can Goldeneye free-aim without opening the context menu
AdiVitto2k3 21 Oct, 2024 @ 7:24am 
C
Adam 󠀡 6: 21 Oct, 2024 @ 3:33am 
AWsome