Me comenta Francesc que publique este script, su funcionalidad es desactivar el touchpad de un ordenador portatil cuando detecta que hay un mouse o pulsando la combinación de teclas Alt+t (por desgracia no he podido probarlo, si detectais algún problema comentadlo en los comentarios, valga la redundancia).
#!/bin/bash
#El script MANUAL se encarga de desactivar y activar el touchpad cuando se presiona la combinacion seleccionada
#El script AUTO se encarga de revisar si hay algun raton conectado, y si es asi, desactiva el touchpad
gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_auto-disable true
echo "Generando los scripts"
MANUAL=touchpad-manual
AUTO=touchpad-auto
zenity --question --text="¿Desea activar las notificaciones?\nSe instalara el paquete libnotify-bin\npara lanzar notificaciones a traves de Notify-OSD"
if [ $? = 0 ];then
gksu echo Instalando
sudo apt-get install libnotify-bin
gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_notify true
else
gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_notify false
fi
echo '#!/bin/bash
gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_auto-disable false
#Si el estado actual es activado, lo desactiva, si no, lo activa
if [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_enabled) = true ]; then
gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_enabled false
#synclient TouchpadOff=1
if [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_notify) = true ]; then
notify-send --icon=mouse "Touchpad Deshabilitado"
fi
else
gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_enabled true
#synclient TouchpadOff=0
if [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_notify) = true ]; then
notify-send --icon=mouse "Touchpad Habilitado"
fi
fi' | tee $MANUAL
echo '#! /bin/bash
# Depende de libnotify-bin
notify=0 # Deshabilita la notificacion en el arranque
# Sincroniza synclient con gconf
#if [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_enabled) = true ]; then
# synclient TouchpadOff=0
#elif [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_enabled) = false ]; then
# synclient TouchpadOff=1
#fi
while [ 1 ]
do
if [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_auto-disable) = true ]; then
if [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_enabled) = true ] && [ -e /dev/input/by-id/*event-mouse ]; then # Se enchufa un Ratón
gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_enabled false
#synclient TouchpadOff=1
if [ $notify = 1 ]; then
notify-send --icon=mouse "Touchpad Deshabilitado" "Se ha detectado un Ratón externo"
fi
elif [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_enabled) = false ] && [ ! -e /dev/input/by-id/*event-mouse ]; then # Se desenchufa un Ratón
gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_enabled true
#synclient TouchpadOff=0
if [ $notify = 1 ]; then
notify-send --icon=mouse "Touchpad Habilitado" "Se ha desconectado el Ratón externo"
fi
fi
fi
if [ $(gconftool-2 --get /desktop/gnome/peripherals/touchpad/touchpad_notify) = true ]; then
notify=1
fi
sleep 5 # Periodo de refresco en segundos
done' | tee $AUTO
echo "Instalando los script"
gksu cp $MANUAL /usr/bin/
rm $MANUAL
sudo cp $AUTO /usr/bin/
rm $AUTO
cd /usr/bin/
sudo chmod +rx $MANUAL
sudo chmod +rx $AUTO
echo "Asociando combinacion de teclas Alt+t"
gconftool-2 -t str --set /apps/metacity/global_keybindings/run_command_8 "<Alt>t"
gconftool-2 -t str --set /apps/metacity/keybinding_commands/command_8 "$MANUAL"
echo "Asociando combinacion de teclas Alt+a para el modo automático"
gconftool-2 -t str --set /apps/metacity/global_keybindings/run_command_7 "<Alt>a"
gconftool-2 -t str --set /apps/metacity/keybinding_commands/command_7 "gconftool-2 --type boolean --set /desktop/gnome/peripherals/touchpad/touchpad_auto-disable true"
echo "Creando autoarranque"
cd /usr/share/gnome/autostart/
echo '[Desktop Entry]' | sudo tee $AUTO.desktop
echo 'Type=Application' | sudo tee -a $AUTO.desktop
echo 'Name=AutoDeshabilitar Touchpad' | sudo tee -a $AUTO.desktop
echo "Exec=$AUTO" | sudo tee -a $AUTO.desktop
echo 'Icon=mouse' | sudo tee -a $AUTO.desktop
echo 'Comment=Detecta si exixte un raton, y si es asi, deshabilita el touchpad' | sudo tee -a $AUTO.desktop
echo "Listo"
Funcionamiento:
*Modo automático: se desactiva el touchpad al detectar un ratón externo.
*Modo manual: al pulsar Alt+t se cambia a modo manual, y se activa o desactiva el touchpad (Alt+a para volver a modo automático).
Notas:
Si tienes activado compiz, debes activar el pluguin Comandos
En Karmic es incompatible con Deshabilitar touchpad cuando se escribe
Download | Ubuntu Leon
Comentarios recientes