触摸屏输入无法旋转:联想Yoga 13 / Yoga 2 Pro
在收到圣诞节联想Yoga 13后,我对Ubuntu的表现感到满意。 可以很容易地在显示设置菜单下更改显示方向,或者在终端中键入例如xrandr -o inverted
。 然而,这不会旋转触摸屏的输入(或者更不重要的是 – 触摸板)。
我已经四处寻找这个问题的解决方案,并找到了两个有希望的来源。
(1) http://cc.oulu.fi/~rantalai/synaptics/ 。 在此处安装包并运行建议的命令会旋转显示器和触摸板输入(但不是触摸屏的输入)。
(2) http://www.elfsternberg.com/2013/05/25/thinkpad-yoga-ubuntu-12/ 。 本网站建议更新输入包,我没试过。
通过阅读Ubuntu Wiki上的有用信息,我找到了一个直截了当的答案:X – 输入坐标转换 。
这些命令可用于对齐输入设备和显示器的旋转:
-
第一个命令旋转显示,可以是左,右,正常或反转:
xrandr -o
-
重新映射输入设备:
xinput set-prop '
' 'Coordinate Transformation Matrix'
第二个命令重新映射输入设备(即触摸板或触摸屏),其中
为0 -1 1 1 0 0 0 0 1
0 1 0 -1 0 1 0 0 1
1 0 0 0 1 0 0 0 1
,或-1 0 1 0 -1 1 0 0 1
; 对应于上面的方向。
可以使用xinput list
找到触摸板和触摸屏的名称,并且可以使用xinput disable
完全xinput disable
。 随后, xinput enable
将重新启用输入设备。
在我的情况下,也许对于其他拥有Yoga 13(也在Yoga 2 Pro上)的人来说,触摸屏被称为ELAN Touchscreen
和触摸板SynPS/2 Synaptics TouchPad
。
因此,我在我的主目录中放了一个名为rotate-inverted.sh
的短脚本,其中包含以下内容:
#!/斌/庆典 #此脚本将屏幕和触摸屏输入旋转180度,禁用触摸板,并启用虚拟键盘 xrandr -o倒置 xinput set-prop'ENLAN Touchscreen''坐标转换矩阵'-1 0 1 0 -1 1 0 0 1 xinput禁用'SynPS / 2 Synaptics TouchPad' 在船上 &
然后我用脚本可执行脚本
chmod u+x rotate-inverted.sh
并将命令~/rotate-inverted.sh
分配给键盘快捷键Ctrl + Alt + I in
系统设置 – >键盘 。
在我退出并重新登录后,我可以通过按下该快捷键来旋转键盘。
我为其他旋转位置做了相同类型的事情,使用命令xinput enable 'SynPS/2 TouchPad'
和killall onboard
而不是xinput disable 'SynPS/2 TouchPad'
和onboard &
for rotate-normal.sh
。
这个线程上的其他人已经讨论过将这些脚本分配给上的额外按钮
瑜伽 – 例如锁定按钮 – 以及在改变瑜伽位置时自动执行它们; 但我不知道该怎么做。
我添加了几行,第二次运行脚本将屏幕恢复正常并启用触摸板,使用Ideapad 2 Pro进行测试。 顺便说一句,我确实在侧面板上安装了脚本启动器HowTo:new launcher 。
内核尚不支持Accelerometer,但下一版本可能会出现一些问题。
创建脚本/usr/local/bin/rotate-screen.sh
#!/bin/bash # This script rotates the screen and touchscreen input 180 degrees, disables the touchpad, and enables the virtual keyboard # And rotates screen back if the touchpad was disabled isEnabled=$(xinput --list-props 'SynPS/2 Synaptics TouchPad' | awk '/Device Enabled/{print $NF}') if [ $isEnabled == 1 ] then echo "Screen is turned upside down" xrandr -o inverted xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1 xinput disable 'SynPS/2 Synaptics TouchPad' # Remove hashtag below if you want pop-up the virtual keyboard # onboard & else echo "Screen is turned back to normal" xrandr -o normal xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1 xinput enable 'SynPS/2 Synaptics TouchPad' # killall onboard fi
并赋予它可执行权限:
sudo chmod +x /usr/local/bin/rotate-screen.sh
实用程序旋转旨在与ThinkPad Yogas配合使用,因此它可以处理手写笔信息等,并提供各种方向控制(通过按钮,屏幕旋转和加速度计)。 这可能值得尝试。