i never use my touchpad except for when i don't have my USB mouse connected. so it would make sense to have it disabled when i do.
i've read on the Arch-wiki that you can do this through udev, but i'm not quite confident enough to try that out yet, and then i stumbled across this simple solution, which i really like, because it is so simple. in fact, it is a bit of a hack, but it works.
this is for synaptics touchpads only, as the synclient is the synaptics touchpad driver. however, the concept stays the same for any other touchpad i guess.
make a bash-script somewhere (some place where you have your bash scripts). i called it 'touchoff.bash'.
Gedit opens to an empty file. copy-paste in this code:
#!/bin/bash # thank you: http://www.linuxquestions.org/questions/debian-26/shmconfig-in-debian-645503/#post3838794 # script to turn off touchpad if mouse present at login # synclient is the synaptic utility to manage the touchpad # grep the "lsusb" output and do a wordcount on number of lines with "Logitech" which should = 1 if a Logitech mouse is present # # Obviously the "Logitech" should be replaced with your brand of mouse, and perhaps be more exact in case you have other USB devices that have similar names /usr/bin/synclient touchpadoff=`lsusb | grep Logitech | wc -l`
chmod +x touchoff.bash
this makes it executable.
now, if you want to try how this works in the terminal (for better understanding, and to test if it actually works), type this:
this should disable the touchpad (try it!) to enable it again, type:
so now you have your own script for switching the touchpad on and off when a USB mouse is present. however, this is not nearly good enough. we want this stuff to happen automatically on start-up! so, let's add it to the Openbox autostart.sh file.
right-click somewhere to bring up the Openbox menu. go: Settings > Openbox Config > Edit autostart.sh
in the file, move somewhere to the bottom, so all the other stuff is loaded already before executing this command. now add the link to your script. for me, this is:
for you it might be a different directory, so mind that stuff. also, do not forget the &. if you want to know why, read the autostart.sh documentation, google it.
try it out! logout, log back in, and see if it works!
^ i hate... hey, i hate a lot of things! anyway, i didn't really like it when i was very very new to linux that there were people explaining things halfway. so stuff like 'put that in your config file'... and me: 'where the hell is the file?'... have to do a separate google to find that out, while he could've been more specific. explain stuff, we are all newbies damnit!
so, you know that one song by Michael Jackson, that goes: "if you wanna make the world a better place, take a look at yourself and make that, CHAAAAAAAANGE!"... so that's why!
Last edited by rhowaldt (2011-11-09 19:40:22)
lol... That is the ONLY song by MJ I ever liked and own
I use the same philosophy in all of my How To's as well
If you build it, they will come...
Words That Build Or Destroy
Very nice, very nice, thanks Ro!
I additionally have 'ton.sh' and 'toff.sh' scripts which are simply synclient touchpadoff=0/1 called by keyboard shortcuts. There is also syndaemon to disable touchpad when typing...
100 Euro Question: How to disable mouse when touchpad is connected? (kidding)
Thank you rhowaldt!
i see a lot of stuff around on turning off your touch pad but no-one says why? I dont use my touch pad but what advantage is there in turning it off - is it using a lot of resources or something?
Troll = not a fanatic
Techniques to Disable Touchpad – Why would you want to?
Want to know how to Disable the Touchpad on your laptop? There are many reasons to want to turn off or disable touchpads. I know it frustrates me greatly when the bottom of my palms brush the touchpad. The character I was typing suddenly quits appearing, and the random mouse and keyboard effects that happen next cause me no end of grief. Occasionally, I will run across a touchpad that is malfunctioning and is causing random effects without being touched, and there is good reason to want to disable it for this as well.
(from http://disabletouchpad.net/; the "techniques" are for Windows)
Last edited by pidsley (2012-05-25 17:40:10)
^ exactly that. i touch my touchpad with the bottom of my hands when i type, my mouse moves around, it is annoying. plus, i never use it. so anything i never use AND is annoying at the same thing, i turn off
Yeah, this doesn't work for me. I'm 100% I did everything correct. I went over everything a lot of times. It doesn't work.
The scrip works. If I click it. So clearly, lsusb works, the script works, the touchpad gets disabled if I have my mouse in and it doesn't if I don't.
The problem is that it's not automatic. I tried relog, restart, nada.
If I un-plug and plug my mouse again the touchpad stays on.
If I start #! with my mouse plugged in the touchpad stays on.
Whatever I do, the touchpad only turns off if two conditions are met
1) I click the script
2) The mouse is plugged in
Both in the same time.
The autostart is set fine. I've put the touchoff.bash in /home/astoria/documents/touchoff.bash &
^ It's not meant to be automatic, it's meant to run once on log in.
If you want things to be automatic, e.g. when you (un)plug your mice, you need to go with udev rules: https://wiki.archlinux.org/index.php/To … _detection