View Full Version : [ubuntu] Automatically swtich between multiple monitor configurations?

March 23rd, 2011, 02:17 PM
I have a laptop that I use in three environments with different monitor setups.

1) At work, I have a 1280x1024 second monitor.
2) At home, I have a 1920x1080 second monitor.
3) In meetings and other places I have no second monitor.

Whenever I switch between these setups, which is at least several times each day, I have to manually change the monitor configuration. I use the nvidia-settings tools.

Granted, it only takes a few seconds. Is there a way to make the system smart enough to automatically detect when a monitor is added or removed, know *which* monitor is attached, and reconfigure the resolution and monitor layouts the way I want them?


March 23rd, 2011, 05:10 PM
Generally it isn't impossible to achieve that, but it requires a certain degree of co-operation between the nvidia driver and xrandr, and a bit luck.

You could set up a script which
1.) checks with "hwinfo --monitor" if certain "Unique ID"s of monitors are present (1)
2.) sets the output resolution of the present monitors with xrandr (2)
3.) arrange the monitor outputs with xrandr

You could run those script
- via the startup script of GDM (3)
- via "Startup Applications"
- manually with a launcher

- "hwinfo" is in the official repos
- http://manpages.ubuntu.com/manpages/maverick/en/man1/grep.1.html
- http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html

Good luck and don't hesitate to ask for help!