I run this command to allow me to move windows between screens:

xrandr --auto

This magic command fixes my screen for me (before I run this my 2nd monitor is just an empty space where I can move my mouse). How can I make whatever this command does stick when I reboot? I'm more interested in fixing my configuration than just re-running this command, but I'm clueless as to how to make this happen.

I have 2 monitors, DFP 5 and DFP 6. Running xrandr results in this:

DFP1 disconnected (normal left inverted right x axis y axis)
DFP2 disconnected (normal left inverted right x axis y axis)
DFP3 disconnected (normal left inverted right x axis y axis)
DFP4 disconnected (normal left inverted right x axis y axis)
DFP5 connected 1680x1050+1680+0 (normal left inverted right x axis y axis) 474mm x 296mm
   1680x1050      60.0*+
   1400x1050      60.0  
   1280x1024      75.0     60.0  
   1440x900       60.0  
   1280x960       75.0     60.0  
   1280x800       75.0     60.0  
   1152x864       60.0     75.0  
   1280x768       75.0     60.0  
   1280x720       75.0     60.0  
   1024x768       75.0     60.0  
   800x600        75.0     60.3  
   640x480        75.0     59.9  
DFP6 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 474mm x 296mm
   1680x1050      60.0*+
   1400x1050      60.0  
   1280x1024      75.0     60.0  
   1440x900       60.0  
   1280x960       75.0     60.0  
   1280x800       75.0     60.0  
   1152x864       60.0     75.0  
   1280x768       75.0     60.0  
   1280x720       75.0     60.0  
   1024x768       75.0     60.0  
   800x600        75.0     60.3  
   640x480        75.0     59.9  
CRT1 disconnected (normal left inverted right x axis y axis)

I have already set up DFP 6 to be right of DFP 5 using the Displays menu in debian. Here is my xorg.conf file:

Section "ServerLayout"
        Identifier     "aticonfig Layout"
        Screen      0  "aticonfig-Screen[0]-0" 0 0

Section "Module"

Section "Monitor"
        Identifier   "aticonfig-Monitor[0]-0"
        Option      "VendorName" "ATI Proprietary Driver"
        Option      "ModelName" "Generic Autodetecting Monitor"
        Option      "DPMS" "true"

Section "Device"
        Identifier  "aticonfig-Device[0]-0"
        Driver      "fglrx"
        BusID       "PCI:4:0:0"

Section "Screen"
        Identifier "aticonfig-Screen[0]-0"
        Device     "aticonfig-Device[0]-0"
        Monitor    "aticonfig-Monitor[0]-0"
        DefaultDepth     24
        SubSection "Display"
                Viewport   0 0
                Depth     24
                virtual 3360 1050

It seems to be configured for everything to be one screen, and xrandr --auto somehow fixes it. Is there some way of taking a peek at what this command is doing to save the result to xorg.conf? How do you normally use xrandr to get the results to persist?

If I search for this I either get told to modify my xorg.conf file (which I don't know how to do because I don't know what xrandr --auto is actually doing) or instructions on how to run xrandr on startup, which I'm guessing isn't necessary, but I may be wrong.

  • Did you try not having xorg.conf at all?
    – phoops
    Apr 19, 2014 at 17:09
  • 1
    It won't boot if I do that (just sits with a blinking cursor in the top-left corner of the screen when it should be going into the login prompt)
    – quant
    Apr 19, 2014 at 20:14
  • @edvinas.me also, if I do that, how do I store display settings?
    – quant
    Apr 19, 2014 at 20:15

5 Answers 5


I created the following file:

/etc/X11/Xsession.d/45custom_xrandr-settings and placed this line into it:

xrandr --output DFP6 --primary

This had the effect of making the correct monitor the primary one, and it launches on login.

  • Note to self: BunsenLab (Lithium, derived from Debian 10), put my xrandr-line (as tested with ARandR Screen Layout Editor) in my home/.xsessionrc and it is called on each login. Oct 23, 2021 at 22:32

Since this is the fglrx driver, you can use the aticonfig command to generate an xorg.conf file. From your xrandr output I'm guessing the command you need is this:

sudo aticonfig --initial=dual-head --screen-layout=left

If this doesn't give you what you want, aticonfig will automatically back up your xorg.conf file (with a .fglrx-x extension), so you can easily restore the original configuration.

