Дерево страниц

Вы просматриваете старую версию данной страницы. Смотрите текущую версию.

Сравнить с текущим просмотр истории страницы

« Предыдущий Версия 3 Следующий »

Проблема возникает на устройствах с сенсорным вводом, например DEPO Sky M70.


Скрипт поворота экрана на экране логина.




Скрипт fly-rotate-no-wm.sh

Скачать

fly-rotate-no-wm.sh
#!/bin/sh 

name=

connected=$(xrandr -q --verbose | grep " connected")
output=$(echo "$connected" | head -n 1 | sed -e "s/\([a-zA-Z0-9]\+\) connected.*/\1/")

if [ -z "$output" ] ; then
  echo Не найден экран для поворота
  exit 1
fi

name="11;4"
IFS=';'

COMPTON_PID=`ps -C compton -o pid=`
[ ! -z $COMPTON_PID ] && kill $COMPTON_PID

#Try to guess about current orientation and rotate

# 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)')"
rotation="$(echo "$connected" | egrep -o  '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"


if ! test -z "$1"; then

# Workaroiund left<->right rotation failed in Qt!
VKBD_PID=`ps -C fly-vkbd -o pid=`
[ ! -z $VKBD_PID ] && fly-vkbd --minimizetotray
case "$1" in 
    left)
    if [ "$rotation" = "right" ]; then 
	xrandr --output $output --rotate normal
	if [ "$?" = 1 ]; then
	    fly-dialog --caption "Вращение экрана" --msgbox "Не удалось выполнить вращение"
	    exit 1
	fi
	sleep 3
    fi
    ;;
    right)
    if [ "$rotation" = "left" ]; then 
	xrandr --output $output --rotate normal
	if [ "$?" = 1 ]; then
	    fly-dialog --caption "Вращение экрана" --msgbox "Не удалось выполнить вращение"
	    exit 1
	fi
	sleep 3
    fi
    ;;
esac

#Do required rotation
xrandr --output $output --rotate "$1"
if [ "$?" = 1 ]; then
    fly-dialog --caption "Вращение экрана" --msgbox "Не удалось выполнить вращение"
    exit 1
fi

case "$1" in 
    left) 
    for name_i in ${name}; do
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axes Swap" 1
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axis Inversion" 1 0
    done
    xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 1 0
    ;;
    right) 
    for name_i in ${name}; do
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axes Swap" 1
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axis Inversion" 0 1
    done
    xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 0 1
    ;;
    normal) 
    for name_i in ${name}; do
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axes Swap" 0
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axis Inversion" 0 0
    done
    xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 0 0
    ;; 
    inverted) 
    for name_i in ${name}; do
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axes Swap" 0
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axis Inversion" 1 1
    done
    xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 1 1
    ;;
esac
else

rotateTo=
case "$rotation" in 
    normal) 
    rotateTo="left"
    ;;
    left) 
    rotateTo="normal"
    ;;
esac
if ! test -z "$rotateTo"; then
    xrandr --output $output --rotate $rotateTo
    if [ "$?" = 1 ]; then
      fly-dialog --caption "Вращение экрана" --msgbox "Не удалось выполнить вращение"
      exit 1
    fi
else
    fly-dialog --caption "Вращение экрана" --msgbox "Не удалось определить текущую ориентацию экрана"
    exit 1
fi

# Using current screen orientation proceed to rotate screen and input tools. 
case "$rotation" in 
    normal) 
    #rotate to the right 
    for name_i in ${name}; do
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axes Swap" 1
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axis Inversion" 1 0
    done
    xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 1 0
    ;;
    left) 
    #rotate to normal 
    if ! test -z "$dentry"; then
      cat $dentry | sed 's/Icon[ \t]*[\=]*.*$/Icon=object-rotate-left/' > /tmp/dentry.tmp
      mv -f /tmp/dentry.tmp $dentry
    fi
    for name_i in ${name}; do
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axes Swap" 0
    xinput set-prop --type=int --format=8 "${name_i}" "Evdev Axis Inversion" 0 0
    done
    xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 0 0
    ;;
esac
fi

#restart it after all rotation
[ ! -z $COMPTON_PID ] && compton &



ВНИМАНИЕ:

Внимание

Скрипт перед использованием необходимо модифицировать под вашу конфигурацию.

Необходимо убрать любую калибровку, любое использование xrandr и fly-rotate* в файле /etc/X11/fly-dm/Xsetup.

В сессии запустите команду xinput, в её выводе будет раздел Virtual core pointer

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Optical Mouse id=11 [slave pointer (2)]
...

4 и 11 - идентификаторы устройств типа указатель. Затем в скрипте fly-rotate-no-wm.sh найтите строку 

fly-rotate-no-wm.sh
name="11;4"

это id  устройств типа указатель, нужно вместо них через " ; " занести свои id (их может быть больше 2х)

Разместите скрипт, например в /usr/bin и вызывайте из /etc/X11/fly-dm/Xsetup (вместо fly-rotate.sh) как 

/etc/X11/fly-dm/Xsetup
fly-rotate-no-wm.sh left

Отключение блокировки

Для того, чтобы тачскрин не блокировался на время гашения экрана надо 
во всех файлах 
/usr/share/fly-wm/theme/*themerc* (для новых пользователей)
$HOME/.fly/theme/*themerc* (для уже бывалых пользователей)
Найти и раскомментарить параметры:

;LockerDPMSInCallback="xinput disable %d"
;LockerDPMSOutCallback="xinput enable %d"

т.е. сделать так:

LockerDPMSInCallback=""
LockerDPMSOutCallback=""

а если не отработает то так:

LockerDPMSInCallback="xinput enable %d"
LockerDPMSOutCallback="xinput enable %d"
  • Нет меток