From 4773cd6d2b1613994f2a4f2282bf8f1db90d7c0a Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Sat, 3 Feb 2024 11:42:14 -0600 Subject: [PATCH] Test 2023 02 02 (#1556) * Fix config tab (#1547) The JSON is poorly formatted. In my machine this resolved the issue * Compile Winutil * Add toggle "sticky keys" (#1546) Adds a toggle to enable/disable sticky keys * added miniconda, temurin, presentmon and pyenv-win (#1542) * Compile Winutil --------- Co-authored-by: Yuri Gabriel <97139700+Yuuh15@users.noreply.github.com> Co-authored-by: ChrisTitusTech Co-authored-by: Jakub Krojec --- config/applications.json | 48 +++++++- config/feature.json | 13 +- config/tweaks.json | 8 ++ functions/private/Get-WinUtilToggleStatus.ps1 | 9 ++ functions/private/Invoke-WinUtilStickyKeys | 31 +++++ functions/public/Invoke-WPFToggle.ps1 | 1 + winutil.ps1 | 112 +++++++++++++++--- 7 files changed, 195 insertions(+), 27 deletions(-) create mode 100644 functions/private/Invoke-WinUtilStickyKeys diff --git a/config/applications.json b/config/applications.json index d107c2420d..f3d1d33116 100755 --- a/config/applications.json +++ b/config/applications.json @@ -391,7 +391,7 @@ "link": "https://dotnet.microsoft.com/download/dotnet/8.0", "winget": "Microsoft.DotNet.DesktopRuntime.8" }, - "WPFInstalldmt": { + "WPFInstalldmt": { "winget": "GNE.DualMonitorTools", "choco": "dual-monitor-tools", "category": "Utilities", @@ -2232,11 +2232,47 @@ "winget": "Zulip.Zulip" }, "WPFInstallsyncthingtray": { - "winget": " Martchus.syncthingtray", - "choco": "syncthingtray", "category": "Utilities", + "choco": "syncthingtray", "content": "syncthingtray", + "description": "Might be the alternative for Synctrayzor. Windows tray utility / filesystem watcher / launcher for Syncthing", "link": "https://github.com/Martchus/syncthingtray", - "description": "Might be the alternative for Synctrayzro.Windows tray utility / filesystem watcher / launcher for Syncthing " - } -} + "winget": "Martchus.syncthingtray" + }, + "WPFInstallminiconda": { + "category": "Development", + "choco": "miniconda3", + "content": "Miniconda", + "description": "Miniconda is a free minimal installer for conda. It is a small bootstrap version of Anaconda that includes only conda, Python, the packages they both depend on, and a small number of other useful packages (like pip, zlib, and a few others).", + "link": "https://docs.conda.io/projects/miniconda", + "panel": "1", + "winget": "Anaconda.Miniconda3" + }, + "WPFInstalltemurin": { + "category": "Development", + "choco": "temurin", + "content": "Eclipse Temurin", + "description": "Eclipse Temurin is the open source Java SE build based upon OpenJDK.", + "link": "https://adoptium.net/temurin/", + "panel": "1", + "winget": "EclipseAdoptium.Temurin.21.JDK" + }, + "WPFInstallintelpresentmon": { + "category": "Utilities", + "choco": "na", + "content": "IntelĀ® PresentMon", + "description": "A new gaming performance overlay and telemetry application to monitor and measure your gaming experience.", + "link": "https://game.intel.com/us/stories/intel-presentmon/", + "panel": "4", + "winget": "Intel.PresentMon.Beta" + }, + "WPFInstallpyenvwin": { + "category": "Development", + "choco": "pyenv-win", + "content": "Python Version Manager (pyenv-win)", + "description": "pyenv for Windows is a simple python version management tool. It lets you easily switch between multiple versions of Python.", + "link": "https://pyenv-win.github.io/pyenv-win/", + "panel": "1", + "winget": "na" + } +} \ No newline at end of file diff --git a/config/feature.json b/config/feature.json index d39f0dd252..d2f5a16198 100644 --- a/config/feature.json +++ b/config/feature.json @@ -75,12 +75,11 @@ "NFS-Administration" ], "InvokeScript": [ - "nfsadmin client stop - Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default' -Name 'AnonymousUID' -Type DWord -Value 0 - Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default' -Name 'AnonymousGID' -Type DWord -Value 0 - nfsadmin client start - nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i - " + "nfsadmin client stop", + "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default' -Name 'AnonymousUID' -Type DWord -Value 0", + "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default' -Name 'AnonymousGID' -Type DWord -Value 0", + "nfsadmin client start", + "nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i" ] }, "WPFFeatureEnableSearchSuggestions": { @@ -178,7 +177,7 @@ "category": "Features", "panel": "1", "Order": "a021_", - "Description": "Windows Sandbox is a lightweight virtual machine that provides a temporary desktop environment to safely run applications and programs in isolation.", + "Description": "Windows Sandbox is a lightweight virtual machine that provides a temporary desktop environment to safely run applications and programs in isolation." }, "WPFFeatureInstall": { "Content": "Install Features", diff --git a/config/tweaks.json b/config/tweaks.json index e9d5873ad5..9f9bfb9ff7 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -2602,6 +2602,14 @@ "Order": "a066_", "Type": "Toggle" }, + "WPFToggleStickyKeys": { + "Content": "Sticky Keys", + "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", + "panel": "2", + "Order": "a067_", + "Type": "Toggle" + }, "WPFchangedns": { "Content": "DNS", "category": "z__Advanced Tweaks - CAUTION", diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index 43339c5beb..cc5b5090ce 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -80,4 +80,13 @@ Function Get-WinUtilToggleStatus { return $false } } + if ($ToggleSwitch -eq "WPFToggleStickyKeys") { + $StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags + if($StickyKeys -eq 58){ + return $false + } + else{ + return $true + } + } } \ No newline at end of file diff --git a/functions/private/Invoke-WinUtilStickyKeys b/functions/private/Invoke-WinUtilStickyKeys new file mode 100644 index 0000000000..3cd6433536 --- /dev/null +++ b/functions/private/Invoke-WinUtilStickyKeys @@ -0,0 +1,31 @@ +Function Invoke-WinUtilStickyKeys { + <# + .SYNOPSIS + Disables/Enables Sticky Keyss on startup + .PARAMETER Enabled + Indicates whether to enable or disable Sticky Keys on startup + #> + Param($Enabled) + Try { + if ($Enabled -eq $false){ + Write-Host "Enabling Sticky Keys On startup" + $value = 510 + } + else { + Write-Host "Disabling Sticky Keys On startup" + $value = 58 + } + $Path = "HKCU:\Control Panel\Accessibility\StickyKeys" + Set-ItemProperty -Path $Path -Name Flags -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 + } +} \ No newline at end of file diff --git a/functions/public/Invoke-WPFToggle.ps1 b/functions/public/Invoke-WPFToggle.ps1 index 826abeaa80..1a60217e78 100644 --- a/functions/public/Invoke-WPFToggle.ps1 +++ b/functions/public/Invoke-WPFToggle.ps1 @@ -24,5 +24,6 @@ function Invoke-WPFToggle { "WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)} "WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)} "WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)} + "WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)} } } \ No newline at end of file diff --git a/winutil.ps1 b/winutil.ps1 index a5aaccc004..6ff20123be 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -10,7 +10,7 @@ Author : Chris Titus @christitustech Runspace Author: @DeveloperDurp GitHub : https://github.com/ChrisTitusTech - Version : 24.02.02 + Version : 24.02.03 #> param ( [switch]$Debug, @@ -47,7 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot -$sync.version = "24.02.02" +$sync.version = "24.02.03" $sync.configs = @{} $sync.ProcessRunning = $false @@ -473,6 +473,15 @@ Function Get-WinUtilToggleStatus { return $false } } + if ($ToggleSwitch -eq "WPFToggleStickyKeys") { + $StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags + if($StickyKeys -eq 58){ + return $false + } + else{ + return $true + } + } } function Get-WinUtilVariables { @@ -1672,6 +1681,37 @@ function Invoke-WinUtilSnapFlyout { Write-Warning $psitem.Exception.StackTrace } } +Function Invoke-WinUtilStickyKeys { + <# + .SYNOPSIS + Disables/Enables Sticky Keyss on startup + .PARAMETER Enabled + Indicates whether to enable or disable Sticky Keys on startup + #> + Param($Enabled) + Try { + if ($Enabled -eq $false){ + Write-Host "Enabling Sticky Keys On startup" + $value = 510 + } + else { + Write-Host "Disabling Sticky Keys On startup" + $value = 58 + } + $Path = "HKCU:\Control Panel\Accessibility\StickyKeys" + Set-ItemProperty -Path $Path -Name Flags -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 + } +} function Invoke-WinUtilTweaks { <# @@ -3905,6 +3945,7 @@ function Invoke-WPFToggle { "WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)} "WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)} "WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)} + "WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)} } } function Invoke-WPFtweaksbutton { @@ -5765,7 +5806,7 @@ $sync.configs.applications = '{ "link": "https://dotnet.microsoft.com/download/dotnet/8.0", "winget": "Microsoft.DotNet.DesktopRuntime.8" }, - "WPFInstalldmt": { + "WPFInstalldmt": { "winget": "GNE.DualMonitorTools", "choco": "dual-monitor-tools", "category": "Utilities", @@ -7606,13 +7647,49 @@ $sync.configs.applications = '{ "winget": "Zulip.Zulip" }, "WPFInstallsyncthingtray": { - "winget": " Martchus.syncthingtray", - "choco": "syncthingtray", "category": "Utilities", + "choco": "syncthingtray", "content": "syncthingtray", + "description": "Might be the alternative for Synctrayzor. Windows tray utility / filesystem watcher / launcher for Syncthing", "link": "https://github.com/Martchus/syncthingtray", - "description": "Might be the alternative for Synctrayzro.Windows tray utility / filesystem watcher / launcher for Syncthing " - } + "winget": "Martchus.syncthingtray" + }, + "WPFInstallminiconda": { + "category": "Development", + "choco": "miniconda3", + "content": "Miniconda", + "description": "Miniconda is a free minimal installer for conda. It is a small bootstrap version of Anaconda that includes only conda, Python, the packages they both depend on, and a small number of other useful packages (like pip, zlib, and a few others).", + "link": "https://docs.conda.io/projects/miniconda", + "panel": "1", + "winget": "Anaconda.Miniconda3" + }, + "WPFInstalltemurin": { + "category": "Development", + "choco": "temurin", + "content": "Eclipse Temurin", + "description": "Eclipse Temurin is the open source Java SE build based upon OpenJDK.", + "link": "https://adoptium.net/temurin/", + "panel": "1", + "winget": "EclipseAdoptium.Temurin.21.JDK" + }, + "WPFInstallintelpresentmon": { + "category": "Utilities", + "choco": "na", + "content": "Intel?? PresentMon", + "description": "A new gaming performance overlay and telemetry application to monitor and measure your gaming experience.", + "link": "https://game.intel.com/us/stories/intel-presentmon/", + "panel": "4", + "winget": "Intel.PresentMon.Beta" + }, + "WPFInstallpyenvwin": { + "category": "Development", + "choco": "pyenv-win", + "content": "Python Version Manager (pyenv-win)", + "description": "pyenv for Windows is a simple python version management tool. It lets you easily switch between multiple versions of Python.", + "link": "https://pyenv-win.github.io/pyenv-win/", + "panel": "1", + "winget": "na" + } }' | convertfrom-json $sync.configs.dns = '{ "Google":{ @@ -7721,12 +7798,11 @@ $sync.configs.feature = '{ "NFS-Administration" ], "InvokeScript": [ - "nfsadmin client stop - Set-ItemProperty -Path ''HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default'' -Name ''AnonymousUID'' -Type DWord -Value 0 - Set-ItemProperty -Path ''HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default'' -Name ''AnonymousGID'' -Type DWord -Value 0 - nfsadmin client start - nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i - " + "nfsadmin client stop", + "Set-ItemProperty -Path ''HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default'' -Name ''AnonymousUID'' -Type DWord -Value 0", + "Set-ItemProperty -Path ''HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default'' -Name ''AnonymousGID'' -Type DWord -Value 0", + "nfsadmin client start", + "nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i" ] }, "WPFFeatureEnableSearchSuggestions": { @@ -7824,7 +7900,7 @@ $sync.configs.feature = '{ "category": "Features", "panel": "1", "Order": "a021_", - "Description": "Windows Sandbox is a lightweight virtual machine that provides a temporary desktop environment to safely run applications and programs in isolation.", + "Description": "Windows Sandbox is a lightweight virtual machine that provides a temporary desktop environment to safely run applications and programs in isolation." }, "WPFFeatureInstall": { "Content": "Install Features", @@ -10619,6 +10695,14 @@ $sync.configs.tweaks = '{ "Order": "a066_", "Type": "Toggle" }, + "WPFToggleStickyKeys": { + "Content": "Sticky Keys", + "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", + "panel": "2", + "Order": "a067_", + "Type": "Toggle" + }, "WPFchangedns": { "Content": "DNS", "category": "z__Advanced Tweaks - CAUTION",