If you don't have any luck with aticonfig, there is a GUI tool configuring xorg.conf called amdcccle (should be in the fglrx-control package).

  • 1
    er... Well I couldn't get aticonfig to work so I installed fglrx-control as you suggested. Now everytime I boot I get an extra copy of all my menu items. I don't know hot to explain it, but right now I've got Applications Menu 3 times across the top, next to 3 copies of the date and time and my on the right my name 3 times. Also there is a black bar between the menu items and where my desktop starts. Any ideas?
    – quant
    Apr 19, 2014 at 21:30
  • Meanwhile my xorg.conf file has grown quite large... I've got 2 device, 2 screen and 4 monitor sections (I've got 1 graphics card and 2 actual monitors on my desk).
    – quant
    Apr 19, 2014 at 21:32
  • @ArmanSchwarz, please add the new xorg.conf to the Q then ping me (just another comment here) and I will take a look.
    – Graeme
    Apr 19, 2014 at 21:34
  • I just wiped my xorg.conf file back to what it was in the OP, so I don't know what it was. I've since restarted and I still have the same problem, so whatever the control centre did it's not an xorg.conf thing. The dual monitor setup works fine though, now it's just the issue of Gnome being completely destroyed. Is it possible that some settings elsewhere are being meddled with? I distinctly remember having a monitors.xml file which I modified, but it seems to be gone now...
    – quant
    Apr 19, 2014 at 22:05
  • 1
    @ArmanSchwarz, sounds like Gnome has just got itself confused somehow. amdcccle shouldn't change anything other than xorg.conf (although it is hard to tell since it is closed source). Try doing your xrandr --auto again. If that doesn't fix it I would poke around inside Gnome settings (probably it has added the extra items and you can just remove them again). Failing that you could try resetting the Desktop - askubuntu.com/a/362579 (adding new user and logging in as them is another good way to non-destructively test if this will work).
    – Graeme
    Apr 19, 2014 at 22:26

Run it with a boot script.

Part 1:

Create a directory for scripts... this can be anything and anywhere, just remember the location if you deviate so you can substitute it in.

mkdir ~/Scripts

You can use any text editor you are comfortable using for the next part

gedit ~/Scripts/setoutput.sh

Add these to the script #!/usr/bin/env sh xrandr --auto

I use "xrandr -s 1440x900" Save/close the file. Finish up by running the following commands:

chmod +x ~/Scripts/setoutput.sh
sudo ln -s ~/Scripts/setoutput.sh /etc/X11/Xsession.d/45setoutput

"reboot" may need replaced with "shutdown -r now"

When the system boots, your settings should have run, making them now persistent as long as the script exists.

Thanks in part to "xenopeek" for their post on Tue Nov 01, 2011 7:02 am at Linuxmint which provided directions for doing this with "xrandr --output VGA-0 --primary". Same base concept/script even if the command changed slightly.


How to make xrandr setting presistent

If you don't see your desired resolution in gnome settings:

Do these but change 1600 and 900 as you wish:

  1. cvt 1600 900

command output: # 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz Modeline "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync

  1. xrandr --newmode [output of line 1 after the word modeline]

command: xrandr --newmode "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync

  1. xrandr --addmode 1600x900_60.00
  2. sudo gedit /etc/X11/Xsession.d/45custom_xrandr-settings
  3. Add step 2 and 3 commands in file of step 4 and save
  4. Reboot and test.

As @quant said it loads after log in. And worked for me too. But different scenario. Thanks @quant.


  1. Display monitor: HP EliteDisplay E201
  2. Graphic: Xeon E3-1200 (CPU Based no graphic card)
cvt 2560 1080 600
# copy output, minus 'Modeline'
xrandr --newmode "2560x1080_60.00"  230.00  2560 2720 2992 3424  1080 1083 1093 1120 -hsync +vsync
xrandr --addmode HDMI1 "2560x1080_60.00"
xrandr --output HDMI1 --mode 2560x1080_60.00 --rate 50.0
xrandr --output eDP1 --mode 1920x1080 --rate 60.0

check xrandr to see your HDMI number and eDP1 (which is my internal screen laptop) add these lines to sudo gedit /usr/sbin/lightdm-session

#Purge xorg, xserver-* nvidia*
#Install online xorg and xserver-xorg
#Install nvidia-settings and nvidia-prime

#unity --replace
  • 3
    What do youmean by -xrandr?  What does any of this mean? Please do not respond in comments; edit your answer to make it clearer and more complete.
    – Scott
    Jan 17, 2018 at 3:04
  • The command xrandr should not be prefixed with a - I think. Mar 28, 2021 at 12:12
  • also everything you're suggesting to add to the lightdm-session file is commented out. also, this assumes an nvidia driver, which wasn't called for in the OP. Jun 2, 2021 at 20:53

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.