I have the below elisp code in my emacs config which disables my touchpad, so it won't annoy me when writing.
;; disable touchpad when on emacs
(defun turn-off-mouse (&optional frame)
(interactive)
(call-process-shell-command "xinput --disable bcm5974"
nil "*Shell command output*" t))
(defun turn-on-mouse (&optional frame)
(interactive)
(call-process-shell-command "xinput --enable bcm5974"
nil "*Shell command output*" t))
(add-hook 'focus-in-hook #'turn-off-mouse)
(add-hook 'focus-out-hook #'turn-on-mouse)
(add-hook 'delete-frame-functions #'turn-on-mouse)
(provide 'setup-xinput)
This works fine; the problem is only when quitting Emacs.
If I quit Emacs while on Emacs, it keeps my touchpad disabled. So I need to open a new Terminal with the keyboard, and run xinput --enable bcm5974
.
Is there any workaround for this? How could I quit Emacs and when quitting re-enabling my touchpad?