`architecture`: moved scripts from utils to a new folder on scripts

- Updated some GUI elements positioning
main
Plínio Larrubia 2 years ago committed by Plínio Larrubia
parent 679fad9d8b
commit 5410c2b619
No known key found for this signature in database
GPG Key ID: 057B0A87CB137C69

@ -120,9 +120,9 @@ function Show-GUI() {
$CbEncryptedDNS = New-CheckBox -Text "Enable Encrypted DNS" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbCortana
$CbOldVolumeControl = New-CheckBox -Text "Enable Old Volume Control" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbEncryptedDNS
$CbPhotoViewer = New-CheckBox -Text "Enable Photo Viewer" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbOldVolumeControl
$CbSearchIdx = New-CheckBox -Text "Enable WSearch Service" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbPhotoViewer
$CbTelemetry = New-CheckBox -Text "Enable Telemetry" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbSearchIdx
$CbXboxGameBarAndDVR = New-CheckBox -Text "Enable Xbox GameBar/DVR" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbTelemetry
$CbTelemetry = New-CheckBox -Text "Enable Telemetry" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbPhotoViewer
$CbWSearchService = New-CheckBox -Text "Enable WSearch Service" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbTelemetry
$CbXboxGameBarAndDVR = New-CheckBox -Text "Enable Xbox GameBar/DVR" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $CbWSearchService
$ClMiscFeatures = New-Label -Text "Miscellaneous Features" -Width $PanelWidth -Height $CaptionLabelHeight -LocationX 0 -ElementBefore $CbXboxGameBarAndDVR
$HEVCSupport = New-Button -Text "Get H.265 video codec" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $ClMiscFeatures
$CbGodMode = New-CheckBox -Text "Enable God Mode" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $HEVCSupport
@ -189,7 +189,7 @@ function Show-GUI() {
$InstallMozillaFirefox = New-CheckBox -Text "Mozilla Firefox" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $InstallGoogleChrome
$ClAudioVideoTools = New-Label -Text "Audio/Video Tools" -Width $PanelElementWidth -Height $CaptionLabelHeight -LocationX $PanelElementX -ElementBefore $InstallMozillaFirefox
$InstallAudacity = New-CheckBox -Text "Audacity (Editor)" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $ClAudioVideoTools
$InstallMpcHc = New-CheckBox -Text "MPC-HC from clsid2 (Player)" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $InstallAudacity
$InstallMpcHc = New-CheckBox -Text "MPC-HC (Player)" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $InstallAudacity
$InstallVlc = New-CheckBox -Text "VLC (Player)" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $InstallMpcHc
$ClImageTools = New-Label -Text "Image Tools" -Width $PanelElementWidth -Height $CaptionLabelHeight -LocationX $PanelElementX -ElementBefore $InstallVlc
$InstallGimp = New-CheckBox -Text "GIMP" -Width $PanelElementWidth -Height $CheckBoxHeight -LocationX $PanelElementX -ElementBefore $ClImageTools
@ -313,7 +313,7 @@ function Show-GUI() {
# Add Elements to each Tab Panel
$T1Panel1.Controls.AddRange(@($ClDebloatTools, $ApplyTweaks, $UndoTweaks, $RemoveOneDrive, $RemoveXbox, $InstallOneDrive, $ReinstallBloatApps, $RepairWindows, $ShowDebloatInfo, $PictureBox1))
$T1Panel2.Controls.AddRange(@($ClCustomizeFeatures))
$T1Panel2.Controls.AddRange(@($CbDarkTheme, $CbActivityHistory, $CbBackgroundsApps, $CbClipboardHistory, $CbCortana, $CbEncryptedDNS, $CbOldVolumeControl, $CbPhotoViewer, $CbSearchIdx, $CbTelemetry, $CbXboxGameBarAndDVR))
$T1Panel2.Controls.AddRange(@($CbDarkTheme, $CbActivityHistory, $CbBackgroundsApps, $CbClipboardHistory, $CbCortana, $CbEncryptedDNS, $CbOldVolumeControl, $CbPhotoViewer, $CbTelemetry, $CbWSearchService, $CbXboxGameBarAndDVR))
$T1Panel2.Controls.AddRange(@($ClMiscFeatures, $HEVCSupport, $CbGodMode, $CbTakeOwnership, $CbShutdownPCShortcut))
$T2Panel1.Controls.AddRange(@($UpgradeAll))
@ -400,7 +400,7 @@ function Show-GUI() {
})
$InstallOneDrive.Add_Click( {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("install-onedrive.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("install-onedrive.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
})
$ReinstallBloatApps.Add_Click( {
@ -408,7 +408,7 @@ function Show-GUI() {
})
$ShowDebloatInfo.Add_Click( {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("show-debloat-info.ps1") -NoDialog
Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("show-debloat-info.ps1") -NoDialog
})
$CbDarkTheme.Add_Click( {
@ -491,16 +491,6 @@ function Show-GUI() {
}
})
$CbSearchIdx.Add_Click( {
If ($CbSearchIdx.CheckState -eq "Checked") {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("enable-wsearch-service.ps1") -NoDialog
$CbSearchIdx.Text = "[ON] WSearch Service *"
} Else {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("disable-wsearch-service.ps1") -NoDialog
$CbSearchIdx.Text = "[OFF] WSearch Service"
}
})
$CbTelemetry.Add_Click( {
If ($CbTelemetry.CheckState -eq "Checked") {
Open-RegFilesCollection -RelativeLocation "src\utils" -Scripts @("enable-telemetry.reg") -NoDialog
@ -511,6 +501,16 @@ function Show-GUI() {
}
})
$CbWSearchService.Add_Click( {
If ($CbWSearchService.CheckState -eq "Checked") {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("enable-wsearch-service.ps1") -NoDialog
$CbWSearchService.Text = "[ON] WSearch Service *"
} Else {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("disable-wsearch-service.ps1") -NoDialog
$CbWSearchService.Text = "[OFF] WSearch Service"
}
})
$CbXboxGameBarAndDVR.Add_Click( {
If ($CbXboxGameBarAndDVR.CheckState -eq "Checked") {
Open-RegFilesCollection -RelativeLocation "src\utils" -Scripts @("enable-game-bar-dvr.reg") -NoDialog
@ -522,7 +522,7 @@ function Show-GUI() {
})
$HEVCSupport.Add_Click( {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("get-hevc-support.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("get-hevc-support.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
})
$CbGodMode.Add_Click( {
@ -556,7 +556,7 @@ function Show-GUI() {
})
$UpgradeAll.Add_Click( {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("upgrade-all-packages.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("update-all-packages.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
})
$InstallSelected.Add_Click( {
@ -1066,7 +1066,7 @@ function Show-GUI() {
If ($InstallWSLgOrPreview.CheckState -eq "Checked") {
If (!($Script:UninstallSwitch)) {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("install-wslg-or-preview.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("install-wslg-or-preview.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
} Else {
$AppsSelected.MSStoreApps.Add("9P9TQF7MRM4R")
}
@ -1075,7 +1075,7 @@ function Show-GUI() {
If ($InstallArchWSL.CheckState -eq "Checked") {
If (!($Script:UninstallSwitch)) {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("install-archwsl.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("install-archwsl.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
} Else {
$AppsSelected.WSLDistros.Add("Arch")
}
@ -1131,14 +1131,14 @@ function Show-GUI() {
If ($InstallNerdFonts.CheckState -eq "Checked") {
If (!($Script:UninstallSwitch)) {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("install-nerd-fonts.ps1")
Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("install-nerd-fonts.ps1")
}
$InstallNerdFonts.CheckState = "Unchecked"
}
If ($InstallGitGnupgSshSetup.CheckState -eq "Checked") {
If (!($Script:UninstallSwitch)) {
Open-PowerShellFilesCollection -RelativeLocation "src\utils" -Scripts @("git-gnupg-ssh-keys-setup.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
Open-PowerShellFilesCollection -RelativeLocation "src\scripts\other-scripts" -Scripts @("git-gnupg-ssh-keys-setup.ps1") -DoneTitle $DoneTitle -DoneMessage $DoneMessage
} Else {
$AppsSelected.WingetApps.AddRange(@("Git.Git", "GnuPG.GnuPG")) # Installed before inside the script
}

@ -1,5 +1,5 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"manage-software.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"manage-software.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1"
function Get-HEVCSupport() {
Write-Status -Types "+" -Status "Adding support to HEVC/H.265 video codec (MUST HAVE)..."

@ -1,7 +1,7 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"manage-software.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"select-folder-gui.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"manage-software.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"select-folder-gui.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"show-dialog-window.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1"
function Request-AdminPrivilege() {
# Used from https://stackoverflow.com/a/31602095 because it preserves the working directory!
@ -216,38 +216,34 @@ function Import-KeysSshGpg() {
}
}
function Main() {
$Ask = "Before everything, your data will only be keep locally, only in YOUR PC.`nI've made this to be more productive and not to lose time setting up signing keys on Windows.`n`nThis setup cover:`n- Git user name and email`n- SSH and GPG keys full creation and import (even other keys from ~\.ssh and ~\.gnupg)`n- Or import existing SSH and GPG keys (only changes git config gpg.program)`n`nDo you want to proceed?"
Request-AdminPrivilege
Install-Software -Name "Git + GnuPG" -Packages @("Git.Git", "GnuPG.GnuPG") -NoDialog
switch (Show-Question -Title "Warning" -Message $Ask -BoxIcon "Warning") {
'Yes' {
Set-GitProfile
$Ask = "Are you creating new SSH and GPG keys?`n`nYes: Proceed to keys creation`nNo: Import Keys from selected folder`n`nReminder: for those who selected 'No', you must do manually, the configs for`n- git config --global user.signingkey (YOUR KEY)`n- git config --global commit.gpgsign true"
Enable-SshAndGpgAgent
switch (Show-Question -Title "Warning" -Message $Ask -BoxIcon "Warning") {
'Yes' {
Set-SSHKey
Set-GPGKey
}
'No' {
Import-KeysSshGpg
}
'Cancel' {
Write-Host "Aborting..."
}
$Ask = "Before everything, your data will only be keep locally, only in YOUR PC.`nI've made this to be more productive and not to lose time setting up signing keys on Windows.`n`nThis setup cover:`n- Git user name and email`n- SSH and GPG keys full creation and import (even other keys from ~\.ssh and ~\.gnupg)`n- Or import existing SSH and GPG keys (only changes git config gpg.program)`n`nDo you want to proceed?"
Request-AdminPrivilege
Install-Software -Name "Git + GnuPG" -Packages @("Git.Git", "GnuPG.GnuPG") -NoDialog
switch (Show-Question -Title "Warning" -Message $Ask -BoxIcon "Warning") {
'Yes' {
Set-GitProfile
$Ask = "Are you creating new SSH and GPG keys?`n`nYes: Proceed to keys creation`nNo: Import Keys from selected folder`n`nReminder: for those who selected 'No', you must do manually, the configs for`n- git config --global user.signingkey (YOUR KEY)`n- git config --global commit.gpgsign true"
Enable-SshAndGpgAgent
switch (Show-Question -Title "Warning" -Message $Ask -BoxIcon "Warning") {
'Yes' {
Set-SSHKey
Set-GPGKey
}
'No' {
Import-KeysSshGpg
}
'Cancel' {
Write-Host "Aborting..."
}
}
'No' {
Write-Host "Aborting..."
}
'Cancel' {
Write-Host "Aborting..."
}
}
'No' {
Write-Host "Aborting..."
}
'Cancel' {
Write-Host "Aborting..."
}
}
Main

@ -1,8 +1,8 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"download-web-file.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"get-hardware-info.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"download-web-file.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"get-hardware-info.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1"
function ArchWSLInstall() {
function Install-ArchWSL() {
$OSArchList = Get-OSArchitecture
ForEach ($OSArch in $OSArchList) {
@ -26,8 +26,4 @@ function ArchWSLInstall() {
}
}
function Main() {
ArchWSLInstall
}
Main
Install-ArchWSL

@ -1,9 +1,9 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"download-web-file.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"install-font.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"download-web-file.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"install-font.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1"
function Install-NerdFont() {
Push-Location -Path "$PSScriptRoot\..\tmp"
Push-Location -Path "$PSScriptRoot\..\..\tmp"
mkdir "Fonts" | Out-Null
Write-Status -Types "@" -Status "Downloading JetBrains Mono ..."
@ -35,8 +35,4 @@ function Install-MesloLGS() {
}
}
function Main() {
Install-NerdFont
}
Main
Install-NerdFont

@ -1,4 +1,4 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1"
function Install-OneDrive() {
Write-Status -Types "+" -Status "Installing OneDrive..."
@ -6,8 +6,4 @@ function Install-OneDrive() {
Start-Process -FilePath "$env:SystemRoot\SysWOW64\OneDriveSetup.exe"
}
function Main() {
Install-OneDrive
}
Main
Install-OneDrive

@ -1,7 +1,7 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"download-web-file.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"get-hardware-info.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"manage-software.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"download-web-file.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"get-hardware-info.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"manage-software.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1"
function Install-WSLPreview() {
[CmdletBinding()] param()
@ -20,8 +20,8 @@ function Install-WSLPreview() {
Try {
Write-Status -Types "?", $TweakType "Installing WSL Preview from MS Store for Windows 11+ ..." -Warning
$CheckExistenceBlock = { Install-Software -Name "WSL Preview (Win 11+)" -Packages "9P9TQF7MRM4R" -ViaMSStore -NoDialog }
$Err = (Invoke-Expression "$CheckExistenceBlock") | Out-Host
If (($LASTEXITCODE)) { throw $Err } # 0 = False, 1 = True
Invoke-Expression "$CheckExistenceBlock" | Out-Host
If (($LASTEXITCODE)) { throw "This package is not available for Windows 10, you must be on Windows 11+" } # 0 = False, 1 = True
Write-Status -Types "-", $TweakType -Status "Uninstalling WSL from Optional Features ..."
Get-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" | Where-Object State -Like "Enabled" | Disable-WindowsOptionalFeature -Online -NoRestart
@ -69,8 +69,4 @@ function Install-WSLTwoAndG() {
}
}
function Main {
Install-WSLPreview
}
Main
Install-WSLPreview

@ -1,4 +1,5 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"show-dialog-window.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"show-dialog-window.psm1"
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"ui-helper.psm1" # Load UI libs
function Show-DebloatInfo {
[CmdletBinding()]
@ -56,11 +57,7 @@ Storage Available ($env:SystemDrive): $($AvailableStorage.ToString("#.#"))/$($To
}
}
function Main() {
Show-DebloatInfo
}
Main
Show-DebloatInfo
<#
Example:

@ -0,0 +1,27 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\..\lib\"title-templates.psm1"
function Update-AllPackage() {
Write-Section "Upgrade all Packages"
Try {
Write-Caption "Winget"
winget upgrade --all --silent | Out-Host
} Catch {
Write-Status -Types "!" -Status "Failed to upgrade packages through Winget (maybe it's uninstalled?)" -Warning
}
Try {
Write-Caption "Chocolatey"
choco upgrade all --ignore-dependencies --yes | Out-Host
} Catch {
Write-Status -Types "!" -Status "Failed to upgrade packages through Chocolatey (maybe it's uninstalled?)" -Warning
}
Try {
Write-Caption "WSL"
wsl --update | Out-Host
} Catch {
Write-Status -Types "!" -Status "Failed to upgrade packages through WSL (maybe it's uninstalled?)" -Warning
}
}
Update-AllPackage

@ -1,13 +0,0 @@
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\"title-templates.psm1"
function Main() {
Write-Section "Upgrade all Packages"
Write-Caption "Winget"
winget upgrade --all --silent | Out-Host
Write-Caption "Chocolatey"
choco upgrade all --ignore-dependencies --yes | Out-Host
Write-Caption "WSL"
wsl --update | Out-Host
}
Main
Loading…
Cancel
Save