У меня новая версия Ubuntu Trusty 14.04 на моем Lenovo Thinkpad X220T (или планшете X220).
Я установил два сценария для улучшения поворота экрана, и я хотел бы связать их с сочетанием клавиш.
По сути, я добавил эти строки в /etc/rc.local
:
setkeycodes 67 202 # Launch3
setkeycodes 6c 149 # Launch2
, чтобы связать вторую и третью кнопки на краю экрана с кнопками «Lauch2» и «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
Как решить проблему?