Ubuntu – How to rotate the display in the most easy way


I am the lucky owner of a pivot monitor, which screen can be rotated (physically). What is the easiest way to make my display turn when I turn my monitor?

For the moment I first launch the 'Displays' app, and then change the settings and confirm. But this is in fact quite a laboured procedure, since I want to switch my orientation up to a few times per minute.

So is there an indicator for this, or equivalent? Can I set a keyboard shortcut that would launch a dedicated command? In fact I am thinking of something similar to the Windows program iRotate.

Best Answer

Go into Keyboard -> Shortcuts, select "Custom Shortcuts", and press "+" to add a new shortcut.

"Name" is a descriptive name for the action (i.e. "Rotate monitor"). In "Command" type the custom command to run when the shortcut is activated.

Once the shortcut is in the list, select its row, press ENTER, then the key combination you want to activate the shortcut. If there's a conflict, the shortcut manager will tell you so, and you can choose a different combination.

You can have shortcut to enable rotated display and another to bring it back to an upright position. You can even, if you're knowledgeable enough, write a command that maintains state and just toggles between upright/rotated.

Now, as for the command you need to use, it's probably xrandr:

xrandr --output HDMI1 --rotate left

xrandr --output HDMI1 --rotate normal

The output parameter depends on which port your monitor is plugged into. To see what you currently have, type:

xrandr -q

Mine says:

Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   1366x768       60.0*+
   1360x768       59.8     60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)

In this case my --output would be LVDS1, as all the others are disconnected.

Related Question