มีวิธีปิดใช้งานทัชแพดโดยใช้คำสั่งเทอร์มินัลหรือไม่
มีวิธีปิดใช้งานทัชแพดโดยใช้คำสั่งเทอร์มินัลหรือไม่
คำตอบ:
วิธีปิดทัชแพด:
synclient TouchpadOff=1
วิธีเปิดใช้งาน:
synclient TouchpadOff=0
มีอย่างน้อยสองวิธี (ที่ฉันรู้) คุณสามารถลองได้
หากแล็ปท็อปของคุณติดตั้งทัชแพด Synaptics (หรือ ALPS) คุณสามารถใช้งานได้จริงsynclientตามที่ Shutupsquare ได้กล่าวไว้แล้ว ฉันใช้ Ubuntu 14.04 และบนเครื่องของฉันติดตั้งตามค่าเริ่มต้น
ทดสอบว่ามีการติดตั้ง synclient หรือไม่: synclient -V(ควรรายงานหมายเลขเวอร์ชัน)
เปิดทัชแพด: synclient TouchpadOff=0
ปิดทัชแพด: synclient TouchpadOff=1
ฉันไม่ได้ทดสอบตัวเอง แต่ถ้าเป้าหมายของคุณคือไม่เลื่อนเม้าส์เมื่อแขนของคุณวางอยู่บนทัชแพดสิ่งนี้อาจช่วยได้
เปิดการตรวจจับฝ่ามือ: synclient PalmDetect=1
ปิดการตรวจจับฝ่ามือ: synclient PalmDetect=0
โดยทั่วไปคุณสามารถกำหนดค่าคุณสมบัติของทัชแพด Synaptics ของคุณsynclient property=valueได้ โดยที่คุณสมบัติเป็นหนึ่งในคุณสมบัติที่มีอยู่ซึ่งแสดงโดยsynclient -l
ubuntu - commiki help wiki - SynapticsTouchpad
archlinux - wiki - Touchpad Synaptics
ถามอูบุนตู - ฉันจะทำให้การตั้งค่าแบบสรุปได้อย่างไร? - อูบุนตู
หากคุณไม่ต้องการหรือไม่สามารถใช้งานได้คุณสามารถใช้งานxinputได้เช่นกัน ขั้นตอนค่อนข้างคล้าย
แสดงรายการอุปกรณ์ xinput ทั้งหมด: xinput
ส่วนหนึ่งของ ouput อาจมีลักษณะเช่นนี้:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB-PS/2 Optical Mouse id=13 [slave pointer (2)]
⎜ ↳ ETPS/2 Elantech Touchpad id=17 [slave pointer (2)]
ในกรณีนี้ทัชแพดของฉันมี id = 17 และชื่อเต็มคือ "ETPS / 2 Elantech Touchpad"
xinput set-propคำสั่งการตั้งค่าคุณสมบัติเป็น คุณสมบัติในการเปิดใช้งานหรือปิดการใช้งานทัชแพดคือDevice Enabledเพื่อเปิดหรือปิดใช้งานประเภท:
เปิดใช้งานทัชแพด: xinput set-prop <id> "Device Enabled" 1( <id>รหัสอุปกรณ์ของคุณอยู่ที่ไหนในกรณีของฉัน 17)
ปิดทัชแพด: xinput set-prop <id> "Device Enabled" 0
เปิดการตรวจจับฝ่ามือ: xinput set-prop <id> "Palm Detection" 1
ปิดการตรวจจับฝ่ามือ: xinput set-prop <id> "Palm Detection" 0
เพื่อสอบถามคุณสมบัติที่ใช้ได้: xinput list-props <id>OR xinput list-props <full-name>นี้ควรจะค่อนข้าง similair synclient -lไป
เมื่อตั้งค่าคุณสมบัติผ่านคุณสมบัติใดคุณสมบัติหนึ่งxinputหรือsynclientไม่ได้ตั้งค่าเป็นเครื่องมืออื่น พวกเขายังไม่ได้ตั้งอยู่ในศูนย์ควบคุมความสามัคคี
synclientไม่ได้ทำงานให้ฉันxinputทำ
xinputรหัสสามารถเปลี่ยนได้มากกว่าการรีสตาร์ท ดังนั้นพึ่งพารหัสเหล่านี้ในสคริปต์หรือทางลัดจะไม่ทำงาน
synclientใช้งานได้กับ Arch Linux ทั้งหมด ขอบคุณดังนั้นมาก !!!
xinput <enable/disable> <id>เนื่องจากการตั้งค่าTouchpadOffผ่านsynclientไม่ได้ผล
xinputขอขอบคุณสำหรับการแนะนำให้รู้จักกับ ฉันรู้สึกสับสนเล็กน้อยกับแป้นพิมพ์ในตัวและปุ่ม trackpoint ของฉันซึ่งส่งสัญญาณอินพุตที่ไม่ดีซึ่งรบกวนการป้อนข้อมูลจากแป้นพิมพ์ภายนอก สิ่งนี้ทำให้ฉันสามารถปิดการใช้งานอุปกรณ์ในตัว ไชโย! :)
synclientและxinputจะไม่ทำงานหากคุณใช้สภาพแวดล้อมของ gnome (หรือ unity, cinnamon) เพราะจะเป็นการแทนที่การตั้งค่าดังนั้นหากคุณต้องการsynclientหรือxinputรับการตั้งค่าเหล่านี้คุณควรปิดการใช้งานก่อน:
ติดตั้งdconf-editorหากไม่ได้ติดตั้ง:
apt-get install dconf-editor
วิ่ง dconf-editor
dconf-editor
เปิดไดเรกทอรี/org/gnome/settings-daemon/plugins/mouse/หรือและยกเลิกการคลิกช่องทำเครื่องหมาย/org/cinnamon/settings-daemon/plugins/mouse/active
logout หรือ reboot
สิ่งนี้ควรทำsynclientหรือxinputทำงาน
รายการอุปกรณ์อินพุตของคุณ:
xinput list
ในกรณีของฉันฉันมีรายการนี้:
Virtual core XTEST pointer id=4
Logitech M510 id=11
ETPS/2 Elantech Touchpad id=15
ปิดการใช้งานทัชแพดของคุณโดยส่ง ID
xinput set-prop 15 "Device Enabled" 0
xinput enable [device]และxinput disable [device]โดยตรง เมื่อทำการเขียนสคริปต์การใช้set-prop [device] "Device Enabled" [value]อาจจะง่ายขึ้นเล็กน้อยในคำตอบของนักพัฒนา World Python
ฉันเขียนโค้ดไพ ธ อนเพื่อให้คุณสามารถใช้xinputเทคนิคโดยไม่ต้องทำงานทั้งหมดด้วยตนเอง Copyleft, ตามที่เป็น, ไม่มีการรับประกัน, ใช้ความเสี่ยงของคุณเอง CtrlShiftTการทำงานที่ดีสำหรับฉันและถ้าคุณกำลังใช้คำพังเพยเพียงแผนที่ไปยังทางลัดที่สำคัญเช่น
#!/usr/bin/python2
# -*- coding: utf-8 -*-
'''Program to toggle Touchpad Enable to Disable or vice-versa.'''
import commands
import re
def current_id():
""" Search through the output of xinput and find the line that has the
word TouchPad. At that point, I believe we can find the ID of that device."""
props = commands.getoutput("xinput").split("\n")
match = [line for line in props if "TouchPad" in line]
assert len(match) == 1, "Problem finding Touchpad string! %s" % match
pat = re.match(r"(.*)id=(\d+)", match[0])
assert pat, "No matching ID found!"
return int(pat.group(2))
def current_status(tpad_id):
"""Find the current Device ID, it has to have the word TouchPad in the line."""
props = commands.getoutput("""xinput list-props %d""" % tpad_id).split('\n')
match = [line for line in props if "Device Enabled" in line]
assert len(match) == 1, "Can't find the status of device #%d" % tpad_id
pat = re.match(r"(.*):\s*(\d+)", match[0])
assert pat, "No matching status found!"
return int(pat.group(2))
def flop(tpad_id, status):
"""Change the value of status, and call xinput to reverse that status."""
if status == 0:
status = 1
else:
status = 0
print "Changing Device #%d Device Enabled %d" % (tpad_id, status)
commands.getoutput("""xinput set-prop %d "Device Enabled" %d""" % (tpad_id, status))
def main():
"""Get curent device id and status, and flop status value."""
tpad = current_id()
stat = current_status(tpad)
flop(tpad, stat)
main()
ใน Gnome ปุ่มฟังก์ชันของฉันเพื่อสลับทัชแพดไม่ทำงานด้วยเหตุผลบางอย่างดังนั้นฉันจึงสร้างสคริปต์โดยใช้ gsettings
xinputวิธีแก้ปัญหาจะปิดการใช้งานทัชแพดอย่างสมบูรณ์ตามที่คาดไว้ หากชอบฉันปัญหาเดียวของคุณคือคุณเลื่อนเคอร์เซอร์ไปโดยไม่ตั้งใจขณะพิมพ์ แต่นั่นก็เพียงพอแล้วtoggle_touchpad_gsettings.py
#!/usr/bin/python3.6
import sys
import subprocess
gsettings_schema, gsettings_key = "org.gnome.desktop.peripherals.touchpad", "send-events"
def get_touchpad_send_events():
send_events_value = subprocess.check_output(["gsettings", "get", gsettings_schema, gsettings_key])
return send_events_value.strip()
def toggle_touchpad():
# string returned from get is a repr including quotes,
# but string sent with set does not need to have quotes
if get_touchpad_send_events() == b"'enabled'":
newval = 'disabled'
else:
newval = 'enabled'
subprocess.Popen(["gsettings", "set", gsettings_schema, gsettings_key, newval])
print(f"Set {gsettings_schema}:{gsettings_key} to {newval}")
def main():
toggle_touchpad()
if __name__ == '__main__':
main()
มันควรใช้กับ Unity ด้วย แต่ฉันยังไม่ได้ทดสอบ