Difference between revisions of "Talk:UltraNav"

From ThinkWiki
Jump to: navigation, search
(Script for switching state of TouchPad and TrackPoint: new section)
Line 19: Line 19:
 
You will need to reboot (actually restart both X11 and HAL, but reboot is easier at that point) before it takes effect.
 
You will need to reboot (actually restart both X11 and HAL, but reboot is easier at that point) before it takes effect.
 
--[[User:Tonko|Tonko]] 00:18, 14 February 2009 (UTC)
 
--[[User:Tonko|Tonko]] 00:18, 14 February 2009 (UTC)
 +
 +
== Script for switching state of TouchPad and TrackPoint ==
 +
 +
{{HINT|A suggestion.}}
 +
{{key|Fn}}{{key|F8}} can run {{cmduser|untranav.sh toggle}}
 +
 +
untranav.sh
 +
<pre>
 +
#!/bin/bash
 +
TRACKPOINT_NAME="trackpoint"
 +
TRACKPOINT='TPPS/2 IBM TrackPoint'
 +
TOUCHPAD_NAME="touchpad"
 +
TOUCHPAD='SynPS/2 Synaptics TouchPad'
 +
 +
Usage()
 +
{
 +
    echo "usage: ${0/*\/} status [device]"
 +
    echo "      ${0/*\/} enable [device]"
 +
    echo "      ${0/*\/} disable [device]"
 +
    echo "      ${0/*\/} toggle [device]"
 +
    echo "device: $TRACKPOINT_NAME"
 +
    echo "        $TOUCHPAD_NAME"
 +
    echo "toggle order: 1) $TRACKPOINT_NAME enable"
 +
    echo "                $TOUCHPAD_NAME disable"
 +
    echo "              2) $TRACKPOINT_NAME disable"
 +
    echo "                $TOUCHPAD_NAME enable"
 +
    echo "              3) $TRACKPOINT_NAME disable"
 +
    echo "                $TOUCHPAD_NAME disable"
 +
    echo "              4) $TRACKPOINT_NAME enable"
 +
    echo "                $TOUCHPAD_NAME enable"
 +
    exit 1
 +
}
 +
 +
GetState()
 +
{
 +
    echo $(/usr/bin/xinput list-props "$1" | grep "Device Enabled" | cut -f2 -d:)
 +
}
 +
 +
Status()
 +
{
 +
    case "$1" in
 +
"$TRACKPOINT")
 +
    DEVICE="$TRACKPOINT_NAME"
 +
;;
 +
"$TOUCHPAD")
 +
    DEVICE="$TOUCHPAD_NAME"
 +
;;
 +
    esac
 +
 +
    if [ $(GetState "$1") = "1" ]; then
 +
STATUS="enabled"
 +
    else
 +
STATUS="disabled"
 +
    fi
 +
   
 +
    echo -e "$DEVICE: $STATUS"
 +
}
 +
 +
SetState()
 +
{
 +
    /usr/bin/xinput set-int-prop "$1" "Device Enabled" "8" "$2"
 +
}
 +
 +
Enable()
 +
{
 +
    SetState "$1" 1
 +
}
 +
 +
Disable()
 +
{
 +
    SetState "$1" 0
 +
}
 +
 +
Toggle()
 +
{
 +
    if [ $(GetState "$1") = "1" ]; then
 +
STATE=0
 +
    else
 +
STATE=1
 +
    fi
 +
   
 +
    SetState "$1" "$STATE"
 +
}
 +
 +
[ $# -gt 2 ] && Usage
 +
 +
case "$1" in
 +
    "status")
 +
COMMAND="Status"   
 +
    ;;
 +
    "enable")
 +
COMMAND="Enable"
 +
    ;;
 +
    "disable")
 +
COMMAND="Disable"
 +
    ;;
 +
    "toggle")
 +
COMMAND="Toggle"
 +
if [ -z "$2" ]; then
 +
    if [ $(GetState "$TRACKPOINT") = "1" -a $(GetState "$TOUCHPAD") = "1" ]; then
 +
        SetState "$TRACKPOINT" 1
 +
        SetState "$TOUCHPAD" 0
 +
    elif [ $(GetState "$TRACKPOINT") = "1" -a $(GetState "$TOUCHPAD") = "0" ]; then
 +
        SetState "$TRACKPOINT" 0
 +
        SetState "$TOUCHPAD" 1
 +
    elif [ $(GetState "$TRACKPOINT") = "0" -a $(GetState "$TOUCHPAD") = "1" ]; then
 +
        SetState "$TRACKPOINT" 0
 +
        SetState "$TOUCHPAD" 0
 +
    else
 +
        SetState "$TRACKPOINT" 1
 +
        SetState "$TOUCHPAD" 1
 +
    fi
 +
    exit
 +
fi
 +
    ;;
 +
    *)
 +
Usage
 +
    ;;
 +
esac
 +
 +
case "$2" in
 +
    "$TRACKPOINT_NAME")
 +
