IGELOSUMS

Touchpad, I love you… I hate you.

When you try to use a Laptop with Igel and you have “Users”, you want to find a way to get the users happy. Because they complain about the touchpad. Yes, they have problems when they are writting and they touch it accidentally.

So, we have different ways to fix this.

  1. You can disable the trackpad using a policy.

But we have a problem here, what happens when the user forgets the external mouse? He can’t use the Touchpad.

Lets’s go to the next way.

2. You can use a script which detects if a usb mouse is plugged and then disables the Touchpad. If a user whants to use the touchpad again, he has 2 options:

1) An icon in his desktop called Touchpad

2) Hotkeys to enable or disable when they need.

To make this possible, we need 2 files:

  • touchpad.sh
  • mouse.png

Let’s see the touchpad.sh content.

# Enables the touchpad if and only if there aren't any external mice connected.
#
#Here you have to know the touchpad model

TOUCHPAD="ETPS/2 Elantech Touchpad"
TOUCHPAD2="SynPS/2 Synaptics TouchPad"
TOUCHPAD3="PS/2 Generic Mouse"
FOUND=0

 
  for MOUSE in `find /sys/class/input -name mouse\*`
  do
  
  cat $MOUSE/device/name | grep -v "$TOUCHPAD" | grep -v "$TOUCHPAD2" | grep -v "$TOUCHPAD3" > /dev/null
  result=`echo $?` 
      if [ $result -eq 0 ] 
          then
          #echo "Found"
  	        FOUND=1
#Find a Mouse device other than the TouchPad and record the variable.
  		  break
  		fi
  done
 
 DISPLAY=:0
 export DISPLAY
 
 
 TOUCHPADDEVICE=$(($(xinput list | grep -i touchpad | cut -d= -f2 | cut -d[ -f1)+0))
 
 #Find the Touchpad Id
     if [ $FOUND != 0 ]; then
     #If another device is founded, disable touchpad
                 #echo "Disable"
             xinput disable $TOUCHPADDEVICE
      else
 	  #else enable touchpad
                 #echo "Enable"
 	          xinput enable $TOUCHPADDEVICE
 		fi

To configure the script properly, you need to know your touchpad id in your organization. We have several laptops, so we use 3.

To find your Touchpad model, just open a Terminal session in your laptop (not SSH), and type:

xinput list

This name is what you have to insert in the script variable called TOUCHPAD.

Now, we upload the 2 files to the UMS as you want, in my example is /wfs/icon/mouse.png and /wfs/bin/mouse.sh

This path is totally personal, you can use your own path.

After uploading the 2 files, don’t forget to assign them where you want to use them.

Now, you have to create a new profile:

Create a new custom app.

Don’t forget to check :

  • Session Name
  • Starting method Session (DESKTOP)
  • Hotkey (I use Ctrl+Alt+R)
  • Autostart (Very important, if we want to disable or enable at boot)

Finally, the path to the 2 files.

Just save the policy and apply it!

Comments (2)

  1. Hi Daniel, Thanks for the script, However when I execute touchpad.sh it gives a syntax error in expression. Would you mind helping us.

    ./touchpadtest.sh: line 29: 11
    9
    10
    8
    12 +0: syntax error in expression (error token is “9
    10
    8
    12 +0”)

    • Hi, it seems there is something wrong with the line 29, maybe when you copy and pasted it some of the code is missing.

      To troubleshooting it, you can open a terminal from Igel device, cat touchpad.sh and try to copy and paste the line with the error.

      This shouls work from the command line:
      xinput list | grep -i touchpad | cut -d= -f2 | cut -d[ -f1

Comment here