From 84bd29f37e1f8b4d948ae45f46a4d7a9739275bd Mon Sep 17 00:00:00 2001 From: Brian Baker Date: Tue, 16 Jul 2019 16:41:30 -0400 Subject: [PATCH] (GH-399) Use ParameterSet for multi monitor params --- Boxstarter.WinConfig/Set-TaskbarOptions.ps1 | 30 +++++++++++---------- Web/WinConfig.cshtml | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Boxstarter.WinConfig/Set-TaskbarOptions.ps1 b/Boxstarter.WinConfig/Set-TaskbarOptions.ps1 index f6bee252..71785c0d 100644 --- a/Boxstarter.WinConfig/Set-TaskbarOptions.ps1 +++ b/Boxstarter.WinConfig/Set-TaskbarOptions.ps1 @@ -68,12 +68,14 @@ Changes the Taskbar Icon combination style for non-primary displays. Valid inpu $Dock, [ValidateSet('Always','Full','Never')] $Combine, - [Parameter(ParameterSetName='MultiMonitorOn')] - [switch]$MultiMonitorOn, [Parameter(ParameterSetName='MultiMonitorOff')] [switch]$MultiMonitorOff, + [Parameter(ParameterSetName='MultiMonitorOn')] + [switch]$MultiMonitorOn, + [Parameter(ParameterSetName='MultiMonitorOn')] [ValidateSet('All', 'MainAndOpen', 'Open')] $MultiMonitorMode, + [Parameter(ParameterSetName='MultiMonitorOn')] [ValidateSet('Always','Full','Never')] $MultiMonitorCombine ) @@ -109,24 +111,24 @@ Changes the Taskbar Icon combination style for non-primary displays. Valid inpu if($MultiMonitorOn) { Set-ItemProperty $key MMTaskbarEnabled 1 + + switch($MultiMonitorMode) { + "All" { Set-ItemProperty $key MMTaskbarMode 0 } + "MainAndOpen" { Set-ItemProperty $key MMTaskbarMode 1 } + "Open" {Set-ItemProperty $key MMTaskbarMode 2 } + } + + switch($MultiMonitorCombine) { + "Always" { Set-ItemProperty $key MMTaskbarGlomLevel 0 } + "Full" { Set-ItemProperty $key MMTaskbarGlomLevel 1 } + "Never" { Set-ItemProperty $key MMTaskbarGlomLevel 2 } + } } if($MultiMonitorOff) { Set-ItemProperty $key MMTaskbarEnabled 0 } - - switch($MultiMonitorMode) { - "All" { Set-ItemProperty $key MMTaskbarMode 0 } - "MainAndOpen" { Set-ItemProperty $key MMTaskbarMode 1 } - "Open" {Set-ItemProperty $key MMTaskbarMode 2 } - } - - switch($MultiMonitorCombine) { - "Always" { Set-ItemProperty $key MMTaskbarGlomLevel 0 } - "Full" { Set-ItemProperty $key MMTaskbarGlomLevel 1 } - "Never" { Set-ItemProperty $key MMTaskbarGlomLevel 2 } - } } if(Test-Path -Path $settingKey) { diff --git a/Web/WinConfig.cshtml b/Web/WinConfig.cshtml index 54d27487..a6acfe67 100644 --- a/Web/WinConfig.cshtml +++ b/Web/WinConfig.cshtml @@ -82,7 +82,7 @@ Set-TaskbarOptions -Size Small -Lock -Dock Top -Combine Always -AlwaysShowIconsO

It is also possible to do the converse actions, if required.

-    Set-TaskbarOptions -Size Large -UnLock -Dock Bottom -Combine Never -AlwaysShowIconsOff -MultiMonitorOff -MultiMonitorMode Open -MultiMonitorCombine Never
+    Set-TaskbarOptions -Size Large -UnLock -Dock Bottom -Combine Never -AlwaysShowIconsOff -MultiMonitorOff
 

Update-ExecutionPolicy