<Solved>How to disable touchpad when plugging in cable mouse

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read how to get help
whois1230
Level 2
Level 2
Posts: 82
Joined: Mon Aug 28, 2017 5:35 am

<Solved>How to disable touchpad when plugging in cable mouse

Postby whois1230 » Tue Dec 05, 2017 6:10 pm

Hi, I know how to disable the touchpad from System settings/Mouse and touchpad, but is there a way to disable it only when a mouse is plugged in? For example I start my laptop and the touchpad is working, then I plug in a cable mouse into the USB port and it starts working, while the touchpad gets disabled, until I plug out the cable USB mouse. After I plug out the USB mouse, the touchpad gets enabled and works again.

Any ideas on how to make this happen?
Last edited by whois1230 on Tue Jan 09, 2018 6:09 pm, edited 1 time in total.

Ascaris
Level 1
Level 1
Posts: 46
Joined: Sun Jun 19, 2016 11:56 pm

Re: How to disable touchpad when plugging in cable mouse

Postby Ascaris » Sat Dec 09, 2017 11:04 am

Inputplug may work for that. It creates a small daemon that listens for input devices being plugged in or unplugged, and it fires a script of your choice when that happens. You'd have to write a script to act on the mouse event (I don't know offhand what would do that), but that will at least get you started. I think it's in the repo.
Main PC: Mint 18 Cinnamon & Windows 8.1/ Asus P8P67 Deluxe/i5-2500k @ 4.7Ghz
Laptop: Mint 18 Cinnamon & Windows 8.1/ Asus F8Sn w/GTX220 & C2D T7800 @ 2.6Ghz

User avatar
Minterator
Level 5
Level 5
Posts: 592
Joined: Thu Jan 10, 2013 8:29 am

Re: How to disable touchpad when plugging in cable mouse

Postby Minterator » Sat Dec 09, 2017 12:29 pm

Follow my post here: https://ubuntuforums.org/showthread.php ... st12562008

with 2 changes:
(1) Replace $USER with your actual user name.
(2) Replace /etc/udev/rules.d/ with /lib/udev/rules.d/ , required for new versions of Mint/Ubuntu


reboot or run sudo /sbin/udevadm trigger
Mint 17.3 MATE, kernel 4.11.12

whois1230
Level 2
Level 2
Posts: 82
Joined: Mon Aug 28, 2017 5:35 am

Re: How to disable touchpad when plugging in cable mouse

Postby whois1230 » Sun Dec 10, 2017 4:27 pm

Minterator wrote:Follow my post here: https://ubuntuforums.org/showthread.php ... st12562008

with 2 changes:
(1) Replace $USER with your actual user name.
(2) Replace /etc/udev/rules.d/ with /lib/udev/rules.d/ , required for new versions of Mint/Ubuntu


reboot or run sudo /sbin/udevadm trigger

https://pastebin.com/raw/Nhw07yFE

User avatar
Minterator
Level 5
Level 5
Posts: 592
Joined: Thu Jan 10, 2013 8:29 am

Re: How to disable touchpad when plugging in cable mouse

Postby Minterator » Mon Dec 11, 2017 9:11 am

All you have to do is create 2 files and reboot. Use your text editor, in this case pluma:

Create file 1, rules file:

gksudo pluma /lib/udev/rules.d/72-touchpad.rules

copy/paste the code exactly as per my post above, except in line 7 replace "$USER" with your actual user name, and save.

Create file 2, startup script:

gksudo pluma /usr/local/sbin/toggle-touchpad.sh

Copy paste from my post above, and save.

make script executable:

sudo chmod +x /usr/local/sbin/toggle-touchpad.sh

You can also do all of the above in your file manager as root.

In startup applications create a new item "toggle-touchpad" with command "/usr/local/sbin/toggle-touchpad.sh"

Reboot.
Mint 17.3 MATE, kernel 4.11.12

whois1230
Level 2
Level 2
Posts: 82
Joined: Mon Aug 28, 2017 5:35 am

Re: How to disable touchpad when plugging in cable mouse

Postby whois1230 » Sun Dec 17, 2017 2:55 pm

Minterator wrote:All you have to do is create 2 files and reboot. Use your text editor, in this case pluma:

Create file 1, rules file:

gksudo pluma /lib/udev/rules.d/72-touchpad.rules

copy/paste the code exactly as per my post above, except in line 7 replace "$USER" with your actual user name, and save.

Create file 2, startup script:

gksudo pluma /usr/local/sbin/toggle-touchpad.sh

Copy paste from my post above, and save.

make script executable:

sudo chmod +x /usr/local/sbin/toggle-touchpad.sh

You can also do all of the above in your file manager as root.

In startup applications create a new item "toggle-touchpad" with command "/usr/local/sbin/toggle-touchpad.sh"

Reboot.

Code: Select all

gksudo user /lib/udev/rules.d/72-touchpad.rules
gksudo user /usr/local/sbin/toggle-touchpad.sh
sudo chmod +x /usr/local/sbin/toggle-touchpad.sh

https://pastebin.com/raw/cUGQu0fW

whois1230
Level 2
Level 2
Posts: 82
Joined: Mon Aug 28, 2017 5:35 am

Re: How to disable touchpad when plugging in cable mouse

Postby whois1230 » Tue Jan 09, 2018 6:08 pm

Hello, I was suggested another solution here: https://www.reddit.com/r/linuxmint/comm ... _in_cable/ which works by disabling/enabling the touchpad with a shortcut key. For anyone interested, read CAcreeks's answer, from the link I provided.


Return to “Hardware Support”