GalliumOS / galliumos-distro

Docs, issues, and artwork sources for GalliumOS
https://galliumos.org/
GNU General Public License v2.0
347 stars 11 forks source link

Add mode transition detection for convertible devices #316

Open reynhout opened 7 years ago

reynhout commented 7 years ago

On detection of transition to/from "tent" or "tablet" modes:

Relevant models:

Code to handle transition from @lispykid https://github.com/GalliumOS/galliumos-distro/issues/270#issuecomment-263014919

#!/bin/bash
#Script for rotating the screen and touchdevices on my Acer R11 Chromebook (11.11.2016 / Marcus Janietz

STATE=`xrandr | grep eDP  | awk '{print $4}'`

echo $STATE
   if [[ $STATE == *"left"* ]]
   then
       xrandr -o inverted && xinput set-prop "Elan Touchscreen" "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1 # && xinput set-prop "Elan Touchpad" "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
   else

     if [[ $STATE == *"inverted"* ]]
         then
             xrandr -o normal && xinput set-prop "Elan Touchscreen" "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1 && xinput reattach 11 3  && xinput set-prop "Elan Touchpad" "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
         else
             xrandr -o left && xinput set-prop "Elan Touchscreen" "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1 && xinput float 11 && /usr/bin/onboard # && xinput set-prop "Elan Touchpad" "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1

     fi
fi
reynhout commented 7 years ago

Also see: https://www.reddit.com/r/GalliumOS/comments/5qzqyg/galliumos_and_glimmer/dd3pqxl/

jklingen92 commented 7 years ago

Where should I add this script? What do I do with it?

Thanks for the help!

simonheb commented 7 years ago

this only detects the current mode of the screen. it doesnt detect rotations or anything, so it doesnt solve anything so far

simonheb commented 7 years ago

as a temporary "solution" on my convertible i use a script (bound to a shortcut). i found the script on stackexchange (see copyright node). I added two lines to fix the touch screen input.

#!/bin/sh
# invert_screen copyright 20170516 alexx MIT Licence ver 1.0
orientation=$(xrandr -q|grep -v dis|grep connected|awk '{print $4}')
display=$(xrandr -q|grep -v dis|grep connected|awk '{print $1}')
if [ "$orientation" != "(normal" ]; then
   xrandr --output $display --rotate normal
   xinput set-prop "Elan Touchscreen" --type=float  "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
else
   xrandr --output $display --rotate left
   xinput set-prop "Elan Touchscreen" --type=float  "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
fi
ghost commented 6 years ago

I have CYAN, can test anything that crops up.

GardenOfWyers commented 5 years ago

I was searching on how to get the tablet mode working on CAVE GalliumOS 3 (at least disable the keyboard) and stumbled upon this ticket. Getting the tablet switch event working can be found here: https://github.com/GalliumOS/galliumos-distro/issues/411. I've not done it myself since it would require a kernel patch and I don't have any experience patching a kernel. Hopefully this is something the GalliumOS team can patch in for these models.