LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to enable/disable the touchpad when connecting an external mouse?
#1
Hi there everybody!
I'm trying to do something so mi laptop disables the TouchPad when I connect the external Mouse and enables it again when I disconnect the mouse. So far I got the bash script for each action.
Searching the web I discovered that with udev I can do that. But so far it doesn't work. So I come here for some help.
NOTE:
I have to say that I had to change systemd with upstart and lightDM with SDDM in order to make Linux Lite work in my computer (with Ubuntu, my computer only works with Kubuntu and upstart). Unfortunately I'm not that an advance user to explain this, but it just works this way.
Ok, now that everything is explained here comes the things I've done:

First I create the scripts to disable the touchpad
Code:
#!/bin/sh
# Get the id number of the touchpad.
tp_id=`xinput list | grep -i touchpad | awk '{ print $6 }' | sed 's/id=//'`
xinput disable $tp_id

and the script to enable it
Code:
#!/bin/sh
# Get the id number of the touchpad.
tp_id=`xinput list | grep -i touchpad | awk '{ print $6 }' | sed 's/id=//'`
xinput enable $tp_id

I made the rule in /etc/udev/rules.d/10-personal.rules:

  [Image: y8l1eWjl.png]

* Sorry to place an image. For some reason if I write the text here the forum doesn't let me make the post.

I restarted my computer but when I connect/disconnect the external mouse the udev rules don't work. The system recognize the mouse and it works ok. But it appears that the udev rules are not "charged".
What I am doing wrong?
Reply
#2
What happens when you adjust the Mouse and Touchpad settings (Menu, Settings, Mouse and Touchpad)?
Want to thank me?  Click my [Thank] link.
Reply
#3
(04-11-2017, 04:59 PM)torreydale link Wrote: What happens when you adjust the Mouse and Touchpad settings (Menu, Settings, Mouse and Touchpad)?

Everything works as it's supposed to when I change the settings in the Mouse and the Touchpad via "Mouse and Touchpad setting".
Reply
#4
Ok.  If this is a solved issue, please mark it as such.  For your convenience, the forum posting guidelines are here:
https://www.freecinema2022.gq/forums/intro...uidelines/
Want to thank me?  Click my [Thank] link.
Reply
#5
(04-11-2017, 05:29 PM)torreydale link Wrote: Ok.  If this is a solved issue, please mark it as such.  For your convenience, the forum posting guidelines are here:
https://www.freecinema2022.gq/forums/intro...uidelines/

Maybe I didn't explain myself correctly:
The "Mouse and Touchpad" setting GUI works fine, but there's no option to disable de touchpad when an external mouse is connected to the computer.
I'm looking for some kind of daemon to "hear" when the external mouse is connected and then disables the touchpad and vice versa. So far the only thing I can do is a hotkey that toggles the state of the touchpad. But I'm looking for the system to do it automatically.

For anyone who's looking the script to toggles the Synaptic touchpad here is the code:
Code:
#!/bin/sh
#
# tp_toggle
#
# Toggle the touchpad on/off.


# Get the id number of the touchpad.
tp_id=`xinput list | grep -i touchpad | awk '{ print $6 }' | sed 's/id=//'`


# Find out whether the touchpad is enabled or not.
tp_enabled=`xinput list-props $tp_id | grep Device\ Enabled | awk '{ print $4 }'`


if [ $tp_enabled = 0 ]
then
  # The touchpad is currently disabled, so turn it on.
  xinput set-prop $tp_id "Device Enabled" 1
  notify-send "TouchPad Active" "To deactivate press Super+M"

elif [ $tp_enabled = 1 ]
then
  # The touchpad is currently enabled, so turn it off.
  xinput set-prop $tp_id "Device Enabled" 0
  notify-send "TouchPad Deactivated" "To activate press Super+M"
else
  notify-send "TouchPad Toggle" "There's a problem."
  exit 1
fi
I got this from http://askubuntu.com/questions/438179/ho...-connected with some minor changes from my side.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)