Results 1 to 3 of 3

Thread: Touchpad enable / disable script for laptop

  1. #1
    Join Date
    Apr 2009
    Location
    Spain
    Beans
    499
    Distro
    Lubuntu

    Touchpad enable / disable script for laptop

    Hi,

    I have a script that lets me disable and re-enable my laptop touchpad.

    This is the script:

    Code:
    #!/bin/sh
    if xinput list-props 13 | grep "Device Enabled (143):.*1" >/dev/null
    then
      xinput disable 13 
      notify-send -u low -i mouse "Touchpad disabled"
    else
      xinput enable 13
      notify-send -u low -i mouse "Touchpad enabled"
    fi
    I have saved the text file as "tt.sh" in /usr/bin.

    Thus, entering "tt.sh" in the command line I can toggle between touchpad enabled / disabled.

    Trouble is, I use my laptop in different places with different mice. Someimes my touchpad ID is listed as "12" and sometimes as "13". So the script doesn't always work unless I change it, which is cumbersome and somehow defeats the point.

    Is there a way round this?

    Many thanks.

  2. #2
    Join Date
    Dec 2014
    Beans
    1,606

    Re: Touchpad enable / disable script for laptop

    Sure, use the Name instead of the ID.
    On my system xinput --list gives me:
    Code:
    ...
    ⎜   ↳ ETPS/2 Elantech Touchpad                    id=13    [slave  pointer  (2)]
    ...
    so to switch it off, I'd do
    Code:
    xinput disable "ETPS/2 Elantech Touchpad"

    Holger

  3. #3
    Join Date
    Apr 2009
    Location
    Spain
    Beans
    499
    Distro
    Lubuntu

    Re: Touchpad enable / disable script for laptop

    Thank you!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •