我在我的联想 Thinkpad X220T(或 X220 平板电脑)上全新安装了 Ubuntu Trusty 14.04。
我已经设置了两个脚本来增强屏幕旋转,并且我想将它们绑定到键盘快捷键。
基本上,我添加了以下几行/etc/rc.local
:
setkeycodes 67 202 # Launch3
setkeycodes 6c 149 # Launch2
将屏幕边缘的第二个和第三个按钮绑定到“Launch2”和“Launch3”按钮。
然后我尝试向我的脚本添加自定义快捷方式,但什么也没有发生。
请注意,如果我将脚本链接到键盘快捷键,例如ctrl+alt+B
,它们就会起作用。
脚本如下:
#!/bin/sh
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
rotation=`xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)'`
# Using current screen orientation proceed to rotate screen and input tools.
echo $rotation
case "$rotation" in
normal)
# -rotate to inverted
xrandr -o inverted
xsetwacom set "10" Rotate half
xsetwacom set "11" Rotate half
xsetwacom set "15" Rotate half
;;
right)
# -rotate to inverted
xrandr -o inverted
xsetwacom set "10" Rotate half
xsetwacom set "11" Rotate half
xsetwacom set "15" Rotate half
;;
inverted)
# -rotate to normal
xrandr -o normal
xsetwacom set "10" Rotate none
xsetwacom set "11" Rotate none
xsetwacom set "15" Rotate none
;;
esac
exit 0
和
#!/bin/sh
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
rotation=`xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)'`
# Using current screen orientation proceed to rotate screen and input tools.
echo $rotation
case "$rotation" in
normal)
# -rotate to the right
xrandr -o right
xsetwacom set "10" Rotate ccw
xsetwacom set "11" Rotate ccw
xsetwacom set "15" Rotate ccw
;;
inverted)
# -rotate to the right
xrandr -o right
xsetwacom set "10" Rotate ccw
xsetwacom set "11" Rotate ccw
xsetwacom set "15" Rotate ccw
;;
right)
# -rotate to normal
xrandr -o normal
xsetwacom set "10" Rotate none
xsetwacom set "11" Rotate none
xsetwacom set "15" Rotate none
;;
esac
exit 0
我该如何解决这个问题?
答案1
我在 2023 年花了一些时间解决这个问题。我在联想 X220T 上运行 Linux Mint(基于 Ubuntu)
通过安装 Mark Ueding 的 Thinkpad 脚本 https://github.com/martin-ueding/thinkpad-scripts 您首先可以获取按钮的密钥代码。不要错过重启!
将旋转脚本放置在以下位置: https://github.com/Erik-JD/rotatescripts
安装
xbindkeys
以运行旋转脚本。例如,以左侧第二个边框按钮为例:
"~/projects/rotateScreen/rotate.sh"
m:0x0 + c:162
XF86TaskPane
就是这样。