While typing, every time I hit the trackpad in just the wrong way, my cursor jumps from one point to another in my emacs buffer. This is the scroll motion that occurs as a result of two fingers on the track-pad, but while typing, sometimes the root of my thumb triggers that scrolling action. I don't need that in emacs. How can I turn it off?

3 Answers 3


You can try disabling the mouse completely in Emacs only, using package disable-mouse: https://github.com/purcell/disable-mouse

  • Thanks for the link. Trying it myself now. I think this is likely the best answer to @diagon 's question. Commented Jul 29, 2022 at 6:56
  • I tried disable-mouse, but it didn't work: install from MELPA, then (require 'disable-mouse) (global-disable-mouse-mode). Two finger scrolling of the cursor is still happening in my temrinal window (?) I also tried handoff with similar results.
    – Diagon
    Commented Aug 5, 2022 at 11:21
  • 1
    @Diagon assuming you are saying that you also see scrolling in Emacs, then you may have found a bug in disable-mouse. Start Emacs with emacs -Q and if you get the same result then you should report it to the author. (Of course, you would not expect an Emacs mode to prevent scrolling in a different app such as your terminal emulator; global here means global within Emacs regardless of major mode.) Commented Aug 9, 2022 at 14:16

I had this, and it drove me nuts. You may have found references to settings you can try, for example, with synaptics (if you have a synaptics touchpad) to suppress brushes with the palm of the hand that move the cursor. I have to say none of these have ever worked for me fully satisfactorily.

Edit One quick way to do this in Emacs itself would be to add (global-unset-key [mouse-1]) in your config. This will unbind the default command mouse-set-point. Emacs will complain about an undefined command if you accidentally tap, but your cursor should stop jumping about. You may find you need to unbind other mouse gestures or mode-specific bindings.

Original answer I am more satisfied by simply manually turning the trackpad completely off in Emacs, since I'm usually in Emacs for a while. I then bind this to a global Ubuntu shortcut to toggle the trackpad on and off.

This can be done using xinput (M-x woman xinput). It needs to be called several times:

  1. to identify the touchpad's id
  2. to detect whether the touchpad is enabled (list-props)
  3. to toggle it off or on (set-prop)

You can do this your scripting language of choice. Here's my fairly verbose ruby toggletouch script, which lives in .local/bin.

#!/usr/bin/env ruby

# Just a little script to toggle the touchpad completely on or off.
touchpad = `xinput`.lines.grep(/touchpad/i).first

unless touchpad && touchpad =~ /id=(\d+)/
  raise "Can't identify touchpad input"

tp_id = $1

status = `xinput list-props #{tp_id}`.lines.grep(/Enabled/).first

unless status && status =~ /([01])\s*$/
  raise "Can't identify status"

stat = $1

if stat == "1"
  `xinput set-prop #{tp_id} "Device Enabled" 0`
  `xinput set-prop #{tp_id} "Device Enabled" 1`

Bind this to a spare key with Ubuntu's Keyboard Shortcuts. You can also look into unclutter, which can be installed using apt, which provides ways to hide the mouse cursor when it's inactive.

  • 1
    Thanks for the response, both you and @phils, but ... Maybe I'm not understanding. Emacs is interpreting the mouse input, right? And then performing the action? Shouldn't I be able to turn it off just in emacs? Or am I off base?
    – Diagon
    Commented Jul 25, 2022 at 11:37
  • 1
    Not at all off base. You could do (global-unset-key [mouse-1]) which will unbind the command mouse-set-point from a single touchpad tap. That (and possibly unbinding other unwanted mouse gestures, use C-h k and C-h l to see what input is coming from the trackpad) should stop the unwanted commands. Emacs will still complain about receiving input for an undefined "key" press. If you find some clever solution, post it, would be interested. Commented Jul 25, 2022 at 16:23

FWIW I use the following:

# See `man synaptics' for details of option "TouchpadOff".
# 0   Touchpad is enabled
# 1   Touchpad is switched off (physical clicks still work)
# 2   Only tapping and scrolling is switched off
synclient TouchpadOff=2

My touchpad has physical buttons, so there's absolutely no need for it to also interpret other things as button clicks; and similarly I have perfectly satisfactory ways of scrolling that can't happen by accident. The touchpad is useful for moving the mouse cursor around, though (if I don't have a mouse plugged in), so I keep that part enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.