Advertisement
metalx1000

Tablet mode for Chromebook touch screen

Aug 4th, 2019
981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.82 KB | None | 0 0
  1. #!/bin/bash
  2. #Tablet mode for Acer R11 Chromebook running Linux
  3. #Copyright Kris Occhipinti
  4. #http://filmsbykris.com
  5. #August 4th 2019
  6. # License GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
  7.  
  8. #xinput list
  9. state_file="$HOME/.tablet_state"
  10. device="Elan Touchscreen"
  11.  
  12. if [ ! -f "$state_file" ];then
  13.   echo "0" > "$state_file"
  14. fi
  15.  
  16. state="$(cat $state_file)"
  17. #Portrait (left)
  18.  
  19. if [ "$state" = "0" ];then
  20.   echo "1" > "$state_file"
  21.  
  22.   #rotate screen
  23.   xrandr -o left
  24.  
  25.   #rotate mouse  
  26.   xinput set-prop "$device" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1                                    
  27.   xinput set-prop "$device" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1                        
  28.  
  29.   #disable keyboard and touchpad
  30.   xinput --disable "$(xinput|grep "AT Translated Set 2 keyboard"|cut -d\= -f2|cut -f1)"
  31.   xinput --disable "$(xinput|grep "Elan Touchpad"|cut -d\= -f2|cut -f1)"
  32. else                                                                                                                                              
  33.   #landscape (normal)                                                                                                                              
  34.   echo "0" > "$state_file"
  35.   xrandr -o normal                                                                                                                                
  36.   xinput set-prop "$device" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0                                      
  37.   xinput set-prop "$device" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0    
  38.  
  39.   #enable keyboard and touchpad
  40.   xinput --enable "$(xinput|grep "AT Translated Set 2 keyboard"|cut -d\= -f2|cut -f1)"
  41.   xinput --enable "$(xinput|grep "Elan Touchpad"|cut -d\= -f2|cut -f1)"
  42. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement