How to set my monitor as my default display?

Hello all, I’m using OpenSuse 13.1. I have a notebook (resolution 1366x768) and I connect it to a 17" monitor (resolution 1920x1080) using a HDMI connector. I am able to switch screens pressing Fn+F1 twice and everything works fine (notebook screen turns off and monitor becomes the only screen as 1920x1020). The problem is that everytime I reboot I have to press Fn+F1 twice in the login manager (I guess it’s GDM). I already tryed to add this line to /etc/rc.d/boot.local but it has no effect:

xrandr --output HDMI1 --mode 1920x1080

It’s strange because I am able to change my resolution using xrandr. Here is my current output for xrandr:

$ xrandr --current
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 32767 x 32767
LVDS1 connected (normal left inverted right x axis y axis)
   1366x768       60.0 +   40.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 290mm
   1920x1080      59.9*+   60.0     60.0     50.0     59.9  
   1920x1080i     60.1     50.0     60.0  
   1680x1050      59.9  
   1280x1024      75.0     60.0  
   1152x864       75.0  
   1280x720       60.0     50.0     59.9  
   1024x768       75.1     60.0  
   832x624        74.6  
   800x600        75.0     60.3     56.2  
   720x576        50.0  
   720x480        60.0     59.9  
   640x480        75.0     60.0     59.9  
   720x400        70.1  
DP1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

How do I set my 17" monitor to be the default display everytime I boot my notebook and it’s connected to it?

not strange at all – boot.local is run before the DM brings up the display server (X)

Oh, I didn’t know that. But where should I put this command, then?

Create an executable script within the user’s ~/.config/autostart/ directory.

Actually, this method won’t work directly. It is necessary to create a .desktop file, and call the script from it.

As a KDE user, I have used ~/.kde4/Autostart/ to do this in the past. (Other DE’s have equivalent ‘autostart’ locations.)

I haven’t tryed yet, but either way I think it won’t work. The path “~/” will only be determined after a successful login, right? By that time I would have already set my monitor as my display, because I need it to perform the login. After the login I don’t need the monitor to be set once again as my display, it has already been done manually.

I need this command to be executed before the login manager appears (or else I can’t login), thus I need it to be executed before any user has been authenticated and before any “~/” path has been defined.

Yes, that is correct. If you need it to occur earlier, you could try adding the xrandr command to /etc/X11/xinit/xinitrc instead, right where it says

# Add your own lines here...

Bear in mind that as KDM/GDM initialises, some settings are auto-detected again, so for example if a display resolution is set here, it won’t persist, and the xrandr command has to be set again after login (via autostart script or similar). In your case, it should set the primary display before login.

The alternative method would be to use the Xorg config files to do the same as outlined here:

  • The example there shows how to set display resolution and set primary display.

I added that command to /etc/X11/xinit/xinitrc but it didn’t work, I’m losing hope :frowning:

Try setting it via Xorg configuration files. You can create /etc/X11/xorg.conf, or use the newer /etc/X11/xorg.conf.d/ config files…

Could placing the command inside a .bashrc file work? I did pass a similar command, related to a resolution issue I had, using either that method or from a .bash_profile file, can’t remember which but it worked well enough.


xrandr --output HDMI1 --mode 1920x1080 &

No, that’s not the issue. The OP was trying to identify a method that would be invoked prior to login, (but AFAIK once login has commenced the screen layout is re-initialized again by the desktop environment.

OK I see, but after X has started? What about /etc/rc.d/after.local, just a guess but might work?
Pointing to a script invoking the screen if present; I’m on thin ice here, though.

Use the DM’s facilities to accomplish what you want. Example: with KDM, add it to the XDM Xsetup script… GDM offers something similar … as does LightDM …

Which bashrc file, from my home directory?

Just create one, and it is the same with .bash_profile. But look at deano_ferrari’s comment on this suggestion, I misunderstood the issue.

What I did is to select the HDMI “toggle primary output” (star) option from applications/configure desktop/Display Configuration.
I also have set the Energy saving settings to turn off the screen of the laptop when I close the lid (i keep it closed when I work. I hope that will help!

That only takes effect after the user has logged in. The OP wanted to make the primary monitor defined before login.

But is this setting permanent? Where is “applications/configure desktop/Display Configuration” exactly? Which desktop manager are you using? I don’t seem to have this option (I use cinnamon).


Where is “applications/configure desktop/Display Configuration” exactly? Which desktop manager are you using? I don’t seem to have this option (I use cinnamon).

That’s for KDE. (“Configure Desktop” is KDE’s configuration application, also known as “Systemsettings”)

I don’t know Cinnamon, but as it is a fork of GNOME, it should have something similar as well in its control center (or whatever it’s called in Cinnamon).
But please bear in mind, that this only applies to the user session anyway. It has absolutely no effect to the login screen.