Ubuntu GNOME 16.10 screen orientation spontaneously changes

I have an HP Envy notebook, not a touch device/tablet so it should not adjust screen orientation to suit how I hold the device. However, the orientation seems to randomly and spontaneously change, both when I am using the device, and while it wakes from suspend. There is no pattern to which orientation it switches to; sometimes it rotates, sometimes it flips.

xrandr -o normal

correctly re-orientates the screen, but it would obviously be nice if I did not have to keep doing this.


Solution 1:

You can lock the rotation of the screen using the second icon in the top-right menu. The icon looks similar to the icon used for screen rotation in mobile OSes like Android.

In order to disable the functionality permanently (desirable if you do not have a touchscreen :-) ), you can do that by setting dconf-key active in org.gnome.settings-daemon.plugins.orientation to false using either gsettings (CLI) or dconf-editor (GUI).

gsettings set org.gnome.settings-daemon.plugins.orientation active false

In later versions

gsettings set org.gnome.settings-daemon.peripherals.touchscreen orientation-lock true

After logging out and in again, the the button should no longer be there and your screen's orientation should stay as it is.