Quick-switch between Extended Desktop and Surround?

Hot damn can't wait to try this out.
Your signature says you have an SLI setup. SLI appears to break the trick that this script uses.

Still... give it a try. I'd love to hear that it works for SLI users now too.
 
Your signature says you have an SLI setup. SLI appears to break the trick that this script uses.

Still... give it a try. I'd love to hear that it works for SLI users now too.

Old sig...should be a crime.

Rocking a 3930k + 670 GTX FTW now.
 
Figured you guys might want the icon I made, so I threw it up on dropbox: https://dl.dropboxusercontent.com/u/196338/Icons/Surround.ico

If you want to pin it directly to your taskbar like I did in my screenshot, there are a few steps you need to follow...

1. Pick a folder (owned by your user) to put everything. I chose "C:\Users\Username\Appdata\Roaming\Toggle"
2. Copy the batch file and icon into the "Toggle" folder.
3. Make a copy of cmd.exe and place it in the "Toggle" folder.
4. Right click your copy of cmd.exe > create shortcut.
5. Right click the new shortcut > Properties
6. Click "change Icon" and point it at Surround.ico
7. Edit the "target" field so that it points the copy we've made of cmd.exe to the batch file. It should look something like this:
Code:
"C:\Users\Username\Appdata\Roaming\Toggle\cmd.exe" /C "C:\Users\Usernae\Appdata\Roaming\Toggle\Toggle.bat"
8. Click "Apply"
9. Name the shortcut "Nvidia Surround Toggle" and drag it to your taskbar.

This works for any batch file you want to pin to the taskbar, just keep in mind that each one will needs its own copy of cmd.exe.
 
Hello All,

Finally a forum that has my same issues, and is current haha.

I am looking for the same solution everyone else here is. A better way to switch from Surround to Multiple monitors and vice versa using an SLI set up.

Before when i had just one card the win + P command worked like a charm, It remembered everything, but now that i am in an SLI set up it does not work anymore.

Has anyone gotten the script to work using an SLI set up? Or has anyone found anything from Nvidia about this? I dont understand how hard it would be to have profiles set up to switch between these, both have their pro's and con's which is why it would be so nice to switch between the two.

Any help would be appreciated here.
 
The script effectively does the same thing as Winkey + P, so if that key combo doesn't work neither will the script. The problem comes from the fact that Nvidia basically has two entirely different display spanning methods in use.

Original Nvidia Surround is what gets used on SLI setups, which uses "SLI Mosaic Mode" to spoof a single large virtual monitor to the OS. Two monitors plug into the primary card, one plugs into the secondary card, and the special SLI mode allows all three screens to fire up even though they're not all on the primary card.

Here's the rub: Nvidia doesn't support running Extended Desktop with two monitors on the primary card and one monitor on the secondary card while SLI is enabled. In order to drop to Extended Desktop when using SLI + Surround, the driver has to fully disable SLI. Display adapters get shuffled, the OS sees monitors get unplugged and re-attached, and since SLI is disabled your single-screen performance is reduced to that of a single card.

With single-card Surround, the situation is completely different. All three displays attach to one graphics card and spanning is handled internally with no shuffling of SLI modes. The driver tells the OS all displays are now duplicated/mirrored so it'll stop treating the as individual monitors, and sets you up with a virtual spanned resolution on this group of "duplicated" monitors. Winkey + P works because Windows never lost track of your configuration, as far as the OS is concerned you just told it to duplicate all monitors, so it can switch back to the old state without a problem.

It's worth noting that Nvidia's single-card Surround works in EXACTLY the same way as AMD's Eyefinity technology. The difference is, AMD also uses this method in Crossfire mode (all monitors stay attached to the primary card, no special crossfire mode, no need to disable crossfire to run Extended Desktop). This allows the WInkey + P trick to work for AMD on both single-card and multi-card Eyefinity setups.

tl,dr:
I'm sorry to say it, but you're going to have to wait for Nvidia to either redo how Surround works when SLI is active, or come up with their own in-driver method for switching between the two modes. Good news is, the latest couple of beta driver releases (326.19 and newer) have actually added hotkeys for enabling / disabling Surround (and it works in SLI). It's still a bit buggy, but they ARE working on it... finally.
 
tl,dr:
I'm sorry to say it, but you're going to have to wait for Nvidia to either redo how Surround works when SLI is active, or come up with their own in-driver method for switching between the two modes. Good news is, the latest couple of beta driver releases (326.19 and newer) have actually added hotkeys for enabling / disabling Surround (and it works in SLI). It's still a bit buggy, but they ARE working on it... finally.

So i downloaded the beta driver, and read the release notes. I see where it says they have added hot keys:

"Surround: 3D Settings->Configure Surround
Added the ability to create keyboard shortcuts for enabling/disabling Surround,
switching between triple and single-wide display resolutions, and enabling/disabling
bezel correction."

But when i go there, i dont see the ability to add those hot keys.. any help on what i might be doing wrong?
 
So after playing around with it more, and talking with Nvidia, looks like that beta driver doesnt support it. However the newest beta one does. So i installed that and played around with it. The shortcut keys still dont work :( It switches from Span displays (when going to enabled) to maximize 3d (when going to disabled) vs, switching to disable SLI.

I guess all we can do is wait for Nvidia to learn from their competitors and make Profiles, and hope that once they do that they actually work.
 
Nvidia re-worked their driver and broke my old script. Their built-in shortcut keys still don't work properly, and they have no command-line hooks for heir hotkey service (making it pretty much impossible to script this with a simple batch file).

So... I spent about 6 hours last night teaching myself how to write AutoHotkey scripts. Here's the result, pre-compiled as an exe: https://db.tt/LXsQZz8a

Save it somewhere, pin a shortcut to it on your taskbar, and you have one-click switching back (and hopefully better than ever! :D ). Make sure the Ctrl + Alt + S key-combo is enabled in the Nvidia driver control panel, otherwise this wont work.

Here's the source if you want to tinker or compile it yourself:
Code:
;==============================================================================================
; First-run configuration
;==============================================================================================
IniRead, FirstRunVar, %appdata%\NVSToggle\NVSToggle.ini, NVSToggle, FirstRun
IF (FirstRunVar = "Completed")
{
	Goto, DetectNow
}

MsgBox, 65, Nvidia Surround Toggle, To allow this application to configure itself for first-time use, please enable Nvidia Surround using the Nvidia Control Panel now. `n`nClick "OK" when ready, or "Cancel" to quit.
IfMsgBox Ok
	Goto, DoubleCheck
else
	Exit

DoubleCheck:
IF (A_ScreenWidth/A_ScreenHeight > 1.8)
{
	Goto, FirstRun
}

MsgBox, 21, Nvidia Surround Toggle, Error: Nvidia Surround is not enabled.
IfMsgBox Retry
	Goto, DoubleCheck
else
	Exit

FirstRun:
FileCreateDir, %appdata%\NVSToggle
IniWrite, Completed, %appdata%\NVSToggle\NVSToggle.ini, NVSToggle, FirstRun


;==============================================================================================
; Determine current display state
;==============================================================================================
DetectNow:
IF (A_ScreenWidth/A_ScreenHeight > 1.8)
{
	Goto, ToggleOff
}

IF (A_ScreenWidth/A_ScreenHeight < 1.8)
{
	Goto, ToggleOn
}

IF (A_ScreenWidth/A_ScreenHeight = 1.8)
{
	Goto, ToggleOn
}

MsgBox, 16, Nvidia Surround Toggle, ERROR: Failed to determine current display state.
Exit


;==============================================================================================
; Toggle-off routine (switch to Extended Desktop mode)
;==============================================================================================
ToggleOff:
Send {Volume_Mute}
WinActivate ahk_class Shell_TrayWnd
Send {LCtrl down}
Send {LAlt down}
Send {s down}
Sleep 100
Send {LCtrl up}{LAlt up}{s up}
Sleep 3500
Send {Volume_Mute}
Run %windir%\System32\DisplaySwitch.exe /extend
Exit


;==============================================================================================
; Toggle-on routine (switch to Surround mode)
;==============================================================================================
ToggleOn:
WinActivate ahk_class Shell_TrayWnd
Send {LCtrl down}
Send {LAlt down}
Send {s down}
Sleep 100
Send {LCtrl up}{LAlt up}{s up}
Sleep 3500
IF (A_ScreenWidth/A_ScreenHeight < 1.8)
{
	Goto, SurroundFail
}
IF (A_ScreenWidth/A_ScreenHeight = 1.8)
{
	Goto, SurroundFail
}
Exit

SurroundFail:
MsgBox, 21, Nvidia Surround Toggle, Error: Nvidia Surround could not be enabled!
FileDelete, %appdata%\NVSToggle\NVSToggle.ini
Exit

As you can see, I no-longer use a token in a config file to store the last-known-state of the display. This new script checks the aspect ratio against a threshold and switches between Extended/Surround depending upon which side of the threshold you're on. This should be pretty much bullet-proof (no way for the config file to fall out-of-sync with the actual display state). This also lets me detect when switching to Surround fails so I can reset the config file and prompt the user.

I also think I've got error-handling covered. If a failure is detected the script will automatically jump back into first-run mode and prompt the user to set up Surround from the Nvidia Control Panel again (this is sometimes necessary after driver updates, they can cause the Surround config to be lost).

Edit: There is one small issue, and I'm already well-aware of it. If you have three 16:9 monitors, in portrait mode, spanned, they will fail Surround detection. This wont hurt anything, the script will just refuse to proceed because it thinks you're on a single-monitor due to the aspect ratio not being wide enough (this specific Surround configuration is 15:9, which is narrower than 16:9). This is a special case, and the ONLY display configuration I cannot detect properly at this time.
 
Last edited:
Beast-mode, yet again. Where Nvidia fails, you succeed! Their hotkeys didnt even work properly and I always had to enable the extra monitors in multi-mode anyway.

Nice job with the error handling too because I broke it, of course.. :eek:

I owe you one, need any 3d graphics?? ;)
 
I only meant that I encountered the error message, by not setting up surround first. Although, now that I added a 2nd 780, it seems things work differently in SLI.

Using Multi-Monitor mode only works with all displays connected to one card. While using surround display requires a mix with displays plugged into each card. :rolleyes:

Getting tired tonight, but going to keep at it. I might be able to plug two displays into one of the monitors to solve the problem.
 
Solved. Plugged an hdmi and dvi into my main display
Woah... that means this trick works with SLI now?? :eek:

I mean, yeah, you have to run one additional cable... but still. That's a huge improvement over what we had going previously.

Edit: Updated the original post. From here-on-out, it will always reflect the latest version of my script.
 
Last edited:
Yeah, I was shocked when I saw the SLI config requirements. The only problem is that I run into errors.. but everything still works.

When I switch from surround to multi-monitor I get you error handler to setup surround, but I can just hit ok and it switches to multi-mode.
error1.jpg


When I switch from multi-monitor to surround I get an error that says surround can not be enabled.. or something, but it switches anyway and I hit cancel.
error2.jpg
 
Ok, I think I know what's going wrong...

What currently happens when switching into surround mode:
1. Make sure aspect ratio equal to, or less than, 1.8:1
2. Depresses ctrl + alt + s
3. Waits 100ms
4. Releases ctrl + alt + s
5. Wait 3500ms (3.5 seconds)
6. Check to see if the operation succeeded.
7a. If operation succeeded, quit silently.
7b. If operation failed, display error and re-run first-time setup.

If it takes longer than 3.5 seconds for the driver to switch, the script thinks switching didn't work, and you get caught by the error-handling.

It kinda figures that switching takes longer when using SLI since more stuff gets toggled. All I have to do is add an additional delay and/or loop, and this should be sorted out.
 
Last edited:
This is a quick test version. It will wait a full 10 seconds before failing out: https://db.tt/feaqc7EF

Let me know if that fixes it. If it does, I'm going to write in a more robust routine for checking if switching worked or not.
 
Great work on the script, Unknown-One! This is exactly what I was looking for. It's a shame Nvidia haven't been too kind to Surround.

My only complaint with this workaround is that I have to move my windows back after switching back and forth. I'm not sure that it would be possible to retain those positions in the switch though.

I just set up Win+S to activate your script :D
 
Bingo! The new test version doesn't give errors. Ditto on the moving of windows.. but whatever. I usually close most of the main programs (3dMax, PS, or games) before I switch anyway.

Awesome work Unknown-One and much thanks!
 
Goddamn it... I'm a Multi desktop whore and eyefinity, considering the move to dual gtx780s. If you could only take the strong points about SLI vs CF and out them together , you would have a great experience.

Nice job on the script. I'm going to keep my eye on your progress if I make the switch. Thanks
 
Goddamn it... I'm a Multi desktop whore and eyefinity, considering the move to dual gtx780s. If you could only take the strong points about SLI vs CF and out them together , you would have a great experience.

Nice job on the script. I'm going to keep my eye on your progress if I make the switch. Thanks
I made the jump from Eyefinity (single HD 6970) to Surround (single GTX 780) as well, and quick-switching is literally the ONLY thing I missed.

I had some time this weekend to test out an SLI system with the latest drivers + latest script, and I can confirm MorphysMate's findings. Requires one additional video cable, but switching works perfectly. Here's the configuration I used:

Card 1:
DVI into Monitor 1
DVI into Monitor 2
DisplayPort into Monitor 3

Card 2:
DVI into Monitor 3

It does take longer for SLI systems to switch between Surround and Extended Desktop, but that's because SLI is actually being toggled on/off/on when the switching takes place. Single-card Surround doesn't have to deal with that.

Edit: Original post updated with latest pre-compiled executable + source code.
 
Last edited:
I've been happy using Windows Key + P to switch Surround on an off for the past year, but I did a nuke-and-pave of my office PC yesterday and found the same issues after getting all the updates installed.

I'm actually using this tool myself now, and it seems to pretty much solve the problem perfectly. Props for providing a simple and effective fix. I'll be sure to bring all this up on my next call with NVIDIA and hopefully stoke the fire on the issue a bit.
 
I made the jump from Eyefinity (single HD 6970) to Surround (single GTX 780) as well, and quick-switching is literally the ONLY thing I missed.

I had some time this weekend to test out an SLI system with the latest drivers + latest script, and I can confirm MorphysMate's findings. Requires one additional video cable, but switching works perfectly. Here's the configuration I used:

Card 1:
DVI into Monitor 1
DVI into Monitor 2
DisplayPort into Monitor 3

Card 2:
DVI into Monitor 3

It does take longer for SLI systems to switch between Surround and Extended Desktop, but that's because SLI is actually being toggled on/off/on when the switching takes place. Single-card Surround doesn't have to deal with that.

Edit: Original post updated with latest pre-compiled executable + source code.

Thanks, I really appreciate your input on this as a former AMD user.
 
I'm actually using this tool myself now, and it seems to pretty much solve the problem perfectly. Props for providing a simple and effective fix. I'll be sure to bring all this up on my next call with NVIDIA and hopefully stoke the fire on the issue a bit.
That would be killer!

Given they've already taken a stab at implementing hotkeys and the driver now does in-built switching, I wouldn't think it would be too much extra effort to flesh-out the display configuration aspect of Nvidia Surround.
 
Well, sad news. Nvidia is working against our best efforts yet again.

Latest few drivers actively forget bezel correction if you switch in and out of Surround. You have to set it, by hand, every time you switch.

I don't know why Nvidia is so hell-bent on breaking this feature, but they're doing a great job.

Galaxy, any word?

Edit: Found where Nvidia stores this information in the registry. Going to attempt a solution...
 
Last edited:
Well, sad news. Nvidia is working against our best efforts yet again.

Latest few drivers actively forget bezel correction if you switch in and out of Surround. You have to set it, by hand, every time you switch.

I don't know why Nvidia is so hell-bent on breaking this feature, but they're doing a great job.

Galaxy, any word?

Edit: Found where Nvidia stores this information in the registry. Going to attempt a solution...

They know my thoughts on the matter but I have yet to hear any action on it. Doesn't mean they're not working on it, but if they are then they haven't said anything to me about it.
 
Thank you very much for this tool, it works swimmingly in Windows 8.1 with my three monitors (one of them with very slightly higher res than the rest which will eventually be swapped). Everything ends up in the right place between switches. I will go and try it with a game now to see if the bezel corrected resolutions are maintained.

:cool:
 
Yup, it appears that the bezel corrected resolutions are lost upon switch with the current drivers. It's a shame, really, but I guess I could use the extra AA that lowering my resolution affords, and the misalignment isn't that bad.
 
Just wanted to say I really appreciate the work you've done here Unknown. I used to use DisplayFusion monitor profiles which unintentionally worked as a surround switch until new drivers broke it. When I found this script I was impressed, the switch works pretty damn well!
I came back to ask about the bezel correction issue but it seems you're already aware :) I hope you find a fix because my bezels are a pain :(
It's amazing to see that this is still the only solution after 3 years, Nvidia really need to up their game.
 
Is there any update to this script for the latest nvidia drivers?

Also came across the toggle settings from Nvidia, NONE of them work, its an absolute joke.
 
Is there any update to this script for the latest nvidia drivers?

Also came across the toggle settings from Nvidia, NONE of them work, its an absolute joke.
I'm going to go ahead and upgrade to the latest drivers tonight, I'll let you know what I find out.

Stand by folks!
 
Thanks again for creating this script!
It seems to have stopped working completely now with the Windows 8.1 Update 1 version of windows.
Any updates?
 
I have messaged unknown about this as I love the script so much but was considering moving to 8.1 and would be put off without this script!
 
If Microsoft has made any changes to DisplaySwitch.exe, then it might have broken the script. I'll investigate.

I also really wish Nvidia would just make this a feature already...
 
Ok, I don't have a rig set up to test this at the moment... but can someone try going into the DPI settings on 8.1 and setting it to use classic (one DPI for all monitors) scaling instead of automatic per-display scaling?

That changed when going from 8.0 to 8.1, and it has a huge impact on how monitors are handled. I'm wondering if that's what screwed things up.
 
I would happily do that for you but I've not done my upgrade to 8 yet from 7 as I was worried this would not work! Can someone help out so Unknown can get to the bottom of this and fix it for 8 users?
 
Ok, I don't have a rig set up to test this at the moment... but can someone try going into the DPI settings on 8.1 and setting it to use classic (one DPI for all monitors) scaling instead of automatic per-display scaling?

That changed when going from 8.0 to 8.1, and it has a huge impact on how monitors are handled. I'm wondering if that's what screwed things up.

After making that change it seems to work for me now. (It wasn't before).

Thanks for a great missing feature implementation!
 
Hey, does somebody know where Nvidia Surround save the bezel-correction values into the registry?
Would be nice to know.

Thanks and greetings,
Kevin
 
hmm well I upgraded to 8.1, did the above and it is still not working for me anymore. As you can imagine, this is a bit of a disaster for me.

In 8.1 update 1, when you say classic scaling do you mean goto control panel, search for dpi and on the change the size of all items window, tick the box that says let me choose one scaling level for all my displays?

If so, when I have that ticked and log out /in when I run the toggle it will put me into surround, but when I want to come out of it back into extended, I get a volume thing appear top left screen, and then the ALT-P menu appears on the right, but the displays do not change.

Any ideas Unknown One?
 
Back
Top