Merge branch 'test-2024-02-07-refactor-noapps' into CW-MicroWin

This commit is contained in:
CodingWonders 2024-02-09 15:57:27 +01:00
commit 42d13ad735
29 changed files with 484 additions and 729 deletions

56
.github/workflows/close-old-issues.yaml vendored Normal file
View File

@ -0,0 +1,56 @@
name: Close Inactive Issues
on:
schedule:
- cron: '0 0 * * *' # Run daily
jobs:
close-issues:
runs-on: ubuntu-latest
steps:
- name: Close inactive issues
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const octokit = github.getOctokit();
// Get the repository owner and name
const { owner, repo } = github.context.repo;
// Define the inactivity period (14 days)
const inactivityPeriod = new Date();
inactivityPeriod.setDate(inactivityPeriod.getDate() - 14);
async function run() {
// Get all open issues
const issues = await octokit.issues.listForRepo({
owner,
repo,
state: 'open',
});
// Close issues inactive for more than the inactivity period
for (const issue of issues.data) {
const lastCommentDate = issue.updated_at;
if (new Date(lastCommentDate) < inactivityPeriod) {
// Close the issue and add a comment
await octokit.issues.update({
owner,
repo,
issue_number: issue.number,
state: 'closed',
});
await octokit.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: 'Closed due to inactivity',
});
}
}
}
run().catch(error => console.error(error));

2
.gitignore vendored
View File

@ -23,6 +23,7 @@ ooshutup10.cfg
winutil.exe.config winutil.exe.config
Microsoft.UI.Xaml* Microsoft.UI.Xaml*
license1.xml license1.xml
winutil.ps1
# Libraries # Libraries
System.Management.Automation.dll System.Management.Automation.dll
@ -37,3 +38,4 @@ Microsoft.PowerShell.ConsoleHost.dll
.DS_Store .DS_Store
microwin.log microwin.log
True True
test.ps1

View File

@ -45,10 +45,10 @@ Some features are avaliable through automation. This allows you to save your con
![GetInstalled](/wiki/Get-Installed.png) ![GetInstalled](/wiki/Get-Installed.png)
2. Click on the Settings cog in the upper right corner and chose Export, chose file file and location, this will export the setting file. 2. Click on the Settings cog in the upper right corner and chose Export, chose file file and location, this will export the setting file.
![SettingsExport](/wiki/Settings-Export.png) ![SettingsExport](/wiki/Settings-Export.png)
3. Copy this file to a USB or somewhere you can use after Windows installation 3. Copy this file to a USB or somewhere you can use after Windows installation.
4. Use Microwin tab to create a cusom Windows image 4. Use Microwin tab to create a custom Windows image.
5. Install the Windows image 5. Install the Windows image.
6. In the new Windows, Open PowerShell in the admin mode and run command to automatically apply twekas and install apps from the config file 6. In the new Windows, Open PowerShell in the admin mode and run command to automatically apply tweaks and install apps from the config file.
``` ```
irm https://christitus.com/win -Config [path-to-your-config] -Run | iex irm https://christitus.com/win -Config [path-to-your-config] -Run | iex
``` ```

File diff suppressed because it is too large Load Diff

View File

@ -75,12 +75,11 @@
"NFS-Administration" "NFS-Administration"
], ],
"InvokeScript": [ "InvokeScript": [
"nfsadmin client stop "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 'AnonymousUID' -Type DWord -Value 0",
Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default' -Name 'AnonymousGID' -Type DWord -Value 0 "Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Default' -Name 'AnonymousGID' -Type DWord -Value 0",
nfsadmin client start "nfsadmin client start",
nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i "nfsadmin client localhost config fileaccess=755 SecFlavors=+sys -krb5 -krb5i"
"
] ]
}, },
"WPFFeatureEnableSearchSuggestions": { "WPFFeatureEnableSearchSuggestions": {
@ -178,7 +177,7 @@
"category": "Features", "category": "Features",
"panel": "1", "panel": "1",
"Order": "a021_", "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": { "WPFFeatureInstall": {
"Content": "Install Features", "Content": "Install Features",
@ -222,6 +221,13 @@
"Order": "a044_", "Order": "a044_",
"Type": "300" "Type": "300"
}, },
"WPFRunAdobeCCCleanerTool": {
"Content": "Remove Adobe Creative Cloud",
"category": "Fixes",
"panel": "1",
"Order": "a045_",
"Type": "300"
},
"WPFPanelnetwork": { "WPFPanelnetwork": {
"Content": "Network Connections", "Content": "Network Connections",
"category": "Legacy Windows Panels", "category": "Legacy Windows Panels",

View File

@ -2602,6 +2602,14 @@
"Order": "a066_", "Order": "a066_",
"Type": "Toggle" "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": { "WPFchangedns": {
"Content": "DNS", "Content": "DNS",
"category": "z__Advanced Tweaks - CAUTION", "category": "z__Advanced Tweaks - CAUTION",

View File

@ -8,9 +8,9 @@ function Get-Oscdimg {
Get-Oscdimg Get-Oscdimg
#> #>
param( [Parameter(Mandatory=$true)] param( [Parameter(Mandatory=$true)]
$oscdimgPath = "$env:TEMP\oscdimg.exe" [string]$oscdimgPath
) )
$oscdimgPath = "$env:TEMP\oscdimg.exe"
$downloadUrl = "https://github.com/ChrisTitusTech/winutil/raw/main/releases/oscdimg.exe" $downloadUrl = "https://github.com/ChrisTitusTech/winutil/raw/main/releases/oscdimg.exe"
Invoke-RestMethod -Uri $downloadUrl -OutFile $oscdimgPath Invoke-RestMethod -Uri $downloadUrl -OutFile $oscdimgPath
$hashResult = Get-FileHash -Path $oscdimgPath -Algorithm SHA256 $hashResult = Get-FileHash -Path $oscdimgPath -Algorithm SHA256

View File

@ -1,32 +0,0 @@
function Get-WinUtilRegistry {
<#
.SYNOPSIS
Gets the value of a registry key
.EXAMPLE
Get-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0"
#>
param (
$Name,
$Path,
$Type,
$Value
)
Try{
$syscheckvalue = Get-ItemPropertyValue -Path $Path -Value $Value # Return 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
}
}

View File

@ -80,4 +80,13 @@ Function Get-WinUtilToggleStatus {
return $false 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
}
}
} }

View File

@ -10,7 +10,7 @@ function Install-WinUtilChoco {
try { try {
Write-Host "Checking if Chocolatey is Installed..." Write-Host "Checking if Chocolatey is Installed..."
if((Test-WinUtilPackageManager -choco)){ if((Get-Command -Name choco -ErrorAction Ignore)) {
Write-Host "Chocolatey Already Installed" Write-Host "Chocolatey Already Installed"
return return
} }

View File

@ -41,4 +41,4 @@ Function Install-WinUtilProgramWinget {
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
} }

View File

@ -47,4 +47,4 @@ function Install-WinUtilWinget {
Catch{ Catch{
throw [WingetFailedInstall]::new('Failed to install') throw [WingetFailedInstall]::new('Failed to install')
} }
} }

View File

@ -14,7 +14,7 @@ function Invoke-MicroWin-Helper {
} }
function Is-CompatibleImage() { function Test-CompatibleImage() {
<# <#
.SYNOPSIS .SYNOPSIS

View File

@ -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
}
}

View File

@ -17,14 +17,34 @@ function Test-WinUtilPackageManager {
[System.Management.Automation.SwitchParameter]$choco [System.Management.Automation.SwitchParameter]$choco
) )
if($winget){ # Install Winget if not detected
if (Test-Path ~\AppData\Local\Microsoft\WindowsApps\winget.exe) { $wingetExists = Get-Command -Name winget -ErrorAction SilentlyContinue
if ($wingetExists) {
$wingetVersion = [System.Version]::Parse((winget --version).Trim('v'))
$minimumWingetVersion = [System.Version]::new(1,2,10691) # Win 11 23H2 comes with bad winget v1.2.10691
$wingetOutdated = $wingetVersion -le $minimumWingetVersion
Write-Host "Winget v$wingetVersion"
}
if (!$wingetExists -or $wingetOutdated) {
if (!$wingetExists) {
Write-Host "Winget not detected"
} else {
Write-Host "- Winget out-dated"
}
}
if ($winget) {
if ($wingetExists -and !$wingetOutdated) {
Write-Host "- Winget up-to-date"
return $true return $true
} }
} }
if($choco){ if($choco){
if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)){ if ((Get-Command -Name choco -ErrorAction Ignore) -and ($chocoVersion = (Get-Item "$env:ChocolateyInstall\choco.exe" -ErrorAction Ignore).VersionInfo.ProductVersion)){
Write-Host "Chocolatey v$chocoVersion"
return $true return $true
} }
} }

View File

@ -14,7 +14,6 @@ function Invoke-ScratchDialog {
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
$Dialog = New-Object System.Windows.Forms.FolderBrowserDialog $Dialog = New-Object System.Windows.Forms.FolderBrowserDialog
$Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text $Dialog.SelectedPath = $sync.MicrowinScratchDirBox.Text
$DialogShowNewFolderButton = $true
$Dialog.ShowDialog() $Dialog.ShowDialog()
$filePath = $Dialog.SelectedPath $filePath = $Dialog.SelectedPath
Write-Host "No ISO is chosen+ $filePath" Write-Host "No ISO is chosen+ $filePath"

View File

@ -43,6 +43,7 @@ function Invoke-WPFButton {
"WPFUpdatesdefault" {Invoke-WPFUpdatesdefault} "WPFUpdatesdefault" {Invoke-WPFUpdatesdefault}
"WPFFixesUpdate" {Invoke-WPFFixesUpdate} "WPFFixesUpdate" {Invoke-WPFFixesUpdate}
"WPFFixesWinget" {Invoke-WPFFixesWinget} "WPFFixesWinget" {Invoke-WPFFixesWinget}
"WPFRunAdobeCCCleanerTool" {Invoke-WPFRunAdobeCCCleanerTool}
"WPFFixesNetwork" {Invoke-WPFFixesNetwork} "WPFFixesNetwork" {Invoke-WPFFixesNetwork}
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable} "WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity} "WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}

View File

@ -12,7 +12,7 @@ function Invoke-WPFFeatureInstall {
return return
} }
$Features = (Get-WinUtilCheckBoxes)["WPFFeatures"] $Features = (Get-WinUtilCheckBoxes)["WPFFeature"]
Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock { Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock {
param($Features, $DebugPreference) param($Features, $DebugPreference)

View File

@ -8,6 +8,6 @@ function Invoke-WPFFixesWinget {
BravoNorris for the fantastic idea of a button to reinstall winget BravoNorris for the fantastic idea of a button to reinstall winget
#> #>
Start-Process -FilePath "choco" -ArgumentList "install winget -y" -NoNewWindow -Wait Start-Process -FilePath "choco" -ArgumentList "install winget -y --force" -NoNewWindow -Wait
} }

View File

@ -16,7 +16,7 @@ function Invoke-WPFGetInstalled {
return return
} }
if(!(Test-WinUtilPackageManager -winget) -and $checkbox -eq "winget"){ if(!(Get-Command -Name winget -ErrorAction SilentlyContinue) -and $checkbox -eq "winget"){
Write-Host "===========================================" Write-Host "==========================================="
Write-Host "-- Winget is not installed ---" Write-Host "-- Winget is not installed ---"
Write-Host "===========================================" Write-Host "==========================================="

View File

@ -35,7 +35,7 @@ function Invoke-WPFInstall {
} }
Catch { Catch {
Write-Host "===========================================" Write-Host "==========================================="
Write-Host "-- Winget failed to install ---" Write-Host "Error: $_"
Write-Host "===========================================" Write-Host "==========================================="
} }
Start-Sleep -Seconds 5 Start-Sleep -Seconds 5

View File

@ -5,7 +5,7 @@ function Invoke-WPFInstallUpgrade {
Invokes the function that upgrades all installed programs using winget Invokes the function that upgrades all installed programs using winget
#> #>
if(!(Test-WinUtilPackageManager -winget)){ if(!(Get-Command -Name winget -ErrorAction SilentlyContinue)){
Write-Host "===========================================" Write-Host "==========================================="
Write-Host "-- Winget is not installed ---" Write-Host "-- Winget is not installed ---"
Write-Host "===========================================" Write-Host "==========================================="

View File

@ -60,7 +60,7 @@ public class PowerManagement {
$imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version $imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version
# Detect image version to avoid performing MicroWin processing on Windows 8 and earlier # Detect image version to avoid performing MicroWin processing on Windows 8 and earlier
if ((Is-CompatibleImage $imgVersion) -eq $false) if ((Test-CompatibleImage $imgVersion) -eq $false)
{ {
$msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image." $msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image."
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers." $dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."

View File

@ -0,0 +1,28 @@
function Invoke-WPFRunAdobeCCCleanerTool {
<#
.SYNOPSIS
It removes or fixes problem files and resolves permission issues in registry keys.
.DESCRIPTION
The Creative Cloud Cleaner tool is a utility for experienced users to clean up corrupted installations.
#>
[string]$url="https://swupmf.adobe.com/webfeed/CleanerTool/win/AdobeCreativeCloudCleanerTool.exe"
Write-Host "The Adobe Creative Cloud Cleaner tool is hosted at"
Write-Host "$url"
# Don't show the progress because it will slow down the download speed
$ProgressPreference='SilentlyContinue'
Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -UseBasicParsing -ErrorAction SilentlyContinue -Verbose
# Revert back the ProgressPreference variable to the default value since we got the file desired
$ProgressPreference='Continue'
Start-Process -FilePath "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Wait -ErrorAction SilentlyContinue -Verbose
if (Test-Path -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe") {
Write-Host "Cleaning up..."
Remove-Item -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Verbose
}
}

View File

@ -37,7 +37,7 @@ function Invoke-WPFShortcut {
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
$Shortcut.TargetPath = $SourceExe $Shortcut.TargetPath = $SourceExe
$Shortcut.Arguments = $ArgumentsToSourceExe $Shortcut.Arguments = $ArgumentsToSourceExe
if ($iconPath -ne $null) { if ($null -ne $iconPath) {
$shortcut.IconLocation = $iconPath $shortcut.IconLocation = $iconPath
} }
$Shortcut.Save() $Shortcut.Save()

View File

@ -24,5 +24,6 @@ function Invoke-WPFToggle {
"WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)} "WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)}
"WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)} "WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)}
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)} "WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
} }
} }

