I added a line
xrandr --output HDMI1 --rotate right
in /etc/rc.local to rotate one of my monitors at startup, but it doesn't work (
- 153
- 1
- 1
- 7
1 Answers
When to run this command
When you run this command from /etc/rc.local, it is too early. Xrandr commands (just like commands to change keyboard and mousepad- settings) need to be run after login, with a little break.
If you run them too early, before the desktop is ready for it, they will either break, miss target or are overruled by local procedures.
To run it on login, with a little break:
If it is for one user, add the command:
/bin/bash -c "sleep 10 && xrandr --output HDMI1 --rotate right"to Startup Applications: Add to Startup Applications: Dash > Startup Applications > Add.
If it is for all users, create a file:
[Desktop Entry] Name=Set Screen Rotation Exec=/bin/bash -c "sleep 10 && xrandr --output HDMI1 --rotate right" Type=Applicationsave it as
setscreen.desktopand copy it to/etc/xdg/autostart
Note
Possibly, you can play a little withe the value of 10 seconds, to optimize for your situation. If it is for a VM, you might need to set it longer, on a regular system, it could probably be shorter.
- 85,475