[HOW] Disable touchpad when connecting USB mouse in Chakra

touchpad

Versatility is one of the virtues, so to speak, that I like the most about GNU / Linux. Everything that ever crossed my mind I got to work on GNU / Linux. Well, that's what versatility is all about, adapting the system to different situations and configurations. There are so many situations that I no longer remember all of them, but I do remember this last one that I will share with you below.

It turns out that days ago I bought a wireless usb mouse to make it easier for me to work with Gimp, since designing with the touchpad, logically, is difficult (however capricious one is: P).

Using the mouse, on some occasions, the contact of the palm of the hand with the touchpad made work difficult. The solution was logical, the touchpad It should be deactivated when connecting the mouse and reactivated once disconnected and that is how in the wiki de Archlinux and a entry in the Forum of Manjaro I found a way to automate this process.

It is worth clarifying that with the kcm-touchpad 0.3.1 installed since CCR It only turns off when you connect the mouse but it won't turn on again after disconnecting it and that's why we will use this method. Let's do it!

Tested on Chakra, Archlinux and Manjaro. May not work on all distros

How to disable the touchpad?

With the mouse connected run:

xinput --list

In my case this output was generated:

⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Microfins 2.4G Wireless Optical Mouse id=10 [slave pointer (2)] ⎜ ↳ HID 04f3:0103 id=12 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad id=14 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)]

Next, we are going to create a script that will carry out the automatic process (it is up to each one to use the text editor and save it in the location they want, here we will use the location of the original post):

sudo nano /usr/local/bin/touchpad

We copy and paste the following:

#! / bin / bash list = `xinput --list | grep -i 'mouse'` if [$ {# list} -eq 0]; then exec `synclient touchpadoff = 0` notify-send" No USB mouse detected "" Touchpad enabled "else exec` synclient touchpadoff = 1` notify-send "USB mouse connected" "Touchpad disabled" fi

We stick with CTRL + SHIFT + V and we keep with CTRL + O

If we do not want the notifications we remove the lines that start with notify-send

If necessary we replace 'mouse' by the device whose name is generated with the first command. If we have a wired USB mouse we do not make any modifications. In my case:

grep -i 'Microfins'

We give you execution permission:

sudo chmod +x /usr/local/bin/touchpad

We create a rule udev so that it executes the script every time we connect or disconnect the USB mouse

sudo nano /etc/udev/rules.d/01-touchpad.rules

We copy and paste the following:

<preSUBSYSTEM==»input», KERNEL==»mouse[0-9]*», ACTION==»add», ENV{DISPLAY}=»:0″, ENV{XAUTHORITY}=»/home/username/. Xauthority», RUN+=»/usr/local/bin/touchpad»
SUBSYSTEM == »input», KERNEL == »mouse [0-9] *», ACTION == »remove», ENV {DISPLAY} = »: 0 ″, ENV {XAUTHORITY} =» / home / username / .Xauthority », RUN + =» / usr / local / bin / touchpad »

We modify username by our user and in case of having saved the script in another location we assign it correctly

We save with CTRL + O

Finally, we must make the script run at each start. In KDE we are going to:

System Preferences> Startup and Shutdown> Autostart> Add Script and we look for the script in / usr / local / bin

It will be enough to restart to be able to enjoy the new configuration

These and other configurations can be found on the Archlinux wiki

5 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   cris said

    The tip is very useful, I hope to do it when I buy the laptop; (

  2.   Phew said

    It is worth clarifying that the

  3.   JW said

    pacman -S kcm-touchpad (in Chakra)
    Install a touchpad configuration module in the system preferences that allows you to easily configure it, including what is explained in the post.

    1.    Phew said

      I do not work with the kcm-touchpad of the CCR or the official repositories. It must be because of the mouse model that I use and that is why I used this method

  4.   Tona said

    Hello, I know that this post is old, and that everything comes in the Wiki I just want to add the change for those who like me come to this post and greetings.
    when adding the udeb rule in /etc/udev/rules.d/01-touchpad.rules is the following

    SUBSYSTEM == »input», KERNEL == »mouse [0-9]«, ACTION ==» add », ENV {DISPLAY} =»: 0 ″, ENV {XAUTHORITY} = »/ home / username / .Xauthority», RUN + = »/ usr / bin / synclient TouchpadOff = 1 ″
    SUBSYSTEM == »input», KERNEL == »mouse [0-9]
    «, ACTION ==» remove », ENV {DISPLAY} =»: 0 ″, ENV {XAUTHORITY} = »/ home / username / .Xauthority», RUN + = »/ usr / bin / synclient TouchpadOff = 0 ″