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

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

Re: How to switch off the touchpad when Emacs window is active under Lin


From: Pascal J. Bourguignon
Subject: Re: How to switch off the touchpad when Emacs window is active under Linux?
Date: Mon, 24 Aug 2015 21:37:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Ian Zimmerman <itz@buug.org> writes:

> On 2015-08-24 21:02 +0200, AW wrote:
>
>> Synclient on this notebook works, but this function doesn't:
>
>> (defun turn-off-mouse (&optional frame)
>>   (interactive)
>>   (let ((inhibit-message t) (default-directory "~"))
>>     (shell-command "synclient TouchpadOff=1")))
>> 
>> (defun turn-on-mouse (&optional frame)
>>   (interactive)
>>   (let ((inhibit-message t) (default-directory "~"))
>>     (shell-command "synclient TouchpadOff=0")))
>> 
>> (add-hook 'focus-in-hook #'turn-off-mouse)
>> (add-hook 'focus-out-hook #'turn-on-mouse)
>> (add-hook 'delete-frame-functions #'turn-on-mouse)
>
> The variable inhibit-message doesn't exist in my emacs (probably a
> recent addition), but I'm guessing that it discards any output from the
> subprocess.  I would leave it out so you see what prevents synclient
> from working.
>
> Also, I don't see why changing default-directory should be necessary,
> either.

Alternatively, you could disable the mouse by  binding all the mouse
events to null commands.  For example, I have this in my ~/.emacs; you
could extend it to all mouse buttons:

(defun ignore () (interactive))
(loop for key in (list (kbd "<mouse-5>") (kbd "C-<mouse-5>") (kbd "S-<mouse-5>")
                       (kbd "<mouse-4>") (kbd "C-<mouse-4>") (kbd 
"S-<mouse-4>"))
     do (global-set-key key 'ignore))

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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