Skip to content

Commit

Permalink
(chocolateyGH-399) Use ParameterSet for multi monitor params
Browse files Browse the repository at this point in the history
  • Loading branch information
HolisticDeveloper committed Oct 28, 2019
1 parent 332b008 commit 84bd29f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions Boxstarter.WinConfig/Set-TaskbarOptions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion Web/WinConfig.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Set-TaskbarOptions -Size Small -Lock -Dock Top -Combine Always -AlwaysShowIconsO
</pre>
<p>It is also possible to do the converse actions, if required.</p>
<pre>
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
</pre>

<h3>Update-ExecutionPolicy</h3>
Expand Down

0 comments on commit 84bd29f

Please sign in to comment.