$COMMAND "$TRACKPOINT"
 +
    ;;
 +
    "$TOUCHPAD_NAME")
 +
$COMMAND "$TOUCHPAD"
 +
    ;;
 +
    "")
 +
$COMMAND "$TRACKPOINT"
 +
$COMMAND "$TOUCHPAD"
 +
    ;;
 +
    *)
 +
    Usage
 +
esac   
 +
</pre>

Revision as of 18:11, 7 June 2009

Is there a reliable way to turn off the touchpad and the lowermost buttons, but leave the other functions (trackpoint and three buttons above the pad) not tampered with? Thanks for input!

Update: Nevermind, I just found the BIOS-option to disable it :D

- colo


Yes there is with the very latest distributions like Fedora 10 with updates applied create a file like this:

/etc/hal/fdi/policy/disable-touchpad.fdi

<match key="info.product" string="SynPS/2 Synaptics TouchPad">
 <merge key="input.x11_options.TouchpadOff" type="string">1</merge>
</match>

You will need to reboot (actually restart both X11 and HAL, but reboot is easier at that point) before it takes effect. --Tonko 00:18, 14 February 2009 (UTC)

Script for switching state of TouchPad and TrackPoint

Hint:
A suggestion.

FnF8 can run $ untranav.sh toggle

untranav.sh

#!/bin/bash
TRACKPOINT_NAME="trackpoint"
TRACKPOINT='TPPS/2 IBM TrackPoint'
TOUCHPAD_NAME="touchpad"
TOUCHPAD='SynPS/2 Synaptics TouchPad'

Usage()
{
    echo "usage: ${0/*\/} status [device]"
    echo "       ${0/*\/} enable [device]"
    echo "       ${0/*\/} disable [device]"
    echo "       ${0/*\/} toggle [device]"
    echo "device: $TRACKPOINT_NAME"
    echo "        $TOUCHPAD_NAME"
    echo "toggle order: 1) $TRACKPOINT_NAME enable"
    echo "                 $TOUCHPAD_NAME disable"
    echo "              2) $TRACKPOINT_NAME disable"
    echo "                 $TOUCHPAD_NAME enable"
    echo "              3) $TRACKPOINT_NAME disable"
    echo "                 $TOUCHPAD_NAME disable"
    echo "              4) $TRACKPOINT_NAME enable"
    echo "                 $TOUCHPAD_NAME enable"
    exit 1
}

GetState()
{
    echo $(/usr/bin/xinput list-props "$1" | grep "Device Enabled" | cut -f2 -d:)
}

Status()
{
    case "$1" in
	"$TRACKPOINT")
	    DEVICE="$TRACKPOINT_NAME"
	;;
	"$TOUCHPAD")
	    DEVICE="$TOUCHPAD_NAME"
	;;
    esac

    if [ $(GetState "$1") = "1" ]; then
	STATUS="enabled"
    else
	STATUS="disabled"
    fi
    
    echo -e "$DEVICE: $STATUS"
}

SetState()
{
    /usr/bin/xinput set-int-prop "$1" "Device Enabled" "8" "$2"
}

Enable()
{
    SetState "$1" 1
}

Disable()
{
    SetState "$1" 0
}

Toggle()
{
    if [ $(GetState "$1") = "1" ]; then
	STATE=0
    else
	STATE=1
    fi
    
    SetState "$1" "$STATE"
}

[ $# -gt 2 ] && Usage

case "$1" in
    "status")
	COMMAND="Status"    
    ;;
    "enable")
	COMMAND="Enable"
    ;;
    "disable")
	COMMAND="Disable"
    ;;
    "toggle")
	COMMAND="Toggle"
	if [ -z "$2" ]; then
	    if [ $(GetState "$TRACKPOINT") = "1" -a $(GetState "$TOUCHPAD") = "1" ]; then
	        SetState "$TRACKPOINT" 1
	        SetState "$TOUCHPAD" 0
	    elif [ $(GetState "$TRACKPOINT") = "1" -a $(GetState "$TOUCHPAD") = "0" ]; then
	        SetState "$TRACKPOINT" 0
	        SetState "$TOUCHPAD" 1
	    elif [ $(GetState "$TRACKPOINT") = "0" -a $(GetState "$TOUCHPAD") = "1" ]; then
	        SetState "$TRACKPOINT" 0
	        SetState "$TOUCHPAD" 0
	    else
	        SetState "$TRACKPOINT" 1
	        SetState "$TOUCHPAD" 1
	    fi
	    exit
	fi
    ;;
    *)
	Usage
    ;;
esac

case "$2" in
    "$TRACKPOINT_NAME")
	$COMMAND "$TRACKPOINT"
    ;;
    "$TOUCHPAD_NAME")
	$COMMAND "$TOUCHPAD"
    ;;
    "")
	$COMMAND "$TRACKPOINT"
	$COMMAND "$TOUCHPAD"
    ;;
    *)
    Usage
esac