2

I've tried numerous methods of getting the following commands to run at startup

xrandr --output DFP10 --rotate left
xrandr --output DFP11 --right-of DFP10

This is necessary because my left monitor is portrait. When I launch Ubuntu Gnome 14.04.2,it sets DFP10 (the portait monitor which is on the left) to be on the right, and does not rotate it to portait).

I have tried putting a script in /etc/rc.local & usr/share/applications, adding the command to startup applications in the form: xrandr --output DFP10 --rotate left && xrandr --output DFP11 --right-of DFP10.

None of these work. Yet, I know that the commands work, if I run them myself in terminal.

Here's some background the situation, that i think might be relevant:

I'm definitely not an expert on this. I know that there a bunch of different config files for editing display options. xorg.conf, xorg.conf~ (a backup), xorg.conf.fglrx-0 and xorg.conf.fglxr-0~ (backup) all exist within /etc/X11 but editing them does not solve my problem.

The situation involving the display driver is fairly complex. I'm running the latest fglrx-updates on my AMD R9 280X, which took some work... I have used a workaround for installing the driver on 14.04.2 (necessary due to bug with LTS Enablement Stacks)

TLDR; how do I make this: xrandr --output DFP10 --rotate left and this xrandr --output DFP11 --right-of DFP10 run at startup?

thanks in advance

Jacob Vlijm
  • 83,767
Yunolan
  • 23
  • I forgot to add: monitors.xml has also been edited. Perhaps all these config files are conflicting? – Yunolan Apr 15 '15 at 07:16

1 Answers1

3

What you usually need to do in these situations is adding a small break in the command after login. Add this to your Startup Applications:

/bin/bash -c "sleep 15&&xrandr --output DFP10 --rotate left && xrandr --output DFP11 --right-of DFP10" 

(If that is the normally working command)

The reason is that most likely the command is performed too early, while the desktop is still loading. It will break then.

You can experiment a little with the sleep 15 duration to see what is needed or possible.

Jacob Vlijm
  • 83,767
  • Hi. as much as that should work, it hasn't. i understand why you did the sleep 15, but i'm not sure what the /bin/bash -c does – Yunolan Apr 15 '15 at 09:26
  • @JoeThorpe Try increasing the time, it really should work if the command: xrandr --output DFP10 --rotate left && xrandr --output DFP11 --right-of DFP10 is working from the terminal after login. The /bin/bash is to make it work in the created .desktop file. Startup Applications creates a .desktop file in ~/.config/autostart. The mixed command makes the /bin/bash necessary in shell commands, run from a .desktop file. – Jacob Vlijm Apr 15 '15 at 09:32
  • @JoeThorpe could you post the output of xrandr somewhere? Likely it takes some time for the system to recognize the second screen. In that case a script to "wait" for the screen before taking action would synchronize the process. Else please set the sleep 15 to (e.g.) sleep 100, decreasing until you got the right waiting time. Really, I am pretty sure. – Jacob Vlijm Apr 15 '15 at 12:34
  • Hi, apologies for not getting back to you sooner. I tried sleep 40, but i will try sleep 100. Where do i find the output of xrandr? i googled it, but understandably, the results were talking about display outputs.. – Yunolan Apr 15 '15 at 23:06
  • @JoeThorpe No problem :) just open a terminal window and type xrandr and press return. – Jacob Vlijm Apr 16 '15 at 04:32
  • Output of xrandr is below (google drive link): https://docs.google.com/document/d/1PjpVxf2jD6o1JQSTl34WbjwiaHQhBpw_0IDYsof-gHk/edit?usp=sharing – Yunolan Apr 16 '15 at 06:36
  • @ Jacob Vlijm Sleep100 worked! as you said, it just needs to wait a bit. I'll fine tune the time a little bit more. For completion's sake, here is the output of "xrandr": http://imgur.com/LxwQdQc – Yunolan Apr 16 '15 at 06:45
  • @JoeThorpe One thing, if you think the answer solves the problem, would you consider accepting it? (the big "V" on the left, below the up/down arrows). It also makes clear the question is "answered". – Jacob Vlijm Apr 16 '15 at 07:50
  • 1
    Oh yes, sorry i forgot about that. Thanks for your help, and your answer is marked as so! – Yunolan Apr 16 '15 at 08:05