1

Recently I've installed Ubuntu 16.04 on Lenovo ThinkPad X230 Tablet. It works just great! I'm experiencing only two minor problems, both are wired with the convertible screen. This one, that annoys me is the subject of this question.

When I login to Unity the display orientation goes to portrait view mode. So, I must press the screen rotation button to get back to landscape view mode.

The default view within LightDM is landscape. The problem doesn't exist when I unlock Unity, only when I log into. This problem doesn't exist when I login to Gnome. But primary I'm using Unity, so my question is: How do I force Unity to stay in landscape view mode immediately after logging into?

Update 1:

Update 2:

  • The original title: How do I force Unity to stay in landscape view immediately after logging into?
1

Finally I managed to understand where the problem comes from:

  • The tablet has a builtin screen rotation button. I haven't set up anything about this button. It is working by default with Unity/Gnome.

  • When I press this button the screen is clockwise rotated and the current screen orientation is stored in the file ~/.config/monitors.xml. This file doesn't exist unless this button is pressed, thus in the guest-session (as it mentioned in the question) the problem doesn't exist.

  • I don't have an idea which "feature" creates this file when I'm pressing the button.

  • When I'm logging-out, "something" edits the file ~/.config/monitors.xml (if it exists) and changing the orientation on random pricipal. Maybe "it" attempt to turn the orientation back to normal, but "it" doesn't work properly. And this is the issue.


To fix this for a certain user, just add the following Cron job - crontab -e:

@reboot sed -i 's#<rotation>.*</rotation>#<rotation>normal</rotation>#' "$HOME/.config/monitors.xml" >/dev/null 2>&1
  • Replace normal with your desired orientation.
  • This command will substitute <rotation>something</rotation> with <rotation>desired value</rotation> within the file ~/.config/monitors.xml.

Unfortunately this workaround will fix the problem only when you start or reboot the system. When you log-out and log-in the problem may appear again. To fix this you can add your xrandr command in the Startup Applications.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.