로그인
Sign in

Lenovo IDEAPAD Flex5 14-ARE05 노트북 화면 회전


1. 설치

apt-get install rotatescreen-flex5

2. 사용법

rotatescreen <normal, left, right, inverted>

3. 스크립트

#!/bin/bash

### BEGIN INIT INFO
# Provides:          rotatescreen
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remore_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Rotate LENOVO FLEX5 14ARE05
# Description:       Script for LENOVO FLEX5 14ARE05 Touchscreen Rotation
# Provided by:       No1.Linux(Dumca Suh, 2020.07.07)
### END INIT INFO

. /etc/rc.d/init.d/functions

direc=$(xrandr -q | grep -v dis | grep connected | awk '{ print $5 }' | sed -e 's/(//g')
display=$(xrandr -q | grep -v dis | grep connected | awk '{ print $1 }')
tsid1=$(xinput | grep stylus | awk '{ print $8}' | sed -e 's/id=//g')
tsid2=$(xinput | grep touch | awk '{ print $8}' | sed -e 's/id=//g')
xprop1=$(xinput list-props $tsid1 | grep Coordinate | awk '{ print $4 }' | sed -e 's/(//g' -e 's/)://g')               
xprop2=$(xinput list-props $tsid2 | grep Coordinate | awk '{ print $4 }' | sed -e 's/(//g' -e 's/)://g')

case "$1" in
    normal)
    # normal
    xrandr --output $display --rotate normal
    xinput set-prop $tsid1 $xprop1 1 0 0 0 1 0 0 0 1
    xinput set-prop $tsid2 $xprop2 1 0 0 0 1 0 0 0 1
    ;;
    right)
    # right
    xrandr --output $display --rotate right
    xinput set-prop $tsid1 $xprop1 0 1 0 -1 0 1 0 0 1
    xinput set-prop $tsid2 $xprop2 0 1 0 -1 0 1 0 0 1
    ;;
    left)
    # left
    xrandr --output $display --rotate left
    xinput set-prop $tsid1 $xprop1 0 -1 1 1 0 0 0 0 1
    xinput set-prop $tsid2 $xprop2 0 -1 1 1 0 0 0 0 1
    ;;
    inverted)
    # inverted
    xrandr --output $display --rotate inverted
    xinput set-prop $tsid1 $xprop1 -1 0 1 0 -1 1 0 0 1
    xinput set-prop $tsid2 $xprop2 -1 0 1 0 -1 1 0 0 1
    ;;
    stop)
    $0 normal
    ;;
    *)
    echo "Usage: $0 {normal|right|left|inverted|stop}"
    exit 1
    ;;
esac

exit 0


Lenovo Ideapad Flex5 14ARE05 제품에서 화면 회전은 WACOM Pen Stylus(id=12)와 WACOM Finger touch(id=13)에 의해서 동작하기 때문에 하나의 장치만 설정하게 되면 펜과 마우스 위치가 달라지게 되므로, 반드시 두 장치 모두 설정해 주어야 함.