05-04-26
Mouse Sensitivity Switcher with UI
This Lua script for Rebind hardware input allows you to easily switch between mouse sensitivity presets using a keybind and a UI slider. Customize your sensitivity on the fly with this useful script.
rebindlua scriptsensitivitymouseuisliderinput
Question
Sensitivity switcher with UI slider
Rebind AI
Sensitivity Switcher
luau
-- rebind: name=Sensitivity Switcher
local cfg = UI.Schema({
enabled = UI.Toggle(true, { label = "Enable" }),
sensitivity = UI.Slider(1.0, {
min = 0.1,
max = 3.0,
step = 0.1,
suffix = "x",
label = "Mouse Sensitivity",
tooltip = "Multiply mouse movement by this factor",
}),
toggle_key = UI.Keybind("F6", {
label = "Quick Toggle",
tooltip = "Press to switch between normal and custom sensitivity",
}),
})
local normalSens = 1.0
local customSens = 2.0
local isCustom = false
function OnMove(dx, dy)
if not cfg.enabled then
return true
end
local factor = cfg.sensitivity
HID.Move(dx * factor, dy * factor)
return false
end
Bind(cfg.toggle_key, function()
isCustom = not isCustom
local current = isCustom and customSens or normalSens
cfg.sensitivity = current
UI.Notify(
string.format("Sensitivity: %.1fx", current),
"info"
)
return false
end)
function OnStart()
Log.Info("Sensitivity multiplier active")
endHow it works
This script multiplies all mouse movement by a configurable factor:
- UI Slider — lets you adjust sensitivity from 0.1x to 3.0x without touching code
- OnMove hook — intercepts every mouse movement, scales it by the sensitivity multiplier, and returns
falseto block the original movement - Toggle Key — press F6 to quickly switch between two presets (normal and custom)
- Modeline notes — no process targeting needed, so it's always active
The script blocks mouse input (return false) and sends the scaled version via HID.Move(), so your PC never sees the original unscaled movement.
Customization
- Adjust
min,max, andstepin the slider options to change the range - Edit
normalSensandcustomSensto set what the toggle button switches between - Bind the toggle key to any other hotkey (e.g.,
"Mouse4"or"RAlt+M")
Learn more: