Skip to content

Instantly share code, notes, and snippets.

@jjrh
Created July 23, 2013 15:20
Show Gist options
  • Save jjrh/6063218 to your computer and use it in GitHub Desktop.
Save jjrh/6063218 to your computer and use it in GitHub Desktop.
Rotates your screen remembering the last position.
#!/bin/sh
check_file="/home/jjrh/scripts/rotation_status"
screen="HDMI1"
#if the rotation file doesn't exist create it and assume normal.
if [ ! -e $check_file ]
then
touch $check_file
echo "normal" > $check_file
fi
if [ $(cat $check_file) = "left" ]
then
xrandr --output $screen --rotate normal
echo "normal" > $check_file
elif [ $(cat $check_file) = "normal" ]
then
xrandr --output $screen --rotate left
echo "left" > $check_file
else
echo "you probably got garbage that isn't 'left' or 'normal' in your file!"
# echo "normal" > $check_file # uncomment to initialize the file.
# ./rotate.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment