I have two monitors working just right with nvidia driver.
There are times, however, where I want to have just one monitor and other times where I need two: I must open NVidia XServer Settings, go to the XServer Display Configuration and change the second monitor from TwinView to Disabled (and vice-versa).
Is there a way to just toggle that? For example having a shortcut on desktop and/or on the Unity dock? Maybe is there a way to configure a keyboard shortcut to achieve this?
P.s.: I'm using 11.04 with Unity and, of course, Compiz.
Have you tried using xrandr? I have three tiny executable scripts which I access with hotkeys. These switch between 1) laptop screen only, 2) monitor only 3) extended desktop across both. You might need to adjust them for your own uses.
#!/bin/bash xrandr --output LVDS1 --auto --output VGA1 --off
#!/bin/bash xrandr --output LVDS1 --off --output VGA1 --auto
#!/bin/bash xrandr --output VGA1 --primary --output LVDS1 --auto --left-of VGA1
Install
disper
by clicking here or typesudo apt-get install disper
in a terminalCreate a new launcher by right clicking on your desktop and selecting "Create Launcher..." Set the name to whatever you want, and the Command to
disper -d auto -e
Click Ok
Whenever you plug in or unplug your external monitor, just double click the launcher icon.
To toggle display modes I used disper
then I added this python script, that is the indicator the better suits my needs, to my auto-run list.
To use that python script:
sudo ln -s /home/foo/disper_ind.py /usr/bin/disper_ind.py
python /usr/bin/disper_indicator.py
Open up display preferences:
Once you've got it open, click the monitor you want to turn off (in this example the 19"), and toggle the "On" switch to "Off". Then, hit apply. Your monitor of choice is turned off.
Then, you'll get a little dialog box that says "Hey, you've made some changes to your monitor setup. So, do you want to keep them?" - select "Yes" if you're happy with the new setup.
To revert it, just go in, select the monitor that's turned off and toggle it to "ON", then apply your changes and verify that everything looks ok.
I find that sometimes when I unplug a screen my desktop icons, and therefore the Detect screens launcher I built according to @jfoucher suggestion isn't visible anymore. So that's useless. But to make life easier, you can add custom keyboard shortcuts that run commands, let me show you how!