mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-18 10:47:44 -06:00
added snap related toggles
- disable snapping entirely (requires relogin of windows user) - disable suggestion to snap other windows next to the snapped window -tested
This commit is contained in:
parent
87c252166f
commit
ff1ecbd1e3
@ -2708,12 +2708,28 @@
|
|||||||
"Order": "a064_",
|
"Order": "a064_",
|
||||||
"Type": "Toggle"
|
"Type": "Toggle"
|
||||||
},
|
},
|
||||||
|
"WPFToggleSnapWindow": {
|
||||||
|
"Content": "Snap Window",
|
||||||
|
"Description": "If enabled you can align windows by dragging them. | Relogin Required",
|
||||||
|
"category": "Customize Preferences",
|
||||||
|
"panel": "2",
|
||||||
|
"Order": "a065_",
|
||||||
|
"Type": "Toggle"
|
||||||
|
},
|
||||||
"WPFToggleSnapFlyout": {
|
"WPFToggleSnapFlyout": {
|
||||||
"Content": "Snap Assist Flyout",
|
"Content": "Snap Assist Flyout",
|
||||||
"Description": "If enabled then Snap preview is disabled when maximize button is hovered.",
|
"Description": "If enabled then Snap preview is disabled when maximize button is hovered.",
|
||||||
"category": "Customize Preferences",
|
"category": "Customize Preferences",
|
||||||
"panel": "2",
|
"panel": "2",
|
||||||
"Order": "a065_",
|
"Order": "a066_",
|
||||||
|
"Type": "Toggle"
|
||||||
|
},
|
||||||
|
"WPFToggleSnapSuggestion": {
|
||||||
|
"Content": "Snap Assist Suggestion",
|
||||||
|
"Description": "If enabled then you will get suggestions to snap other applications in the left over spaces.",
|
||||||
|
"category": "Customize Preferences",
|
||||||
|
"panel": "2",
|
||||||
|
"Order": "a067_",
|
||||||
"Type": "Toggle"
|
"Type": "Toggle"
|
||||||
},
|
},
|
||||||
"WPFToggleMouseAcceleration": {
|
"WPFToggleMouseAcceleration": {
|
||||||
@ -2721,7 +2737,7 @@
|
|||||||
"Description": "If Enabled then Cursor movement is affected by the speed of your physical mouse movements.",
|
"Description": "If Enabled then Cursor movement is affected by the speed of your physical mouse movements.",
|
||||||
"category": "Customize Preferences",
|
"category": "Customize Preferences",
|
||||||
"panel": "2",
|
"panel": "2",
|
||||||
"Order": "a066_",
|
"Order": "a068_",
|
||||||
"Type": "Toggle"
|
"Type": "Toggle"
|
||||||
},
|
},
|
||||||
"WPFToggleStickyKeys": {
|
"WPFToggleStickyKeys": {
|
||||||
@ -2729,7 +2745,7 @@
|
|||||||
"Description": "If Enabled then Sticky Keys is activated - Sticky keys is an accessibility feature of some graphical user interfaces which assists users who have physical disabilities or help users reduce repetitive strain injury.",
|
"Description": "If Enabled then Sticky Keys is activated - Sticky keys is an accessibility feature of some graphical user interfaces which assists users who have physical disabilities or help users reduce repetitive strain injury.",
|
||||||
"category": "Customize Preferences",
|
"category": "Customize Preferences",
|
||||||
"panel": "2",
|
"panel": "2",
|
||||||
"Order": "a067_",
|
"Order": "a069_",
|
||||||
"Type": "Toggle"
|
"Type": "Toggle"
|
||||||
},
|
},
|
||||||
"WPFOOSUbutton": {
|
"WPFOOSUbutton": {
|
||||||
|
@ -59,6 +59,15 @@ Function Get-WinUtilToggleStatus {
|
|||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($ToggleSwitch -eq "WPFToggleSnapWindow"){
|
||||||
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
||||||
|
if($hidesnap -eq 0){
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleSnapFlyout"){
|
if($ToggleSwitch -eq "WPFToggleSnapFlyout"){
|
||||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
||||||
if($hidesnap -eq 0){
|
if($hidesnap -eq 0){
|
||||||
@ -68,6 +77,15 @@ Function Get-WinUtilToggleStatus {
|
|||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($ToggleSwitch -eq "WPFToggleSnapSuggestion"){
|
||||||
|
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
||||||
|
if($hidesnap -eq 0){
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
if($ToggleSwitch -eq "WPFToggleMouseAcceleration"){
|
if($ToggleSwitch -eq "WPFToggleMouseAcceleration"){
|
||||||
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
||||||
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
||||||
|
34
functions/private/Invoke-WinUtilSnapSuggestion.ps1
Normal file
34
functions/private/Invoke-WinUtilSnapSuggestion.ps1
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
function Invoke-WinUtilSnapSuggestion {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Disables/Enables Snap Assist Suggestions on startup
|
||||||
|
.PARAMETER Enabled
|
||||||
|
Indicates whether to enable or disable Snap Assist Suggestions on startup
|
||||||
|
#>
|
||||||
|
Param($Enabled)
|
||||||
|
Try{
|
||||||
|
if ($Enabled -eq $false){
|
||||||
|
Write-Host "Enabling Snap Assist Suggestion On startup"
|
||||||
|
$value = 1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Disabling Snap Assist Suggestion On startup"
|
||||||
|
$value = 0
|
||||||
|
}
|
||||||
|
# taskkill.exe /F /IM "explorer.exe"
|
||||||
|
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
|
taskkill.exe /F /IM "explorer.exe"
|
||||||
|
Set-ItemProperty -Path $Path -Name SnapAssist -Value $value
|
||||||
|
Start-Process "explorer.exe"
|
||||||
|
}
|
||||||
|
Catch [System.Security.SecurityException] {
|
||||||
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
|
}
|
||||||
|
Catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
|
}
|
||||||
|
Catch{
|
||||||
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
|
}
|
||||||
|
}
|
31
functions/private/Invoke-WinUtilSnapWindow.ps1
Normal file
31
functions/private/Invoke-WinUtilSnapWindow.ps1
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
function Invoke-WinUtilSnapWindow {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Disables/Enables Snapping Windows on startup
|
||||||
|
.PARAMETER Enabled
|
||||||
|
Indicates whether to enable or disable Snapping Windows on startup
|
||||||
|
#>
|
||||||
|
Param($Enabled)
|
||||||
|
Try{
|
||||||
|
if ($Enabled -eq $false){
|
||||||
|
Write-Host "Enabling Snap Windows On startup | Relogin Required"
|
||||||
|
$value = 1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Disabling Snap Windows On startup | Relogin Required"
|
||||||
|
$value = 0
|
||||||
|
}
|
||||||
|
$Path = "HKCU:\Control Panel\Desktop"
|
||||||
|
Set-ItemProperty -Path $Path -Name WindowArrangementActive -Value $value
|
||||||
|
}
|
||||||
|
Catch [System.Security.SecurityException] {
|
||||||
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||||
|
}
|
||||||
|
Catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
|
Write-Warning $psitem.Exception.ErrorRecord
|
||||||
|
}
|
||||||
|
Catch{
|
||||||
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||||
|
Write-Warning $psitem.Exception.StackTrace
|
||||||
|
}
|
||||||
|
}
|
@ -22,7 +22,9 @@ function Invoke-WPFToggle {
|
|||||||
"WPFToggleNumLock" {Invoke-WinUtilNumLock $(Get-WinUtilToggleStatus WPFToggleNumLock)}
|
"WPFToggleNumLock" {Invoke-WinUtilNumLock $(Get-WinUtilToggleStatus WPFToggleNumLock)}
|
||||||
"WPFToggleVerboseLogon" {Invoke-WinUtilVerboseLogon $(Get-WinUtilToggleStatus WPFToggleVerboseLogon)}
|
"WPFToggleVerboseLogon" {Invoke-WinUtilVerboseLogon $(Get-WinUtilToggleStatus WPFToggleVerboseLogon)}
|
||||||
"WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)}
|
"WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)}
|
||||||
|
"WPFToggleSnapWindow" {Invoke-WinUtilSnapWindow $(Get-WinUtilToggleStatus WPFToggleSnapWindow)}
|
||||||
"WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)}
|
"WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)}
|
||||||
|
"WPFToggleSnapSuggestion" {Invoke-WinUtilSnapSuggestion $(Get-WinUtilToggleStatus WPFToggleSnapSuggestion)}
|
||||||
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
|
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
|
||||||
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
|
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
|
||||||
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
|
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
|
||||||
|
Loading…
Reference in New Issue
Block a user