特殊:Badtitle/NS100:SynapticsTouchpad/ShortcutKey
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/SynapticsTouchpad/ShortcutKey }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/af | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Afrikaans| [[::SynapticsTouchpad/ShortcutKey/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/ar | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|العربية| [[::SynapticsTouchpad/ShortcutKey/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/az | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|azərbaycanca| [[::SynapticsTouchpad/ShortcutKey/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/bcc | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|جهلسری بلوچی| [[::SynapticsTouchpad/ShortcutKey/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/bg | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|български| [[::SynapticsTouchpad/ShortcutKey/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/br | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|brezhoneg| [[::SynapticsTouchpad/ShortcutKey/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/ca | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|català| [[::SynapticsTouchpad/ShortcutKey/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/cs | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|čeština| [[::SynapticsTouchpad/ShortcutKey/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/de | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Deutsch| [[::SynapticsTouchpad/ShortcutKey/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/el | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Ελληνικά| [[::SynapticsTouchpad/ShortcutKey/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/es | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|español| [[::SynapticsTouchpad/ShortcutKey/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/fa | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|فارسی| [[::SynapticsTouchpad/ShortcutKey/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/fi | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|suomi| [[::SynapticsTouchpad/ShortcutKey/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/fr | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|français| [[::SynapticsTouchpad/ShortcutKey/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/gu | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|ગુજરાતી| [[::SynapticsTouchpad/ShortcutKey/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/he | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|עברית| [[::SynapticsTouchpad/ShortcutKey/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/hu | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|magyar| [[::SynapticsTouchpad/ShortcutKey/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/id | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Bahasa Indonesia| [[::SynapticsTouchpad/ShortcutKey/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/it | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|italiano| [[::SynapticsTouchpad/ShortcutKey/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/ja | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|日本語| [[::SynapticsTouchpad/ShortcutKey/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/ko | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|한국어| [[::SynapticsTouchpad/ShortcutKey/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/ksh | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Ripoarisch| [[::SynapticsTouchpad/ShortcutKey/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/mr | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|मराठी| [[::SynapticsTouchpad/ShortcutKey/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/ms | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Bahasa Melayu| [[::SynapticsTouchpad/ShortcutKey/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/nl | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Nederlands| [[::SynapticsTouchpad/ShortcutKey/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/no | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|norsk| [[::SynapticsTouchpad/ShortcutKey/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/oc | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|occitan| [[::SynapticsTouchpad/ShortcutKey/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/pl | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|polski| [[::SynapticsTouchpad/ShortcutKey/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/pt | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|português| [[::SynapticsTouchpad/ShortcutKey/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/ro | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|română| [[::SynapticsTouchpad/ShortcutKey/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/ru | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|русский| [[::SynapticsTouchpad/ShortcutKey/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/si | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|සිංහල| [[::SynapticsTouchpad/ShortcutKey/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/sq | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|shqip| [[::SynapticsTouchpad/ShortcutKey/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/sr | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|српски / srpski| [[::SynapticsTouchpad/ShortcutKey/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/sv | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|svenska| [[::SynapticsTouchpad/ShortcutKey/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/th | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|ไทย| [[::SynapticsTouchpad/ShortcutKey/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/tr | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Türkçe| [[::SynapticsTouchpad/ShortcutKey/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/vi | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|Tiếng Việt| [[::SynapticsTouchpad/ShortcutKey/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/yue | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|粵語| [[::SynapticsTouchpad/ShortcutKey/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/zh | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|中文| [[::SynapticsTouchpad/ShortcutKey/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/zh-hans | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|中文(简体)| [[::SynapticsTouchpad/ShortcutKey/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey | UbuntuHelp:SynapticsTouchpad/ShortcutKey | {{#if: | :}}SynapticsTouchpad/ShortcutKey}}/zh-hant | • {{#if: UbuntuHelp:SynapticsTouchpad/ShortcutKey|中文(繁體)| [[::SynapticsTouchpad/ShortcutKey/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:SynapticsTouchpad/ShortcutKey|:SynapticsTouchpad/ShortcutKey|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :SynapticsTouchpad/ShortcutKey/zh | | {{#ifexist: SynapticsTouchpad/ShortcutKey/zh | | {{#ifeq: {{#titleparts:SynapticsTouchpad/ShortcutKey|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:SynapticsTouchpad/ShortcutKey|1|-1|}} | zh | | }}
<<Include(Tag/StyleCleanup)>> <<Include(Tag/ContentCleanup)>>
Turning Synaptics Touchpads On/Off with a Shortcut Key
You may wish to turn the touchpad on or off so that it doesn't interfere with typing when using a USB or other mouse. Use following steps:
Step 1
Ubuntu version <= 8.04 (Hardy Heron)
from a terminal, edit /etc/xorg.conf
gksudo gedit /etc/X11/xorg.conf
and look for the following section of code:
Section "InputDevice" Identifier "Synaptics Touchpad" Driver "synaptics" Option "SendCoreEvents" "true" Option "Device" "/dev/psaux" Option "Protocol" "auto-dev" Option "HorizScrollDelta" "0" EndSection
and add one more Option at the End of the Section:
Option "SHMConfig" "on" EndSection
If you are using an Alps-Touchpad, which you can find out by typing
cat /proc/bus/input/devices
your code section should look like this
Section "InputDevice" Driver "synaptics" Identifier "TouchPad" Option "SendCoreEvents" "true" Option "Device" "/dev/input/event2" Option "Protocol" "event" Option "SHMConfig" "on" EndSection
You can define some parameters which influence the behaviour of your touchpad. These parameters are presented already in UbuntuWiki:SynapticsTouchpadWartyHowto?highlight=_touchpad_. You can check if your touchpad works correct and you have the correct parameters with
synclient -m l
If everything works fine, the position of your finger will be updated everytime you move it and based on this information you can set your parameters.
Ubuntu 8.10 (Intrepid Ibex)
Ubuntu 8.10 (Intrepid Ibex) uses HAL, and so synaptic settings are placed in an fdi file instead of xorg.conf. To enable SHMConfig see here: UbuntuHelp:SynapticsTouchpad#shmconfig
Step 2
In this next part we will create a script to toggle the touchpad. There are a couple of ways to write the scripts to toggle the touchpad on and off. The first method uses Python, the second method uses a more simple bash script. Choose the one you like the most.
Step 2a
Next we will create 3 files - a bash script to turn the touchpad off, one to turn it on, and a python script to use a single key combination for both. At a terminal, cd
to /usr/local/bin
and make a new file:
cd /usr/local/bin gksudo gedit tpoff
and paste the following code in the file, save it and close it.
#!/bin/bash # synclient touchpadoff=1
again, make a new file:
gksudo gedit tpon
paste the following, save and close:
#!/bin/bash # synclient touchpadoff=0
once again, make a new file:
gksudo gedit touchpad.py
paste the following, save and close
#!/usr/bin/python import os def ReadFile(): myfile = open('/tmp/synclient.tmp', 'rb') for line in myfile: TestString(line) myfile.close() def TestString(string): for word in string.split(): if word == "TouchpadOff": setting = string.split() ChangeState(setting[2]) def ChangeState(current): if current == "0": os.system("synclient touchpadoff=1") else: os.system("synclient touchpadoff=0") os.system("rm /tmp/synclient.tmp") def Main(): ReadFile() os.system("synclient -l > /tmp/synclient.tmp") Main()
and finally, change the permissions of these three files:
sudo chmod 755 tpon tpoff touchpad.py
Step 2b
First open a terminal and cd
to /usr/local/bin
and make a new file:
cd /usr/local/bin gksudo gedit toggletouchpad
and paste the following code in the file, save it and close it.
#!/bin/bash state=`synclient -l | fgrep TouchpadOff | sed 's/^.*= //'` if [ $state -eq 1 ] then synclient TouchpadOff=0 else synclient TouchpadOff=1 fi
Next, change the permissions of this file:
sudo chmod 755 toggletouchpad
Step 3
Next, edit your sudoers files to allow you to execute the script without a password.
sudo visudo
and add this line
{user} ALL = NOPASSWD: /usr/local/bin/{script name}
where {user} is your user name and {script name} is the name of the script you created.
save (in nano hit <CTRL> <o>), and make sure to save it as: /etc/sudoers and not /etc/sudoers.tmp
Step 4
Alternatively to setup bellow, you might use gnome-keybindings(In depth instructions, 4.) or other desktop-dependent tool. Next, install xbindkeys
sudo apt-get install xbindkeys
when it's done, install xbindkeys-config, the GUI for xbindkeys
sudo apt-get install xbindkeys-config
once each is installed, start both applications:
xbindkeys
and
xbindkeys-config
edit your file to the shortcut key you want. For example, to be able to switch the touchpad on/off by <Ctrl><F5>, fill in the following, under Edit: Name: Touchpad On/Off Key: Control + F5 | m:0x4 + c:71 Action: /usr/local/bin/touchpad.py then click apply & save & exit (change the script name in the 'Action' field if you used the other method.) Now that that is done, restart xbindkeys:
xbindkeys
You may need to restart X. Remember that each time you restart X, you will need to run xbindkeys again in order for the shortcut to work. Go to System>Preferences>Sessions>Startup Programs> click add type xbindkeys then click ok.
Bash Script
Instead of using the 3 scripts above, you can achieve the same thing with a single bash script:
#!/bin/bash # toggle synaptic touchpad on/off # get current state SYNSTATE=$(synclient -l | grep TouchpadOff | awk '{ print $3 }') # change to other state if [ $SYNSTATE = 0 ]; then synclient touchpadoff=1 elif [ $SYNSTATE = 1 ]; then synclient touchpadoff=0 else echo "Couldn't get touchpad status from synclient" exit 1 fi exit 0