View File

@ -16,7 +16,6 @@ Describe "Config Files" -ForEach @(
"winget": "value", "winget": "value",
"choco": "value", "choco": "value",
"category": "value", "category": "value",
"panel": "value",
"content": "value", "content": "value",
"description": "value", "description": "value",
"link": "value" "link": "value"

View File

@ -54,7 +54,8 @@ $inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -repla
function Get-TabXaml { function Get-TabXaml {
param( [Parameter(Mandatory=$true)] param( [Parameter(Mandatory=$true)]
$tabname $tabname,
$columncount = 0
) )
$organizedData = @{} $organizedData = @{}
# Iterate through JSON data and organize by panel and category # Iterate through JSON data and organize by panel and category
@ -68,7 +69,7 @@ function Get-TabXaml {
Content = $appInfo.Content Content = $appInfo.Content
Choco = $appInfo.choco Choco = $appInfo.choco
Winget = $appInfo.winget Winget = $appInfo.winget
Panel = $appInfo.panel Panel = if ($columncount -gt 0 ) { "0" } else {$appInfo.panel}
Link = $appInfo.link Link = $appInfo.link
Description = $appInfo.description Description = $appInfo.description
# Type is (Checkbox,Toggle,Button,Combobox ) (Default is Checkbox) # Type is (Checkbox,Toggle,Button,Combobox ) (Default is Checkbox)
@ -78,29 +79,54 @@ function Get-TabXaml {
Checked = $appInfo.Checked Checked = $appInfo.Checked
} }
if (-not $organizedData.ContainsKey($appInfo.panel)) { if (-not $organizedData.ContainsKey($appObject.panel)) {
$organizedData[$appInfo.panel] = @{} $organizedData[$appObject.panel] = @{}
} }
if (-not $organizedData[$appInfo.panel].ContainsKey($appInfo.Category)) { if (-not $organizedData[$appObject.panel].ContainsKey($appObject.Category)) {
$organizedData[$appInfo.panel][$appInfo.Category] = @{} $organizedData[$appObject.panel][$appObject.Category] = @{}
} }
# Store application data in a sub-array under the category # Store application data in a sub-array under the category
# Add Order property to keep the original order of tweaks and features # Add Order property to keep the original order of tweaks and features
$organizedData[$appInfo.panel][$appInfo.Category]["$($appInfo.order)$appName"] = $appObject $organizedData[$appObject.panel][$appInfo.Category]["$($appInfo.order)$appName"] = $appObject
} }
$panelcount=0 $panelcount=0
$paneltotal = $organizedData.Keys.Count
if ($columncount -gt 0) {
$appcount = $sync.configs.$tabname.PSObject.Properties.Name.count + $organizedData["0"].Keys.count
$maxcount = [Math]::Round( $appcount / $columncount + 0.5)
$paneltotal = $columncount
}
# add ColumnDefinitions to evenly draw colums # add ColumnDefinitions to evenly draw colums
$blockXml="<Grid.ColumnDefinitions>`n"+("<ColumnDefinition Width=""*""/>`n"*($organizedData.Keys.Count))+"</Grid.ColumnDefinitions>`n" $blockXml="<Grid.ColumnDefinitions>`n"+("<ColumnDefinition Width=""*""/>`n"*($paneltotal))+"</Grid.ColumnDefinitions>`n"
# Iterate through organizedData by panel, category, and application # Iterate through organizedData by panel, category, and application
$count = 0
foreach ($panel in ($organizedData.Keys | Sort-Object)) { foreach ($panel in ($organizedData.Keys | Sort-Object)) {
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n" $blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
$panelcount++ $panelcount++
foreach ($category in ($organizedData[$panel].Keys | Sort-Object)) { foreach ($category in ($organizedData[$panel].Keys | Sort-Object)) {
$count++
if ($columncount -gt 0) {
$panelcount2 = [Int](($count)/$maxcount-0.5)
if ($panelcount -eq $panelcount2 ) {
$blockXml +="`n</StackPanel>`n</Border>`n"
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
$panelcount++
}
}
$blockXml += "<Label Content=""$($category -replace '^.__', '')"" FontSize=""16""/>`n" $blockXml += "<Label Content=""$($category -replace '^.__', '')"" FontSize=""16""/>`n"
$sortedApps = $organizedData[$panel][$category].Keys | Sort-Object $sortedApps = $organizedData[$panel][$category].Keys | Sort-Object
foreach ($appName in $sortedApps) { foreach ($appName in $sortedApps) {
$count++
if ($columncount -gt 0) {
$panelcount2 = [Int](($count)/$maxcount-0.5)
if ($panelcount -eq $panelcount2 ) {
$blockXml +="`n</StackPanel>`n</Border>`n"
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
$panelcount++
}
}
$appInfo = $organizedData[$panel][$category][$appName] $appInfo = $organizedData[$panel][$category][$appName]
if ("Toggle" -eq $appInfo.Type) { if ("Toggle" -eq $appInfo.Type) {
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,10,0,0`">`n<Label Content=`"$($appInfo.Content)`" Style=`"{StaticResource labelfortweaks}`" ToolTip=`"$($appInfo.Description)`" />`n" $blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,10,0,0`">`n<Label Content=`"$($appInfo.Content)`" Style=`"{StaticResource labelfortweaks}`" ToolTip=`"$($appInfo.Description)`" />`n"
@ -136,7 +162,7 @@ function Get-TabXaml {
return ($blockXml) return ($blockXml)
} }
$tabcolums=Get-TabXaml "applications" $tabcolums=Get-TabXaml "applications" 5
$inputXML = $inputXML -replace "{{InstallPanel_applications}}", ($tabcolums) $inputXML = $inputXML -replace "{{InstallPanel_applications}}", ($tabcolums)
$tabcolums=Get-TabXaml "tweaks" $tabcolums=Get-TabXaml "tweaks"
$inputXML = $inputXML -replace "{{InstallPanel_tweaks}}", ($tabcolums) $inputXML = $inputXML -replace "{{InstallPanel_tweaks}}", ($tabcolums)
@ -208,7 +234,7 @@ $sync.keys | ForEach-Object {
Write-Debug "Opening: $($Sender.ToolTip)" Write-Debug "Opening: $($Sender.ToolTip)"
}) })
} }
} }
} }
} }
@ -327,7 +353,7 @@ $sync["Form"].Add_Deactivated({
$sync["Form"].Add_ContentRendered({ $sync["Form"].Add_ContentRendered({
try { try {
[void][Window] [void][Window]
} catch { } catch {
Add-Type @" Add-Type @"
@ -340,11 +366,11 @@ Add-Type @"
[DllImport("user32.dll")] [DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect); public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
[DllImport("user32.dll")] [DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool MoveWindow(IntPtr handle, int x, int y, int width, int height, bool redraw); public static extern bool MoveWindow(IntPtr handle, int x, int y, int width, int height, bool redraw);
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern int GetSystemMetrics(int nIndex); public static extern int GetSystemMetrics(int nIndex);
}; };
@ -408,7 +434,7 @@ Add-Type @"
} else { } else {
Write-Debug "Unable to retrieve information about the primary monitor." Write-Debug "Unable to retrieve information about the primary monitor."
} }
Invoke-WPFTab "WPFTab1BT" Invoke-WPFTab "WPFTab1BT"
$sync["Form"].Focus() $sync["Form"].Focus()
@ -460,20 +486,20 @@ $sync["CheckboxFilter"].Add_TextChanged({
$filter = Get-WinUtilVariables -Type CheckBox $filter = Get-WinUtilVariables -Type CheckBox
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $psitem.Key -in $filter } $CheckBoxes = $sync.GetEnumerator() | Where-Object { $psitem.Key -in $filter }
foreach ($CheckBox in $CheckBoxes) { foreach ($CheckBox in $CheckBoxes) {
# Check if the checkbox is null or if it doesn't have content # Check if the checkbox is null or if it doesn't have content
if ($CheckBox -eq $null -or $CheckBox.Value -eq $null -or $CheckBox.Value.Content -eq $null) { if ($CheckBox -eq $null -or $CheckBox.Value -eq $null -or $CheckBox.Value.Content -eq $null) {
continue continue
} }
$textToSearch = $sync.CheckboxFilter.Text $textToSearch = $sync.CheckboxFilter.Text
$checkBoxName = $CheckBox.Key $checkBoxName = $CheckBox.Key
$textBlockName = $checkBoxName + "Link" $textBlockName = $checkBoxName + "Link"
# Retrieve the corresponding text block based on the generated name # Retrieve the corresponding text block based on the generated name
$textBlock = $sync[$textBlockName] $textBlock = $sync[$textBlockName]
if ($CheckBox.Value.Content.ToLower().Contains($textToSearch)) { if ($CheckBox.Value.Content.ToLower().Contains($textToSearch)) {
$CheckBox.Value.Visibility = "Visible" $CheckBox.Value.Visibility = "Visible"
# Set the corresponding text block visibility # Set the corresponding text block visibility
@ -489,7 +515,7 @@ $sync["CheckboxFilter"].Add_TextChanged({
} }
} }
} }
}) })
# Define event handler for button click # Define event handler for button click
@ -533,7 +559,7 @@ GUI : @KonTy
MicroWin : @KonTy MicroWin : @KonTy
GitHub : https://github.com/ChrisTitusTech/winutil GitHub : https://github.com/ChrisTitusTech/winutil
Version : $($sync.version) Version : $($sync.version)
"@ "@
Show-CustomDialog -Message $authorInfo -Width 400 Show-CustomDialog -Message $authorInfo -Width 400
}) })

File diff suppressed because it is too large Load Diff