Depois de perder minha tarde de domingo tentando fazer o proxy iio-sensor funcionar, fiz esse pequeno truque:
/opt/auto-rotate
:
#!/bin/bash
MODEL="Lenovo Yoga 510"
DEBUG=false # DEBUG=true or DEBUG=false
while true
do
if [ -f $X_FILE -a -f $Y_FILE -a -f $Z_FILE ];then
X_AXIS=$(cat $X_FILE)
Y_AXIS=$(cat $Y_FILE)
Z_AXIS=$(cat $Z_FILE)
else
echo "Modules seems not loaded. To activate:"
echo "To activate:"
echo "sudo modprobe iio-hwmon"
echo "sudo modprobe hid-sensor-iio-common"
echo "sudo modprobe iio_dummy"
echo "If not, sorry this is WIP..."
exit 1
fi
$DEBUG && echo "X: $X_AXIS, Y: $Y_AXIS, Z: $Z_AXIS"
if [ $X_AXIS -gt 80 -a $X_AXIS -lt 110 ];then
ORIENTATION="right-up"
elif [ $X_AXIS -gt 150 -a $X_AXIS -lt 190 ];then
ORIENTATION="left-up"
else
if [ $Y_AXIS -gt 10 -a $Y_AXIS -lt 120 ];then
ORIENTATION="normal"
else
ORIENTATION="bottom-up"
fi
fi
case "$ORIENTATION" in
right-up)
xrandr --output eDP1 --rotate right && gsettings set com.canonical.Unity.Launcher launcher-position Bottom
;;
left-up)
xrandr --output eDP1 --rotate left && gsettings set com.canonical.Unity.Launcher launcher-position Bottom
;;
normal)
xrandr --output eDP1 --rotate normal && gsettings set com.canonical.Unity.Launcher launcher-position Left
;;
bottom-up)
xrandr --output eDP1 --rotate inverted && gsettings set com.canonical.Unity.Launcher launcher-position Left
;;
esac
sleep 1
done
Para iniciar no login: Como faço para iniciar aplicativos automaticamente no login?