Ok i am now struggling with this problem since a few days. My problem is i am not able to save the current monitor settings, to apply / save after a reboot.

I have 3 monitors and want to mirror 2 of them but not the third. I can do this with the nvidia-settings gui tool or with calling a bash script which uses xrandr. I am not able to do this by moving my monitor on the other in the gnome / debian display settings menu - here i can only put them next to each other but am not able to "only" mirror two of them (i can mirror all but i don't want that). The above mentioned script is able to do this for me (using xrandr) - and now i am looking for the right place to put it in. I am using gdm3 and tried to put it at the start (xor) end of the /etc/gdm3/Xsession file -> did not help. I also created a ~/.xprofile file and put it there -> did not help. The script is executable for each group. And i added a line to create a new file in my home directory to check if it was called. It was in every of the above mentioned cases but did not set my monitor settings to mirror the two.

So what should i do? I googled and googled and googled and read and read but did not find any solution.

I hope someone here can help me.

P.S. using debian 8 jessie, nvidia proprietary driver, gdm3, gnome

and this is my script:

xrandr --output DVI-D-0 --mode 1920x1080 --pos 1440x0 --rotate normal --output HDMI-0 --mode 1920x1080 --pos 1440x0 --rotate normal --output DVI-I-1 --off --output DVI-I-0 --mode 1440x900 --pos 0x180 --rotate normal --output DP-1 --off --output DP-0 --off

this script works fine and was generated by arandr. I have saved it in /usr/share/.

TL;DR The script works fine when run manually and it also gets invoked when put in the /etc/gdm3/Xsession or ~/.xprofile. But the monitor setup is not set correct after boot. Only when i run the script manually after everything finished (loading).

  • just to clarify, if you invoke your script after login, it does correctly set your monitor settings? – Frank Thomas Mar 2 '16 at 19:26
  • yes - i only need a place where to put it in so it does this autom. on startup. In the Xsession, initrc or somewhere but i had no luck so far... – TryToSolveItSimple Mar 2 '16 at 21:52

The behaviour you find is to be expected. Xrandr is...

xrandr -- primitive command line interface to RandR extension

which implies it will work after Xorg has loaded the RandR extension, not before. You might be able to specify the configuration you desire in the file /etc/X11/xorg.conf, but that may be a waste of time, since DEs tend to impose their order onto our screens. For instance, KDE is notoriously resistant to user-defined monitor configurations.

What are your options?

  1. Try to save your current configuration for future sessions. You can find on this Unix & Linux post several ways to do that. Keep in mind that the bug mentioned in the Web page is now closed.

  2. Run the script every time you login graphically. For instance, you could put the following code into your .bashrc file:

    if [[ $TERM != "linux" && "x$SSH_CLIENT" == "x" ]]
       xrandr --output DVI-D-0 --mode 1920x1080 --pos 1440x0 --rotate normal --output HDMI-0 --mode 1920x1080 --pos 1440x0 --rotate normal --output DVI-I-1 --off --output DVI-I-0 --mode 1440x900 --pos 0x180 --rotate normal --output DP-1 --off --output DP-0 --off
  • i already tried the way with the xorg.conf but this didn't help (did not mention this above because i already thought that my DE would override this / don't use it). The frist option reads like it would save all my current session settings which would include my opened windows- i don't want this to happen. So i'll try the second one - thanks – TryToSolveItSimple Mar 3 '16 at 12:48
  • it works with the .bashrc -> but my script which uses xrandr gets called very late -> around 30 seconds after i logged in. Is there another option? Maybe a standard way with gnome? In the display manager from gnome i see all my 3 monitors but am not able to mirror only two of them (can only mirror all of them). – TryToSolveItSimple Mar 3 '16 at 13:00
  • @TryToSolveItSimple No, there is no other standard place, you have tried them all. The standard place would be /etc/gdm, but you said it does not work. You can read here, wiki.archlinux.org/index.php/xrandr, about all these places, but, again, you have already ruled them out. .bashrc file is your last chance. – MariusMatutiae Mar 3 '16 at 15:35
  • ok... that's sad. I will use your solution. Maybe one day i find out why setting it in the /etc/gdm3/Init/ or /etc/gdm3/PostLogin does not work - there should be another script which overrides my settings i think. – TryToSolveItSimple Mar 3 '16 at 18:37

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.