Friday, February 6, 2015

Rotating display in Ubuntu and Linux Mint - I


Just as in windows you have the option to rotate your screen into any direction in Linux, too. While in windows there are some shortcut keys, a key combination is not configured in Linux by default. But you can do the same thing using some terminal commands.

Find the Screen label

Before rotating a screen, first thing that you need to do is to identify how the screen has been labeled that you want to rotate. xrandr -q is the command that can provide that info. Running on my system gives below output:
Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 32767 x 32767
eDP1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1366x768       60.1*+
   1360x768       59.8     60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
DP1 connected primary 1920x1080+1366+0 (normal left inverted right x axis y axis) 521mm x 293mm
   1920x1080      60.0*+
   1680x1050      60.0  
   1600x900       60.0  
   1280x1024      75.0     60.0  
   1440x900       59.9  
   1280x800       59.8  
   1152x864       75.0  
   1280x720       60.0  
   1024x768       75.1     70.1     60.0  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   640x480        75.0     72.8     66.7     60.0  
   720x400        70.1  
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
I have two monitors. First one is labeled as eDP1 and second one is labeled as DP1.

Rotate Monitor

Determine the monitor that you want to rotate here from previous command output. Next, we want to rotate it around. For that, we use one of the following commands:
xrandr --output eDP1 --rotate right
xrandr --output eDP1 --rotate left
xrandr --output eDP1 --rotate inverted
xrandr --output eDP1 --rotate normal
Replace eDP1 with your monitor label in above commands and you'll be able to rotate the screen.
In next post I'll show you how you can create a bash script to do the same thing in an easy way.