Merge branch 'main' into microwin-250410

This commit is contained in:
CodingWonders 2025-04-16 17:19:30 +02:00
commit 2aedb31b4e
5 changed files with 59 additions and 14 deletions

View File

@ -701,7 +701,7 @@
"content": "GIMP (Image Editor)",
"description": "GIMP is a versatile open-source raster graphics editor used for tasks such as photo retouching, image editing, and image composition.",
"link": "https://www.gimp.org/",
"winget": "GIMP.GIMP"
"winget": "GIMP.GIMP.3"
},
"git": {
"category": "Development",

View File

@ -3812,6 +3812,6 @@
Write-Host Please sign out and back in, or restart your computer to apply the changes!
"
],
},
]
}
}

View File

@ -0,0 +1,43 @@
function Set-PackageManagerPreference {
<#
.SYNOPSIS
Sets the currently selected package manager to global "ManagerPreference" in sync.
Also persists preference across Winutil restarts via preference.ini.
Reads from preference.ini if no argument sent.
.PARAMETER preferedPackageManager
The PackageManager that was selected.
#>
param(
[Parameter(Position=0, Mandatory=$false)]
[PackageManagers]$preferedPackageManager
)
$preferencePath = "$env:LOCALAPPDATA\winutil\preferences.ini"
$oldChocoPath = "$env:LOCALAPPDATA\winutil\preferChocolatey.ini"
#Try loading from file if no argument given.
if ($null -eq $preferedPackageManager) {
# Backwards compat for preferChocolatey.ini
if (Test-Path -Path $oldChocoPath) {
$preferedPackageManager = [PackageManagers]::Choco
Remove-Item -Path $oldChocoPath
}
elseif (Test-Path -Path $preferencePath) {
$potential = Get-Content -Path $preferencePath -TotalCount 1
$preferedPackageManager = [PackageManagers]$potential
}
else {
Write-Debug "Creating new preference file, defaulting to winget."
$preferedPackageManager = [PackageManagers]::Winget
}
}
$sync["ManagerPreference"] = [PackageManagers]::$preferedPackageManager
Write-Debug "Manager Preference changed to '$($sync["ManagerPreference"])'"
# Write preference to file to persist across restarts.
Out-File -FilePath $preferencePath -InputObject $sync["ManagerPreference"]
}

View File

@ -123,9 +123,6 @@ Invoke-WPFUIElements -configVariable $sync.configs.appnavigation -targetGridName
$sync.WPFToggleView.Add_Click({
$sync.CompactView = -not $sync.CompactView
Update-AppTileProperties
if ($sync.SearchBar.Text -eq "") {
Set-CategoryVisibility -Category "*"
}
})
Invoke-WPFUIApps -Apps $sync.configs.applicationsHashtable -targetGridName "appspanel"
@ -186,7 +183,6 @@ $sync.keys | ForEach-Object {
# Load computer information in the background
Invoke-WPFRunspace -ScriptBlock {
try {
$oldProgressPreference = $ProgressPreference
$ProgressPreference = "SilentlyContinue"
$sync.ConfigLoaded = $False
$sync.ComputerInfo = Get-ComputerInfo
@ -204,12 +200,6 @@ Invoke-WPFRunspace -ScriptBlock {
# Print the logo
Invoke-WPFFormVariables
$sync.CompactView = $false
$sync.Form.Resources.AppTileWidth = [double]::NaN
$sync.Form.Resources.AppTileCompactVisibility = [Windows.Visibility]::Visible
$sync.Form.Resources.AppTileFontSize = [double]16
$sync.Form.Resources.AppTileMargins = [Windows.Thickness]5
$sync.Form.Resources.AppTileBorderThickness = [Windows.Thickness]0
function Update-AppTileProperties {
if ($sync.CompactView -eq $true) {
$sync.Form.Resources.AppTileWidth = [double]::NaN
@ -219,13 +209,24 @@ function Update-AppTileProperties {
$sync.Form.Resources.AppTileBorderThickness = [Windows.Thickness]0
}
else {
$sync.Form.Resources.AppTileWidth = $sync.ItemsControl.ActualWidth -20
# On first load, set the AppTileWidth to NaN because the Window dosnt exist yet and there is no ActuaWidth
if ($sync.ItemsControl.ActualWidth -gt 0) {
$sync.Form.Resources.AppTileWidth = $sync.ItemsControl.ActualWidth -20}
else {
$sync.Form.Resources.AppTileWidth = [double]::NaN
}
$sync.Form.Resources.AppTileCompactVisibility = [Windows.Visibility]::Visible
$sync.Form.Resources.AppTileFontSize = [double]16
$sync.Form.Resources.AppTileMargins = [Windows.Thickness]5
$sync.Form.Resources.AppTileBorderThickness = [Windows.Thickness]1
}
if ($sync.SearchBar.Text -eq "") {
Set-CategoryVisibility -Category "*"
}
}
# initialize AppTile properties
Update-AppTileProperties
# We need to update the app tile properties when the form is resized because to fill a WrapPanel update the width of the elemenmt manually (afaik)
$sync.Form.Add_SizeChanged({
Update-AppTileProperties

View File

@ -42,6 +42,7 @@ $sync.ProcessRunning = $false
$sync.selectedApps = [System.Collections.Generic.List[string]]::new()
$sync.ShowOnlySeleced = $false
$sync.currentTab = "Install"
$sync.CompactView = $true
$sync.ShowOnlySelected = $false
$sync.selectedAppsStackPanel
$sync.selectedAppsPopup