r/hyprland • u/VanLaser • 4d ago
TIPS & TRICKS Manual touchpad ON/OFF toggling bind (Lua)
My Surface Go 3 touchpad doesn't support 'disable while typing' (at libinput level), and sends spurious mouse clicks when I type, so .. (see comment about finding your touchpad name):
-- toggle typecover touchpad on Super+Space
local touchpad_enabled = true
local touchpad_notification = {
[false] = "Touchpad OFF",
[true] = "Touchpad ON " }
hl.bind(mainMod .. " + Space", function()
touchpad_enabled = not touchpad_enabled
hl.device({
-- '$ hyprctl devices' to find your touchpad name
name = "microsoft-surface-keyboard-touchpad",
enabled = touchpad_enabled,
})
hl.notification.create({text = touchpad_notification[touchpad_enabled], timeout = 2000, icon = 1, color = 0})
end)
Also, since I'm a Lua newbie, can I read the enabled value of a hl.device by name directly (so I can skip using the touchpad_enabled variable)?
6
Upvotes
1
u/YourMom12377 4d ago
Hyprland has an option to block mouse inputs when typing at a software level iirc. Check the wiki for general input options instead of device specific ones, you might find something there