Ubuntu9.04 use an external mouse to automatically close the touchpad

Source: Internet
Author: User
When I use a notebook in Ubuntu9.04, I usually like to use it instead of a touchpad, but there is no external mouse or functional limitations. You can only use the touchpad. Over time, the habit is to turn off the touchpad when the notebook is connected to an external mouse, and enable the touchpad when pulling out the external mouse. In this way, I am much more worried (this is a lazy one). The following is a solution. Although it is not perfect before the model, we will try again and then improve it later. Open the terminal and go back to your home directory $ cd ~ Create a directory named Bin $ mkdirBin

When I use a notebook in Ubuntu 9.04, I usually like to use it instead of a touchpad, but there is no external mouse or functional limitations. You can only use the touchpad. Over time, the habit is to turn off the touchpad when the notebook is connected to an external mouse, and enable the touchpad when pulling out the external mouse. In this way, I am much more worried (this is a lazy one). The following is a solution. Although it is not perfect before the model, we will try again and then improve it later.

Open the terminal and go back to your home directory

$ Cd ~

Create a directory named Bin

$ Mkdir Bin

Enter the Bin directory

$ Cd Bin

Create File touchpad. sh

$ Touch touchpad. sh

Edit the file touchpad. sh

$ Gedit touchpad. sh

Paste the following information

#! /Bin/sh

# Touchpad. sh Set the touchpad enabled to on or off.

#

# Version: @ (#) touchpad. sh 0.03 badsol125@gmail.com

Touchpad_on (){

/Usr/bin/gconftool -- set -- type bool/desktop/gnome/peripherals/mouse/touchpad_enabled true

If test $? -Eq 0; then

Echo 'enabled successfully'

Else

Echo 'enabling failed'

Fi

}

Touchpad_off (){

/Usr/bin/gconftool -- set -- type bool/desktop/gnome/peripherals/mouse/touchpad_enabled false

If test $? -Eq 0; then

Echo 'Disabled successfully'

Else

Echo 'disabling failed'

Fi

}

Case "$1" in

On)

Touchpad_on

;;

Off)

Touchpad_off

;;

*)

If '/usr/bin/gconftool -- get/desktop/gnome/peripherals/mouse/touchpad_enabled'; then

Touchpad_off

Else

Touchpad_on

Fi

;;

Esac

Exit 0

Save and grant the executable permission.

$ Chmod 755 touchpad. sh

Set shortcuts

Main Menu-> system-> preferences-> keyboard shortcut-> Add

Name (N): synaptic (on/off)

Command (O):/home/yourname/Bin/touchpad. sh

Note: yourname in the command is your login user name

Then, you can use the keyboard to control the touch pad switch.

Wait, isn't this done? What else can I do if I use an external mouse to automatically close the touchpad?

To complete this function, we need to install a software. For now, there may be better solutions in the future.

$ Aptitude install gnome-volume-manager-y

After the installation is complete, you can find the main menu-> system-> preference-> removable drive and media-> Input Device

Add/home/yourname/Bin/touchpad. sh off to the program that runs automatically during USB connection.

After you insert a USB mouse, the touchpad is automatically disabled. However, I didn't expect how to handle it after pulling out the USB mouse. So use the hotkey temporarily.

 

From: http://badsol.yo2.cn/go/24622.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.