I use Ubuntu 11.04 on a laptop. I have three monitor configurations:

  • Work: disable laptop monitor, use external 1920 X 1200 monitor
  • Home: disable laptop monitor, use external 1680 x 1050 monitor
  • Other: just laptop monitor

I use NVIDIA X Server settings to switch between monitor configurations.

  • The ideal situation would be that the monitor configuration could be activated based on what external monitor was plugged into the laptop.
  • Another reasonable option would be to have a shortcut key that toggled between the three laptop configurations (or perhaps three shortcut keys, one for each configuration).


  • How can I more simply switch between monitor configurations?

Initial thoughts

  • A user asked about automatic switching of monitor configurations on ubuntu forums with some more suggestions here
  • I thought there might be some way of using a shortcut key to manipulate the xorg.conf file.

Try Disper, it's got some potential. I am still figuring it out but it will definitely do what you described. I don't think auto-switching is a realistic option yet, but Disper with a keyboard shortcut is worth trying out.

|improve this answer|||||

If you're using xorg.conf for your setup, this inelegant, but simple solution has worked for me:

Create a separate configuration file for each setup, which you will put in /etc/X11. Name them something like this:

  • xxorg.conf.work
  • xxorg.conf.home
  • xxorg.conf.single

(The double exes will prevent the server from spontaneously deleting the files)

Then create three simple shell scripts and put them in /usr/local/bin. Name them something like:

  • display.work
  • display.home
  • display.single

An example of the contents of one of the files looks like this:

  • "#!/bin/sh"
  • cp -f /etc/X11/xxorg.conf.work /etc/X11/xorg.conf
  • echo "Display is set for WORK"
  • echo "You must restart the display manager for settings to take effect."

To use these scripts, assuming you've booted up and are looking at the wrong display--

  • Press Ctrl-Alt-F2 to bring up a non-graphical shell.
  • log in
  • as root, (su or sudo, depending on your system) run the desired script.
  • restart your X server

Yes, it's not as nice as plug and play would be, but it's pretty quick and painless nonetheless.

|improve this answer|||||

As @JE2Tom suggested, Disper was able to do the job. For those interesed, this is what I did.

  • I installed Disper for Ubuntu

  • I then used CompizConfig - General - Commands to create shortcut keys for the two commands that i wanted:

    • disper -s activates just the primary monitor
    • disper -S activates just the secondary monitor
|improve this answer|||||

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.