Поворот сенсорной панели при повороте экрана

Недавно я получил Ubuntu 17.10, и это удивительно. Я использую его в своем HP Pavilion, и когда я поворачиваю экран, сенсорная панель не вращается. У меня нет сенсорного экрана. Я хочу повернуть тачпад с помощью экрана, но не смог заставить его работать. Я посмотрел здесь много вопросов, например, , этот и многие другие, но ни один из них не помог. Может кто-нибудь помочь мне?

2
задан 21 November 2017 в 18:26

1 ответ

Я не уверен, ищете ли Вы все еще решение этого, но я записал сценарий некоторое время назад для получения этой функциональности. это использует xrandr и xinput.

поместите следующее в ~ / мусорное ведро после замены eDP1 с экраном Ваша сенсорная панель для следования. может получить список Ваших экранов путем выполнения xrandr.

изменение --output eDP1 кому: -o если Вы хотите повернуть все экраны.

Вы, возможно, должны играть вокруг с кодом, который получает xinput идентификатор для Вашей сенсорной панели.

удостоверьтесь, что это - исполняемый файл, и также мусорное ведро находится в переменной $PATH.

без материала, который не делает предварительной оловянной амальгамы Ваш вопрос

#!/bin/bash
#inverted -> right -> normal -> left -> inverted
status="$(xrandr -q|grep eDP1|awk '{print $3}')"
if [ $status == 'primary' ]; then
   state="$(xrandr -q|grep eDP1|awk '{print $5}')"
else
   state="$(xrandr -q|grep eDP1|awk '{print $4}')"
fi
touchpad=$(xinput | awk '/Touchpad/ {print $7}' | grep -oP [0-9]+) #


case "${state}" in
'inverted')
  xrandr --output eDP1 --rotate right
  xinput set-prop "$touchpad" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 0 0 0 1
  ;;
'right')
  xrandr --output eDP1 --rotate normal
  xinput set-prop ${touchpad} --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
  ;;
'(normal')
  xrandr --output eDP1 --rotate left 
  xinput set-prop ${touchpad} --type=float "Coordinate Transformation Matrix" 0 -1 0 1 0 0 0 0 1
  ;;
'left')
  xrandr --output eDP1 --rotate inverted
  xinput set-prop ${touchpad} --type=float "Coordinate Transformation Matrix" -1 0 0 0 -1 0 0 0 1
  ;;
esac

У меня есть он делающий пользовательские вещи также

#!/bin/bash
#inverted -> right -> normal -> left -> inverted
state="$(orientation)"
#[ "${state}" == 'inverted' ] && xrandr --output eDP1 --rotate right || ([ "${state}" == 'right' ] && xrandr --output eDP1 --rotate normal || ([ "${state}" == 'left' ] && xrandr --output eDP1 --rotate inverted || xrandr --output eDP1 --rotate left));
#sleep 2
#xrandr-invert-colors;
touchpad=$(xinput | awk '/Touchpad/ {print $7}' | grep -oP [0-9]+) #xinput list --id-only "ipts 1B96:005E Touchscreen"
libinput_enabled=false
gestures_enabled=true

case "${state}" in
'inverted')
  xrandr --output eDP1 --rotate right
  xinput set-prop "$touchpad" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 0 0 0 1
  if [ "$libinput_" = true ]; then  
    cp ~/.config/libinput-gestures.conf_right ~/.config/libinput-gestures.conf
    libinput-gestures-setup restart
  fi
  ;;
'right')
  xrandr --output eDP1 --rotate normal
  xinput set-prop ${touchpad} --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
  if [ "$libinput_" = true ]; then
    cp ~/.config/libinput-gestures.conf_normal ~/.config/libinput-gestures.conf
    libinput-gestures-setup restart
  fi
  ;;
'(normal')
  xrandr --output eDP1 --rotate left 
  xinput set-prop ${touchpad} --type=float "Coordinate Transformation Matrix" 0 -1 0 1 0 0 0 0 1
  if [ "$libinput_" = true ]; then
    cp ~/.config/libinput-gestures.conf_left ~/.config/libinput-gestures.conf
    libinput-gestures-setup restart
  fi
  ;;
'left')
  xrandr --output eDP1 --rotate inverted
  xinput set-prop ${touchpad} --type=float "Coordinate Transformation Matrix" -1 0 0 0 -1 0 0 0 1
  if [ "$libinput_" = true ]; then
    cp ~/.config/libinput-gestures.conf_inverted ~/.config/libinput-gestures.conf
    libinput-gestures-setup restart
  fi
  ;;
esac

if [ "$gestures_enabled" = true ]; then
   restartTouchpad;
fi 
1
ответ дан 2 December 2019 в 04:46

Другие вопросы по тегам:

Похожие вопросы: