You are not logged in.

#1 2016-09-30 22:16

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Disable touchpad when using usb mouse

How many times do you end up having to write something twice because you nudged the touch-pad on the laptop while typing a long post (or doing some real work!) and the last few sentences / paragraphs are not there when you look up!! Well maybe it's only me it happens to but I decided to write a udev rule to disable my touch-pad when I have my usb mouse plugged in to prevent this happening.
This was quite a simple task but involved using the command line and having three or four terminals open monitoring syslog, udev monitor, one for man pages and one to work in, I thought that many users would think "it's too much hassle and I'll have to be more careful" but I thought what if I make a script to automate the process and set it up for any user, that way I could re-install it easily when i re-install (happens from time to time roll ).
Well here is the script for anyone who wants to do as I have and effectively switch off the touch-pad when the mouse is plugged in.
Just Download the script, make sure it is executable

 chmod +x dais_auto_toggle_script.sh

And then run it from a terminal

./dais_auto_toggle_script.sh

If you have any issues or it doesn't work for you please let me know and I will tell you how to get it working.

This script places a rule in /etc/udev/rules.d and a script in /usr/local/bin which is all that is required to set this up, if you run the script and then decide you want to remove the changes it has made just run the script again and it will detect that the files already exist and give you the choice to remove it. I hope it is quite straight forward to use, but any issues just shout and I'll try and help.


Attachments:
sh dais_auto_toggle_script.sh, Size: 4.07 KiB, Downloads: 1,193

Offline

#2 2017-03-05 16:07

mc1611
Member
Registered: 2017-02-05
Posts: 12

Re: Disable touchpad when using usb mouse

tryed to run script and got this error.
root@mikespc:/# ./dais_auto_toggle_script.sh
./dais_auto_toggle_script.sh: line 31: kdialog: command not found
./dais_auto_toggle_script.sh: line 35: kdialog: command not found
root@mikespc:/#             
thanks for any help.

Offline

#3 2017-03-05 21:24

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: Disable touchpad when using usb mouse

You will need to install kdialog, although it is usually installed I think... Are you using 32 bit or 64 bit, or pi?

Offline

#4 2017-03-05 22:05

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,223
Website

Re: Disable touchpad when using usb mouse

If you run 'kdialog' as root, you need to run it with full path:
# /opt/trinity/bin/kdialog

Offline

#5 2017-03-05 22:53

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: Disable touchpad when using usb mouse

My script doesn't run as root, and I just tested it on my system and it runs fine... I'm wondering if mc1611 is running q4os... or maybe running on a pi. Is kdialog installed on pi (by default)?

EDIT:
Just noticed mc1611 is using root user, that explains it. Just run the script as normal user or alter the script command like Q4OS team suggested.

Last edited by Dai_trying (2017-03-05 22:55)

Offline

#6 2017-11-29 16:47

JimW
Member
Registered: 2015-12-08
Posts: 400

Re: Disable touchpad when using usb mouse

Dia
Does this script still work on Scorpion? I just tried it on my Dell laptop with Q4OS and it does not seem to. It runs but gives an error.

Offline

#7 2017-11-29 16:55

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: Disable touchpad when using usb mouse

It should run ok with Scorpion as I was using that when I originally wrote it, what error message are you getting?

EDIT: Just tested on my Dell Inspiron 15 and it works as expected

Last edited by Dai_trying (2017-11-29 16:59)

Offline

#8 2017-11-29 17:05

JimW
Member
Registered: 2015-12-08
Posts: 400

Re: Disable touchpad when using usb mouse

Environment not found
Did you insert a USB mouse?
Please re-run the script.

I am using a USB wireless mouse. And have ran the script with it unplugged and plugged in and working.

Offline

#9 2017-11-29 17:11

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: Disable touchpad when using usb mouse

Ok, that usually means it cannot see the device you inserted, could you post the output of xinput the script might need a little tweak to detect your mouse.

Offline

#10 2017-11-29 17:17

JimW
Member
Registered: 2015-12-08
Posts: 400

Re: Disable touchpad when using usb mouse

attached


Attachments:
txt output.txt, Size: 1.04 KiB, Downloads: 947

Offline

#11 2017-11-29 17:40

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: Disable touchpad when using usb mouse

I can't see a reason for it not to run... Just to make sure it isn't working could you try once more:-

1. Unplug usb mouse
2. wait few seconds (Just to make sure udev has disconnected the mouse)
3. run my script from terminal
4 follow instructions and let me know what it says

Offline

#12 2017-11-29 17:58

JimW
Member
Registered: 2015-12-08
Posts: 400

Re: Disable touchpad when using usb mouse

That seems to have worked - Thanks!!!!!

Offline

#13 2017-11-29 18:00

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: Disable touchpad when using usb mouse

You are welcome, I would guess that the script might have been run while the mouse was plugged in, but all's well that ends well. smile

Offline

Board footer

Powered by FluxBB