From 4d12e01b0c8039fdfbf89a581d24f2b951917068 Mon Sep 17 00:00:00 2001 From: pomodori92 Date: Fri, 10 Apr 2026 00:13:30 +0200 Subject: [PATCH 1/6] Refactored Install-GitPackage check and removed useless variable wingetDeepCheck --- start.ps1 | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/start.ps1 b/start.ps1 index b71d909..d2d3f40 100644 --- a/start.ps1 +++ b/start.ps1 @@ -20,11 +20,11 @@ $script:AppConfig = @{ # ============================================================================ # HEADER CONFIGURATION - Modifica qui per aggiornare titolo e versione # ============================================================================ - Header = @{ + Header = @{ Title = "Toolkit Starter By MagnetarMan" Version = "Version 2.5.4 (Build 4)" } - URLs = @{ + URLs = @{ StartScript = "https://raw.githubusercontent.com/Magnetarman/WinToolkit/refs/heads/Dev/start.ps1" WingetMSIX = "https://aka.ms/getwinget" GitRelease = "https://api.github.com/repos/git-for-windows/git/releases/latest" @@ -36,7 +36,7 @@ $script:AppConfig = @{ TerminalRelease = "https://api.github.com/repos/microsoft/terminal/releases/latest" WebInstaller = "https://magnetarman.com/WinToolkit-Dev" } - Paths = @{ + Paths = @{ Logs = "$env:LOCALAPPDATA\WinToolkit\logs" WinToolkitDir = "$env:LOCALAPPDATA\WinToolkit" Temp = "$env:TEMP\WinToolkitSetup" @@ -45,7 +45,7 @@ $script:AppConfig = @{ wtExe = "$env:LOCALAPPDATA\Microsoft\WindowsApps\wt.exe" wtDir = "$env:LOCALAPPDATA\Microsoft\WindowsApps" } - Registry = @{ + Registry = @{ TerminalStartup = "HKCU:\Console\%%Startup" } WindowsTerminal = @{ @@ -1475,13 +1475,18 @@ function Invoke-WinToolkitSetup { Write-StyledMessage -Type Success -Text "✅ Winget è già operativo." } - # Validazione profonda - $wingetDeepCheck = Test-WingetDeepValidation - if (-not $wingetDeepCheck) { + # Verifica in modo approfondito che Winget funzioni correttamente. + if (-not $(Test-WingetDeepValidation)) { Write-StyledMessage -Type Warning -Text "⚠️ Attenzione: l'installazione dei pacchetti successivi via Winget potrebbe fallire." } - $gitInstalled = Install-GitPackage + # Verifica se l'installazione di Git è andata a buon fine. + if (Install-GitPackage) { + Write-StyledMessage -Type Success -Text "✅ Git è già operativo." + } + else { + Write-StyledMessage -Type Warning -Text "⚠️ Attenzione: Git non è stato installato oppure potrebbe non funzionare correttamente." + } # Controllo rapido che non richieda chiamate e garantisca fallback veloce if (-not (Test-Path "$env:ProgramFiles\PowerShell\7") -and -not (Test-Path "${env:ProgramFiles(x86)}\PowerShell\7") -and -not (Get-Command pwsh -ErrorAction SilentlyContinue)) { @@ -1538,7 +1543,8 @@ function Invoke-WinToolkitSetup { if ($isResumeSetup) { Write-StyledMessage -Type Info -Text "Installazione ripresa, sessione completata." - } else { + } + else { $canLaunchWT = (Get-Command "wt.exe" -ErrorAction SilentlyContinue) if (-not ($env:WT_SESSION) -and $canLaunchWT) { Write-StyledMessage -Type Info -Text "Riavvio dello script in Windows Terminal." From 458764e2052f39af43375575fa4742f1c35aee9e Mon Sep 17 00:00:00 2001 From: pomodori92 Date: Thu, 16 Apr 2026 22:17:52 +0200 Subject: [PATCH 2/6] Fix: window resolution decreased to HD ready for small screens. --- WinToolkit_GUI.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WinToolkit_GUI.ps1 b/WinToolkit_GUI.ps1 index 0e26261..ac7ae16 100644 --- a/WinToolkit_GUI.ps1 +++ b/WinToolkit_GUI.ps1 @@ -25,8 +25,8 @@ $Global:GuiVersion = "3.0.0 (Build 3)" # Format: CoreVersion.GuiBuildNumber # ============================================================================= $ScriptTitle = "WinToolkit GUI Edition By MagnetarMan" $LogDirectory = "$env:LOCALAPPDATA\WinToolkit\logs" -$WindowWidth = 1600 # Increased from 1500 for better readability -$WindowHeight = 1000 # Increased from 950 for better readability +$WindowWidth = 1280 # HD ready resolution in 16:9. +$WindowHeight = 720 # HD ready resolution in 16:9. $FontFamily = "JetBrains Mono Nerd Font, Cascadia Code, Consolas, Courier New" $FontSize = @{Small = 14; Medium = 16; Large = 18; Title = 20 } From 2f7ac92b27212e2531d916ea615d66e99fbca028 Mon Sep 17 00:00:00 2001 From: pomodori92 Date: Thu, 16 Apr 2026 22:21:59 +0200 Subject: [PATCH 3/6] style: breaklines --- WinToolkit_GUI.ps1 | 58 +++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/WinToolkit_GUI.ps1 b/WinToolkit_GUI.ps1 index ac7ae16..3d4352d 100644 --- a/WinToolkit_GUI.ps1 +++ b/WinToolkit_GUI.ps1 @@ -1204,7 +1204,8 @@ try { if (Test-Path $iconPath) { $window.Icon = [System.Windows.Media.Imaging.BitmapImage]::new([uri]$iconPath) } - } catch { + } + catch { Write-UnifiedLog -Type 'Warning' -Message "⚠️ Impossibile caricare o scaricare l'icona della finestra: $($_.Exception.Message)." -GuiColor "#FFA500" } @@ -1613,9 +1614,8 @@ function Filter-AndFormatJobOutput { # IMPROVED VERBOSITY: Log only if percentage OR status has changed if ( ($status -ne $Global:LastLoggedProgress.Status) -or - ($percent -ne $Global:LastLoggedProgress.Percent) - ) - { + ($percent -ne $Global:LastLoggedProgress.Percent) + ) { Write-UnifiedLog -Type 'Progress' -Message "🔄 [$activity] $status ($percent%)." -GuiColor "#2196F3" $Global:LastLoggedProgress.Percent = $percent $Global:LastLoggedProgress.Status = $status @@ -1994,10 +1994,10 @@ function Start-NextScriptJob { if (-not [string]::IsNullOrEmpty($output)) { # If it's already a tagged message, don't double tag it if ($output -match '\[WINTOOLKIT_.*_TAG\]') { - Write-Warning $output + Write-Warning $output } else { - Write-Warning "[WINTOOLKIT_RAW_HOST_OUTPUT_TAG]$output" + Write-Warning "[WINTOOLKIT_RAW_HOST_OUTPUT_TAG]$output" } } } @@ -2174,10 +2174,10 @@ function Tick_JobMonitor { try { if ($window -and $window.Dispatcher) { $window.Dispatcher.Invoke([Action] { - foreach ($line in ($newOutputLines | Out-String -Stream)) { - [void](Filter-AndFormatJobOutput -Line $line) - } - }) + foreach ($line in ($newOutputLines | Out-String -Stream)) { + [void](Filter-AndFormatJobOutput -Line $line) + } + }) } } catch { @@ -2322,27 +2322,27 @@ $window.Add_Loaded({ # Cleanup handler for Window Closing to kill running jobs $window.Add_Closing({ - if ($Global:ScriptJob) { - Write-UnifiedLog -Type 'Info' -Message "🚨 Finestra GUI chiusa. Tentativo di fermare il job in corso." -GuiColor "#FFA500" - try { - Stop-Job -Job $Global:ScriptJob -Force -ErrorAction SilentlyContinue | Out-Null - Remove-Job -Job $Global:ScriptJob -Force -ErrorAction SilentlyContinue | Out-Null - $Global:ScriptJob = $null - Write-UnifiedLog -Type 'Success' -Message "✅ Job in corso fermato e rimosso." -GuiColor "#00FF00" + if ($Global:ScriptJob) { + Write-UnifiedLog -Type 'Info' -Message "🚨 Finestra GUI chiusa. Tentativo di fermare il job in corso." -GuiColor "#FFA500" + try { + Stop-Job -Job $Global:ScriptJob -Force -ErrorAction SilentlyContinue | Out-Null + Remove-Job -Job $Global:ScriptJob -Force -ErrorAction SilentlyContinue | Out-Null + $Global:ScriptJob = $null + Write-UnifiedLog -Type 'Success' -Message "✅ Job in corso fermato e rimosso." -GuiColor "#00FF00" + } + catch { + Write-UnifiedLog -Type 'Error' -Message "❌ Errore durante l'interruzione del job: $($_.Exception.Message)." -GuiColor "#FF0000" + } } - catch { - Write-UnifiedLog -Type 'Error' -Message "❌ Errore durante l'interruzione del job: $($_.Exception.Message)." -GuiColor "#FF0000" + if ($Global:JobMonitorTimer) { + $Global:JobMonitorTimer.Stop() + $Global:JobMonitorTimer = $null } - } - if ($Global:JobMonitorTimer) { - $Global:JobMonitorTimer.Stop() - $Global:JobMonitorTimer = $null - } - try { - Stop-Transcript -ErrorAction SilentlyContinue - } - catch {} -}) + try { + Stop-Transcript -ErrorAction SilentlyContinue + } + catch {} + }) # Show window $window.ShowDialog() | Out-Null From 710046e53041ffe36bf5a990aa2721ff30e5e798 Mon Sep 17 00:00:00 2001 From: pomodori92 Date: Thu, 16 Apr 2026 22:25:57 +0200 Subject: [PATCH 4/6] refactor: merged two opposite if statements in if-else statement. --- WinToolkit_GUI.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/WinToolkit_GUI.ps1 b/WinToolkit_GUI.ps1 index 3d4352d..cd8cd9a 100644 --- a/WinToolkit_GUI.ps1 +++ b/WinToolkit_GUI.ps1 @@ -1200,8 +1200,7 @@ try { if (-not (Test-Path $iconPath)) { Invoke-WebRequest -Uri $iconUrl -OutFile $iconPath -UseBasicParsing -ErrorAction Stop } - - if (Test-Path $iconPath) { + else { $window.Icon = [System.Windows.Media.Imaging.BitmapImage]::new([uri]$iconPath) } } From 7b0b2539f98271968728b6919503381dd20688d7 Mon Sep 17 00:00:00 2001 From: pomodori92 Date: Thu, 16 Apr 2026 22:39:09 +0200 Subject: [PATCH 5/6] refactor: Removed script names in "Funzioni disponibili". --- WinToolkit_GUI.ps1 | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/WinToolkit_GUI.ps1 b/WinToolkit_GUI.ps1 index cd8cd9a..062338b 100644 --- a/WinToolkit_GUI.ps1 +++ b/WinToolkit_GUI.ps1 @@ -1523,23 +1523,11 @@ function Update-ActionsPanel { # Bold Script Name (White) $titleRun = New-Object System.Windows.Documents.Run - $titleRun.Text = $script.Name + $titleRun.Text = $script.Description $titleRun.FontWeight = [System.Windows.FontWeights]::Bold $titleRun.Foreground = New-Object System.Windows.Media.SolidColorBrush([System.Windows.Media.Colors]::White) - - # Separator (Gray #BDBDBD) - $separatorRun = New-Object System.Windows.Documents.Run - $separatorRun.Text = " - " - $separatorRun.Foreground = New-Object System.Windows.Media.SolidColorBrush([System.Windows.Media.ColorConverter]::ConvertFromString("#BDBDBD")) - - # Description (Gray #BDBDBD) - $descRun = New-Object System.Windows.Documents.Run - $descRun.Text = $script.Description - $descRun.Foreground = New-Object System.Windows.Media.SolidColorBrush([System.Windows.Media.ColorConverter]::ConvertFromString("#BDBDBD")) - + $textBlock.Inlines.Add($titleRun) - $textBlock.Inlines.Add($separatorRun) - $textBlock.Inlines.Add($descRun) $scriptRow.Children.Add($textBlock) | Out-Null $actionsPanel.Children.Add($scriptRow) | Out-Null From a51a2d4d35b73da523b318db48873c8df91343a2 Mon Sep 17 00:00:00 2001 From: Magnetar Man <40738529+Magnetarman@users.noreply.github.com> Date: Fri, 17 Apr 2026 11:30:46 +0200 Subject: [PATCH 6/6] Update GUI version to 3.0.0 (Build 4) --- WinToolkit_GUI.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WinToolkit_GUI.ps1 b/WinToolkit_GUI.ps1 index 062338b..e5c30b2 100644 --- a/WinToolkit_GUI.ps1 +++ b/WinToolkit_GUI.ps1 @@ -18,7 +18,7 @@ $Global:GuiSessionActive = $true # ============================================================================= # GUI VERSION CONFIGURATION (Separate from Core Version) # ============================================================================= -$Global:GuiVersion = "3.0.0 (Build 3)" # Format: CoreVersion.GuiBuildNumber +$Global:GuiVersion = "3.0.0 (Build 4)" # Format: CoreVersion.GuiBuildNumber # ============================================================================= # CONFIGURATION AND CONSTANTS