How can I toggle between single and dual monitor setup?
Solution 1
Install disper
by clicking here or type sudo apt-get install disper
in a terminal
Create 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.
Solution 2
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
Solution 3
To toggle display modes I used disper
sudo add-apt-repository ppa:disper-dev/ppa && sudo aptitude update && sudo aptitude install 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:
- download the script
- symlink it to /usr/bin (for instance if you have the script in /home/foo/disper_ind.py you have to write on terminal
sudo ln -s /home/foo/disper_ind.py /usr/bin/disper_ind.py
- open "start-up applications", click "Add" and then put as command
python /usr/bin/disper_indicator.py
Solution 4
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.
Solution 5
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!
Related videos on Youtube
Comments
-
dag729 over 1 year
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.
-
dag729 over 12 yearsI don't get the benefit of toggle via "Display Preferences" over "NVidia Settings"... that's quite the same.
-
jrg over 12 years@dag729 There isn't really a benefit, it's just that you have your question phrased in such a way that people without a NVidia card will try to google for it, find it and try to follow it. In addition, as far as I know, these instructions will work, as well as via NVidia Settings.
-
Taylor Price over 12 yearsWell then just use
disper -s
to activate only the primary display, ordisper -S
to activate only the secondary display -
dag729 over 12 yearsNice catch! Thank you for this hotkeys idea, i think I'll use it with my Archlinux-Ratpoison box.
-
Victor S about 12 yearsOn my setup this control panel does not properly detect the displays, only the Nvidia settings panel detect the displays properly. So I find this question useful in the particular answers it generated which do not involve this step here.
-
Victor S about 12 yearsThis is how I got disper to be installed, although I had to replace aptitude with apt-get.
-
cxdf almost 11 yearsDo you know why this doesn't work when executing from the shell? When it's a script it works, however, when it's from the shell, I get unable to execute binary file.
-
Sudheer over 10 years@c-qjv0xfi I think it should work from both. Are you copying and pasting the whole line (including
#!/bin/bash
? You don't want that bit when in the shell. What happens if you just typexrandr
and press enter? -
mLstudent33 over 3 yearsit does not seem to work on Ubuntu 18.04 LTS
-
Janos Vinceller over 3 yearsMy latest Ubuntu Studio did not find
disper
byapt-get
properly, so I tried your way. Perfect! I switched off my second screen and couldn't switch it on again. And I wanted to properly shutdown the OS, so I needed a way to switch back to one screen again. You can list the screen IDs by simply runningxrandr
. Then use those command up there.