UFFICIALE L'OT di Linux e altri OS

Pubblicità
script per ruotare lo schermo di 90° ogni volta che viene eseguito (solo in sessione xorg):
Codice:
#!/bin/bash

case $(xrandr | sed -n '2p'| awk '{print $5}') in

left)
 xrandr -o normal && xinput set-prop "SYNA2B23:00 06CB:2714" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
  notify-send --icon computer 'Rotazione schermo' "Orientamento = NORMALE" ;;
right)
 xrandr -o inverted && xinput set-prop "SYNA2B23:00 06CB:2714" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
 notify-send --icon computer 'Rotazione schermo' "Orientamento = INVERTITO" ;;
inverted)
 xrandr -o left && xinput set-prop "SYNA2B23:00 06CB:2714" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
   notify-send --icon computer 'Rotazione schermo' "Orientamento = SINISTRO" ;;
*)
 xrandr -o right && xinput set-prop "SYNA2B23:00 06CB:2714" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
   notify-send --icon computer 'Rotazione schermo' "Orientamento = DESTRO" ;;
esac
 
Edit: con
Codice:
case $(xrandr | grep -w connected | awk '{print $5}')
lo script funziona con qualsiasi schermo connesso.
 
script per ruotare lo schermo di 90° ogni volta che viene eseguito (solo in sessione xorg):
Codice:
#!/bin/bash

case $(xrandr | sed -n '2p'| awk '{print $5}') in

left)
 xrandr -o normal && xinput set-prop "SYNA2B23:00 06CB:2714" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
  notify-send --icon computer 'Rotazione schermo' "Orientamento = NORMALE" ;;
right)
 xrandr -o inverted && xinput set-prop "SYNA2B23:00 06CB:2714" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
 notify-send --icon computer 'Rotazione schermo' "Orientamento = INVERTITO" ;;
inverted)
 xrandr -o left && xinput set-prop "SYNA2B23:00 06CB:2714" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
   notify-send --icon computer 'Rotazione schermo' "Orientamento = SINISTRO" ;;
*)
 xrandr -o right && xinput set-prop "SYNA2B23:00 06CB:2714" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
   notify-send --icon computer 'Rotazione schermo' "Orientamento = DESTRO" ;;
esac
oki :P
Sotto esac buttaci un exit 0 così lo script termina con grazia. :P
Per bash in genere leggo questo bashporn - Per sed e altro leggo questo sedporn dove trovi accenni su altri comandi, tenendo presente la differenza fra i vari linguaggi. Dalla Home molte pagine risultano off-line, ma se si sfruga su Progetti o sulla colonna di destra, si apre un mondo tra guide e quant' altro.
Spammo un po' va... al limite mi banneranno (fortuna ho già creato nel tempo sette-otto account :ops:). :P
 
Ultima modifica:
Pubblicità
Pubblicità
Indietro
Top