NoPaste

RotateScreen

von Drahtseil
SNIPPET_DESC:
Dreht den Bildschirm und den Touchscreen
SNIPPET_CREATION_TIME:
22.09.2012 13:01:17
SNIPPET_PRUNE_TIME:
Unendlich

SNIPPET_TEXT:
  1. syntax_error=0
  2. orientation=0
  3.  
  4. current_orientation="$(xrandr -q --verbose | grep 'connected' | egrep -o  '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
  5. case $current_orientation in
  6.         normal)
  7.                 current_orientation=0
  8.         ;;
  9.         left)
  10.                 current_orientation=1
  11.         ;;
  12.         inverted)
  13.                 current_orientation=2
  14.         ;;
  15.         right)
  16.                 current_orientation=3
  17.         ;;
  18. esac
  19.  
  20. if [ $current_orientation -eq 0 ]; then
  21.         orientation=1
  22. fi
  23.  
  24. if [ $current_orientation -eq 1 ]; then
  25.         orientation=0
  26. fi
  27. method=evdev
  28.  
  29. # LENOVO S10-3t CHANGE ==> Hard Coded my device number to 11!!!!!!!!
  30.  
  31. device=11
  32.  
  33. swap=0
  34. invert_x=0
  35. invert_y=0
  36. real_topx=0
  37. real_topy=0
  38. real_bottomx=4020
  39. real_bottomy=4020
  40.  
  41. case $orientation in
  42.         0)
  43.                 swap=0
  44.                 invert_x=0
  45.                 invert_y=0
  46.                 topx=$real_topx
  47.                 topy=$real_topy
  48.                 bottomx=$real_bottomx
  49.                 bottomy=$real_bottomy
  50.         ;;
  51.         1)
  52.                 swap=1
  53.                 invert_x=1
  54.                 invert_y=0
  55.                 topx=$real_topx
  56.                 topy=$real_topy
  57.                 bottomx=$real_bottomy
  58.                 bottomy=$real_bottomx
  59.         ;;
  60.         2 )
  61.                 swap=0
  62.                 invert_x=1
  63.                 invert_y=1
  64.                 topx=$real_topx
  65.                 topy=$real_topy
  66.                 bottomx=$real_bottomx
  67.                 bottomy=$real_bottomy
  68.         ;;
  69.         3 )
  70.                 swap=1
  71.                 invert_x=0
  72.                 invert_y=1
  73.                 topx=$real_topx
  74.                 topy=$real_topy
  75.                 bottomx=$real_bottomy
  76.                 bottomy=$real_bottomx
  77.         ;;
  78. esac
  79.  
  80. if [ $method = "evdev" ]; then
  81.         xinput set-prop "$device" "Evdev Axes Swap" $swap
  82.         xinput set-prop "$device" "Evdev Axes Swap" $swap
  83.         xinput set-prop "$device" "Evdev Axis Inversion" $invert_x $invert_y
  84.         xinput set-prop "$device" "Evdev Axis Calibration" $topx $bottomx $topy $bottomy
  85.  
  86.         if [ $orientation = 2 ]; then          
  87.                 xrandr -o inverted
  88.         fi
  89.         if [ $orientation = 0 ]; then
  90.                 xrandr -o normal
  91.         fi
  92.         if [ $orientation = 1 ]; then        
  93.                 xrandr -o left
  94.         fi
  95.  
  96. fi
  97.  
  98. #

Quellcode

Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN