all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to switch off the touchpad when Emacs window is active under Linux?
@ 2015-08-24 19:02 AW
  2015-08-24 19:14 ` Ian Zimmerman
       [not found] ` <mailman.28.1440443703.28410.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: AW @ 2015-08-24 19:02 UTC (permalink / raw
  To: help-gnu-emacs

Hi,

I've got one of those notebooks with a laaaaarge touchpad. I'd like to get it 
switched off when the emacs window under linux is active. I often hit the 
touchpad accidently while typing and move the cursor to another place in the 
buffer. I would like to avoid this.

Somebody (thanks, Bob) showed me this page:

https://www.reddit.com/r/emacs/comments/38o0tr/i_have_to_share_this_switch_your_touchpad_off/

Synclient on this notebook works, but this function doesn't:

======================0

(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)

=======================

Any suggestions welcome, I'm using openSuse Tumbleweed.


Regards,

Alexander



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to switch off the touchpad when Emacs window is active under Linux?
  2015-08-24 19:02 How to switch off the touchpad when Emacs window is active under Linux? AW
@ 2015-08-24 19:14 ` Ian Zimmerman
  2015-08-24 19:51   ` AW
       [not found] ` <mailman.28.1440443703.28410.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Ian Zimmerman @ 2015-08-24 19:14 UTC (permalink / raw
  To: help-gnu-emacs

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.

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to switch off the touchpad when Emacs window is active under Linux?
       [not found] ` <mailman.28.1440443703.28410.help-gnu-emacs@gnu.org>
@ 2015-08-24 19:37   ` Pascal J. Bourguignon
  0 siblings, 0 replies; 4+ messages in thread
From: Pascal J. Bourguignon @ 2015-08-24 19:37 UTC (permalink / raw
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to switch off the touchpad when Emacs window is active under Linux?
  2015-08-24 19:14 ` Ian Zimmerman
@ 2015-08-24 19:51   ` AW
  0 siblings, 0 replies; 4+ messages in thread
From: AW @ 2015-08-24 19:51 UTC (permalink / raw
  To: help-gnu-emacs

Am Montag, 24. August 2015, 12:14:51 schrieb Ian Zimmerman:
> 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.

Trouble is, I don't speak Lisp. I'm just a user who gets lots of typos because 
of a touchpad which is too large. I found this code and more, tested it, but 
without any success....



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-24 19:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24 19:02 How to switch off the touchpad when Emacs window is active under Linux? AW
2015-08-24 19:14 ` Ian Zimmerman
2015-08-24 19:51   ` AW
     [not found] ` <mailman.28.1440443703.28410.help-gnu-emacs@gnu.org>
2015-08-24 19:37   ` Pascal J. Bourguignon

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.