help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best strategy to disable a touchpad on a laptop when in Emacs?


From: Jean Louis
Subject: Re: Best strategy to disable a touchpad on a laptop when in Emacs?
Date: Wed, 31 Mar 2021 13:34:33 +0300
User-agent: Mutt/2.0.6 (2021-03-06)

* Arthur Miller <arthur.miller@live.com> [2021-03-31 13:32]:
> Yuri Khan <yuri.v.khan@gmail.com> writes:
> 
> > On Wed, 31 Mar 2021 at 07:40, Arthur Miller <arthur.miller@live.com> wrote:
> >
> > Problem statement:
> >
> >> I sometimes touch the touchpad accidentally, with a palm and caouse
> >> cursor to jump around or trigger a pop-up.
> >
> > Relevant context:
> >
> >> I can't turn the
> >> touchpad of in the system entirely, it is my wife's and I am just
> >> borrowing it sometimes
> >
> > Proposed approach:
> >
> >> How can I tell Emacs to ignore all touchpad events?
> >
> > …and as far as I can see you got the problem solved that way.
> >
> > However, have a different approach that might be applicable in some
> > circumstances:
> >
> > Connect an external, your own keyboard when using other people’s
> > laptops. This way, you (1) have a comfortable and familiar keyboard,
> > (2) do not approach the touchpad sufficiently to accidentally touch
> > it.
> Yes indeed, but I am away from home and don't wanna carry around a
> keyboard. Disable-mouse-mode, works really fine. The touchpad still
> moves pointer around; would like to turn off pointer motion too, but
> presses are ignored, so it is good enough.


To disable that you could just do:

(define-minor-mode disable-mouse-mode
  "A minor-mode that disables all mouse keybinds."
  :global t
  :lighter " 🐭"
  :keymap (make-sparse-keymap))

(dolist (type '(mouse down-mouse drag-mouse
                      double-mouse triple-mouse))
  (dolist (prefix '("" C- M- S- M-S- C-M- C-S- C-M-S-))
    ;; Yes, I actually HAD to go up to 7 here.
    (dotimes (n 7)
      (let ((k (format "%s%s-%s" prefix type n)))
        (define-key disable-mouse-mode-map
          (vector (intern k)) #'ignore)))))

(disable-mouse-mode 1)

as from:
https://endlessparentheses.com/disable-mouse-only-inside-emacs.html


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns




reply via email to

[Prev in Thread] Current Thread [Next in Thread]