Compare commits

...

19 Commits

Author SHA1 Message Date
ChrisTitusTech
18de3d59ee Deploying to main from @ ChrisTitusTech/winutil@59d968e7c4 🚀 2025-06-14 15:32:56 +00:00
ChrisTitusTech
59d968e7c4 Deploying to main from @ ChrisTitusTech/winutil@afe85ad7f0 🚀 2025-06-06 15:33:48 +00:00
ChrisTitusTech
afe85ad7f0 Deploying to main from @ ChrisTitusTech/winutil@efb9e5bde6 🚀 2025-06-03 15:35:28 +00:00
Martin Wiethan
efb9e5bde6
correct uninstall variable (#3384) 2025-06-01 10:40:37 -05:00
ChrisTitusTech
56eba47a6c Deploying to main from @ ChrisTitusTech/winutil@e57cde423c 🚀 2025-05-30 15:34:17 +00:00
ChrisTitusTech
e57cde423c Deploying to main from @ ChrisTitusTech/winutil@de9b643129 🚀 2025-05-27 15:34:49 +00:00
Chris Titus
de9b643129 add signing shortcut 2025-05-23 11:26:48 -05:00
Chris Titus
e430e0aad0 revert single form window 2025-05-23 11:22:44 -05:00
Chris Titus
61fd4d2f91 update authors 2025-05-23 11:20:23 -05:00
Chris Titus
b72cd83189 Remove Old Code-Signing 2025-05-23 11:15:18 -05:00
Martin Wiethan
290292ec94
Refactor process termination for explorer.exe in tweaks.json (#3375) 2025-05-23 11:04:26 -05:00
Martin Wiethan
d22865d79b
Fix App references (#3374)
* Update winget reference

* Remove Samsung Magician entry from applications.json as it dosn't exist in winget anymore
2025-05-23 11:03:00 -05:00
Nilesh
5c5b999a09
Change WindowStyle to SingleBorderWindow (#3373) 2025-05-23 10:59:54 -05:00
Martin Wiethan
0c0e6bd243
Implement search bar debounce functionality to improve UI responsiveness (#3371)
* Implement search bar debounce functionality to improve UI responsiveness

* Enhance app search functionality to include description matching
2025-05-23 10:56:24 -05:00
Alice Lia Stapleton
dd06489d63
Windows Spotlight warning (#3354)
Adds a warning for the problem encountered in issue 3203
2025-05-23 10:53:33 -05:00
Martin Wiethan
41df9d3d88
Add Right-Click Action on App Install Page (#3367)
* Add right click context menu for app entries with install, uninstall, and info options

* Add hand cursor on mouse over for button in inputXML.xaml
2025-05-23 10:52:57 -05:00
Raphael Machado
63d56bcac9
remove spotube (#3372)
🚨 Spotube is banned from using "Spotify™ API" 🚨

The developer of Spotube has received a cease and desist letter from Spotify USA Inc. and Spotify AB, asserting a legal threat concerning the distribution and development of any application that utilizes Spotify’s data API in conjunction with content from YouTube® to facilitate ad-free playback of music tracks. The letter contends that this specific use of the Spotify™ APIs contravenes the Spotify™ Agreements and may also infringe upon the rights of music rights holders.

Consequently, as the official maintainer of Spotube, I will immediately cease all forms of official distribution and development of Spotube that continue to employ the aforementioned 'Spotify™ APIs'

Their exact reasoning: (any) "uses of Spotify’s data API in connection with content from YouTube to provide ad-free playback of music tracks. The use of the Spotify APIs in this manner violates the Spotify Agreements and may also violate the rights of music rights holders."

https://spotube.krtirtho.dev/
2025-05-23 10:37:14 -05:00
Martin Wiethan
962b18e8fa
Re-Redesign of the Install Tab (#3350)
* Initial Remove Expanded View

* more cleanup

* Add word wrapping for Tooltips

* Update tooltip colors in themes and XAML styles

* Rename Properties for consistency

* More Cleanup, and simplification. Also added support for screenreaders

* Remove unused variables and shorten window naming

* Rename Invoke-WPFUIApps to Initialize-WPFUI and update function calls for consistency

* Rename Invoke-WPFUIApps.ps1 to Initialize-WPFUI.ps1

* Add TODO comments for sidebar UI generation in Initialize-WPFUI function
2025-05-12 15:45:57 -05:00
ChrisTitusTech
14e761f438 Deploying to main from @ ChrisTitusTech/winutil@3e416f5c14 🚀 2025-05-12 15:35:26 +00:00
28 changed files with 340 additions and 602 deletions

View File

@ -49,31 +49,6 @@ jobs:
}
shell: pwsh
- name: Create and import code signing certificate
shell: pwsh
run: |
[System.IO.File]::WriteAllBytes("$env:USERPROFILE\code-signing-cert.pfx", [System.Convert]::FromBase64String("$env:CERTIFICATE_BASE64"))
Import-PfxCertificate -FilePath "$env:USERPROFILE\code-signing-cert.pfx" -CertStoreLocation Cert:\CurrentUser\My
- name: Code sign winutil.ps1
shell: pwsh
run: |
$cert = Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1
if ($null -eq $cert) { throw "Code signing certificate not found" }
Set-AuthenticodeSignature -FilePath ./winutil.ps1 -Certificate $cert -TimeStampServer "http://timestamp.digicert.com"
- name: Verify code signature
shell: pwsh
run: |
$signature = Get-AuthenticodeSignature -FilePath ./winutil.ps1
if ($signature.Status -ne 'Valid') { throw "Code signing failed" }
- name: Upload winutil.ps1 as artifact
uses: actions/upload-artifact@v4
with:
name: winutil
path: ./winutil.ps1
- name: Generate Release Notes
id: generate_notes
uses: release-drafter/release-drafter@v6

View File

@ -53,7 +53,7 @@ If you have Issues, refer to [Known Issues](https://winutil.christitus.com/known
These are the sponsors that help keep this project alive with monthly contributions.
<!-- sponsors --><a href="https://github.com/TriHydera"><img src="https:&#x2F;&#x2F;github.com&#x2F;TriHydera.png" width="60px" alt="User avatar: TriHydera" /></a><a href="https://github.com/DelDongo"><img src="https:&#x2F;&#x2F;github.com&#x2F;DelDongo.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/markamos"><img src="https:&#x2F;&#x2F;github.com&#x2F;markamos.png" width="60px" alt="User avatar: Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https:&#x2F;&#x2F;github.com&#x2F;dwelfusius.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/mews-se"><img src="https:&#x2F;&#x2F;github.com&#x2F;mews-se.png" width="60px" alt="User avatar: Martin Stockzell" /></a><a href="https://github.com/jdiegmueller"><img src="https:&#x2F;&#x2F;github.com&#x2F;jdiegmueller.png" width="60px" alt="User avatar: Jason A. Diegmueller" /></a><a href="https://github.com/altugtekiner"><img src="https:&#x2F;&#x2F;github.com&#x2F;altugtekiner.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/robertsandrock"><img src="https:&#x2F;&#x2F;github.com&#x2F;robertsandrock.png" width="60px" alt="User avatar: RMS" /></a><a href="https://github.com/KenichiQaz"><img src="https:&#x2F;&#x2F;github.com&#x2F;KenichiQaz.png" width="60px" alt="User avatar: Stefan" /></a><a href="https://github.com/paulsheets"><img src="https:&#x2F;&#x2F;github.com&#x2F;paulsheets.png" width="60px" alt="User avatar: Paul" /></a><a href="https://github.com/djones369"><img src="https:&#x2F;&#x2F;github.com&#x2F;djones369.png" width="60px" alt="User avatar: Dave J. - WhamGeek" /></a><a href="https://github.com/anthonymendez"><img src="https:&#x2F;&#x2F;github.com&#x2F;anthonymendez.png" width="60px" alt="User avatar: Anthony Mendez" /></a><a href="https://github.com/claudemods"><img src="https:&#x2F;&#x2F;github.com&#x2F;claudemods.png" width="60px" alt="User avatar: claudemods" /></a><a href="https://github.com/FatBastard0"><img src="https:&#x2F;&#x2F;github.com&#x2F;FatBastard0.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/Ascent7910"><img src="https:&#x2F;&#x2F;github.com&#x2F;Ascent7910.png" width="60px" alt="User avatar: Max" /></a><a href="https://github.com/DursleyGuy"><img src="https:&#x2F;&#x2F;github.com&#x2F;DursleyGuy.png" width="60px" alt="User avatar: DursleyGuy" /></a><a href="https://github.com/realmuddy"><img src="https:&#x2F;&#x2F;github.com&#x2F;realmuddy.png" width="60px" alt="User avatar: Phillip Waters" /></a><a href="https://github.com/quaszi"><img src="https:&#x2F;&#x2F;github.com&#x2F;quaszi.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DwayneTheRockLobster1"><img src="https:&#x2F;&#x2F;github.com&#x2F;DwayneTheRockLobster1.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/KieraKujisawa"><img src="https:&#x2F;&#x2F;github.com&#x2F;KieraKujisawa.png" width="60px" alt="User avatar: Kiera Meredith" /></a><!-- sponsors -->
<!-- sponsors --><a href="https://github.com/TriHydera"><img src="https:&#x2F;&#x2F;github.com&#x2F;TriHydera.png" width="60px" alt="User avatar: TriHydera" /></a><a href="https://github.com/DelDongo"><img src="https:&#x2F;&#x2F;github.com&#x2F;DelDongo.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/markamos"><img src="https:&#x2F;&#x2F;github.com&#x2F;markamos.png" width="60px" alt="User avatar: Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https:&#x2F;&#x2F;github.com&#x2F;dwelfusius.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/mews-se"><img src="https:&#x2F;&#x2F;github.com&#x2F;mews-se.png" width="60px" alt="User avatar: Martin Stockzell" /></a><a href="https://github.com/jdiegmueller"><img src="https:&#x2F;&#x2F;github.com&#x2F;jdiegmueller.png" width="60px" alt="User avatar: Jason A. Diegmueller" /></a><a href="https://github.com/robertsandrock"><img src="https:&#x2F;&#x2F;github.com&#x2F;robertsandrock.png" width="60px" alt="User avatar: RMS" /></a><a href="https://github.com/KenichiQaz"><img src="https:&#x2F;&#x2F;github.com&#x2F;KenichiQaz.png" width="60px" alt="User avatar: Stefan" /></a><a href="https://github.com/paulsheets"><img src="https:&#x2F;&#x2F;github.com&#x2F;paulsheets.png" width="60px" alt="User avatar: Paul" /></a><a href="https://github.com/djones369"><img src="https:&#x2F;&#x2F;github.com&#x2F;djones369.png" width="60px" alt="User avatar: Dave J. - WhamGeek" /></a><a href="https://github.com/anthonymendez"><img src="https:&#x2F;&#x2F;github.com&#x2F;anthonymendez.png" width="60px" alt="User avatar: Anthony Mendez" /></a><a href="https://github.com/FatBastard0"><img src="https:&#x2F;&#x2F;github.com&#x2F;FatBastard0.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DursleyGuy"><img src="https:&#x2F;&#x2F;github.com&#x2F;DursleyGuy.png" width="60px" alt="User avatar: DursleyGuy" /></a><a href="https://github.com/realmuddy"><img src="https:&#x2F;&#x2F;github.com&#x2F;realmuddy.png" width="60px" alt="User avatar: Phillip Waters" /></a><a href="https://github.com/quaszi"><img src="https:&#x2F;&#x2F;github.com&#x2F;quaszi.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/DwayneTheRockLobster1"><img src="https:&#x2F;&#x2F;github.com&#x2F;DwayneTheRockLobster1.png" width="60px" alt="User avatar: " /></a><a href="https://github.com/KieraKujisawa"><img src="https:&#x2F;&#x2F;github.com&#x2F;KieraKujisawa.png" width="60px" alt="User avatar: Kiera Meredith" /></a><a href="https://github.com/craigccfl"><img src="https:&#x2F;&#x2F;github.com&#x2F;craigccfl.png" width="60px" alt="User avatar: CraigW" /></a><a href="https://github.com/RoelCrabbe"><img src="https:&#x2F;&#x2F;github.com&#x2F;RoelCrabbe.png" width="60px" alt="User avatar: Roel Crabbé" /></a><a href="https://github.com/Data-Syd"><img src="https:&#x2F;&#x2F;github.com&#x2F;Data-Syd.png" width="60px" alt="User avatar: Data Syd" /></a><!-- sponsors -->
## 🏅 Thanks to all Contributors
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.

View File

@ -349,7 +349,7 @@
"content": "Display Driver Uninstaller",
"description": "Display Driver Uninstaller (DDU) is a tool for completely uninstalling graphics drivers from NVIDIA, AMD, and Intel. It is useful for troubleshooting graphics driver-related issues.",
"link": "https://www.wagnardsoft.com/display-driver-uninstaller-DDU-",
"winget": "ddu"
"winget": "Wagnardsoft.DisplayDriverUninstaller"
},
"deluge": {
"category": "Utilities",
@ -1863,14 +1863,6 @@
"link": "https://sagethumbs.en.lo4d.com/windows",
"winget": "CherubicSoftware.SageThumbs"
},
"samsungmagician": {
"category": "Utilities",
"choco": "samsung-magician",
"content": "Samsung Magician",
"description": "Samsung Magician is a utility for managing and optimizing Samsung SSDs.",
"link": "https://semiconductor.samsung.com/consumer-storage/magician/",
"winget": "Samsung.SamsungMagician"
},
"sandboxie": {
"category": "Utilities",
"choco": "sandboxie",
@ -1983,14 +1975,6 @@
"link": "http://www.uderzo.it/main_products/space_sniffer/",
"winget": "UderzoSoftware.SpaceSniffer"
},
"spotube": {
"category": "Multimedia Tools",
"choco": "spotube",
"content": "Spotube",
"description": "Open source Spotify client that doesn't require Premium nor uses Electron! Available for both desktop & mobile! ",
"link": "https://github.com/KRTirtho/spotube",
"winget": "KRTirtho.Spotube"
},
"starship": {
"category": "Development",
"choco": "starship",

View File

@ -1,31 +1,24 @@
{
"WPFToggleView": {
"Content": ["Expanded View", "Compact View"],
"WPFInstall": {
"Content": "Install/Upgrade Applications",
"Category": "____Actions",
"Type": "ToggleButton",
"Type": "Button",
"Order": "1",
"Description": "Toggle between a list and a compact grid like view"
"Description": "Install or upgrade the selected applications"
},
"WPFSelectedFilter": {
"Content": [ "Show All", "Show Selected"],
"WPFUninstall": {
"Content": "Uninstall Applications",
"Category": "____Actions",
"Type": "ToggleButton",
"Type": "Button",
"Order": "2",
"Description": "Toggle between showing all or only the selected applications"
"Description": "Uninstall the selected applications"
},
"WPFClearInstallSelection": {
"Content": "Clear Selection",
"WPFInstallUpgrade": {
"Content": "Upgrade all Applications",
"Category": "____Actions",
"Type": "Button",
"Order": "3",
"Description": "Clear the selection of applications"
},
"WPFGetInstalled": {
"Content": "Get Installed",
"Category": "____Actions",
"Type": "Button",
"Order": "4",
"Description": "Show installed applications"
"Description": "Upgrade all applications to the latest version"
},
"WingetRadioButton": {
"Content": "Winget",
@ -44,5 +37,26 @@
"Checked": false,
"Order": "2",
"Description": "Use Chocolatey for package management"
},
"WPFClearInstallSelection": {
"Content": "Clear Selection",
"Category": "__Selection",
"Type": "Button",
"Order": "1",
"Description": "Clear the selection of applications"
},
"WPFGetInstalled": {
"Content": "Get Installed",
"Category": "__Selection",
"Type": "Button",
"Order": "2",
"Description": "Show installed applications"
},
"WPFselectedAppsButton": {
"Content": "Selected Apps: 0",
"Category": "__Selection",
"Type": "Button",
"Order": "3",
"Description": "Show the selected applications"
}
}

View File

@ -1,5 +1,9 @@
{
"shared":{
"AppEntryWidth": "130",
"AppEntryFontSize": "11",
"AppEntryMargin": "1,1,1,1",
"AppEntryBorderTickness": "0",
"CustomDialogFontSize": "12",
"CustomDialogFontSizeHeader": "14",
"CustomDialogLogoSize": "25",
@ -16,6 +20,7 @@
"TabButtonWidth": "110",
"TabButtonHeight": "26",
"TabRowHeightInPixels": "50",
"ToolTipWidth": "300",
"IconFontSize": "14",
"IconButtonSize": "35",
"SettingsIconFontSize": "18",
@ -35,11 +40,10 @@
"CheckboxMouseOverColor": "#999999",
"ButtonBorderThickness": "1",
"ButtonMargin": "1",
"ButtonCornerRadius": "2",
"AppTileImageSize": "40"
"ButtonCornerRadius": "2"
},
"Light": {
"AppInstallUnselectedColor": "#F0F0F0",
"AppInstallUnselectedColor": "#F7F7F7",
"AppInstallHighlightedColor": "#CFCFCF",
"AppInstallSelectedColor": "#C2C2C2",
"ComboBoxForegroundColor": "#232629",
@ -72,6 +76,7 @@
"ButtonForegroundColor": "#232629",
"ToggleButtonOnColor": "#2e77ff",
"ToggleButtonOffColor": "#707070",
"ToolTipBackgroundColor": "#F7F7F7",
"BorderColor": "#232629",
"BorderOpacity": "0.2"
@ -110,6 +115,7 @@
"ButtonForegroundColor": "#F7F7F7",
"ToggleButtonOnColor": "#2e77ff",
"ToggleButtonOffColor": "#707070",
"ToolTipBackgroundColor": "#2F373D",
"BorderColor": "#2F373D",
"BorderOpacity": "0.2"
}

View File

@ -3087,8 +3087,7 @@
"
New-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Name \"InprocServer32\" -force -value \"\"
Write-Host Restarting explorer.exe ...
$process = Get-Process -Name \"explorer\"
Stop-Process -InputObject $process
Stop-Process -Name \"explorer\" -Force
"
],
"UndoScript": [
@ -3096,8 +3095,7 @@
Remove-Item -Path \"HKCU:\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\" -Recurse -Confirm:$false -Force
# Restarting Explorer in the Undo Script might not be necessary, as the Registry change without restarting Explorer does work, but just to make sure.
Write-Host Restarting explorer.exe ...
$process = Get-Process -Name \"explorer\"
Stop-Process -InputObject $process
Stop-Process -Name \"explorer\" -Force
"
],
"link": "https://winutil.christitus.com/dev/tweaks/z--advanced-tweaks---caution/rightclickmenu"
@ -3380,7 +3378,7 @@
},
"WPFToggleStartMenuRecommendations": {
"Content": "Recommendations in Start Menu",
"Description": "If disabled then you will not see recommendations in the Start Menu. | Enables 'iseducationenvironment' | Relogin Required.",
"Description": "If disabled then you will not see recommendations in the Start Menu. | Enables 'iseducationenvironment' | Relogin Required. | WARNING: This will also disable Windows Spotlight on your Lock Screen as a side effect.",
"category": "Customize Preferences",
"panel": "2",
"Order": "a104_",

View File

@ -12,16 +12,30 @@ function Find-AppsByNameOrDescription {
)
# Reset the visibility if the search string is empty or the search is cleared
if ([string]::IsNullOrWhiteSpace($SearchString)) {
Set-CategoryVisibility -Category "*"
return
$sync.ItemsControl.Items | ForEach-Object {
$_.Visibility = [Windows.Visibility]::Visible
$_.Children | ForEach-Object {
if ($null -ne $_) {
$_.Visibility = [Windows.Visibility]::Visible
}
}
}
return
}
$sync.ItemsControl.Items | ForEach-Object {
# Ensure ToggleButtons remain visible
if ($_.Tag -like "CategoryToggleButton") {
$_.Visibility = [Windows.Visibility]::Visible
return
}
# Hide all CategoryWrapPanel and ToggleButton
$_.Visibility = [Windows.Visibility]::Collapsed
if ($_.Tag -like "CategoryWrapPanel_*") {
# Search for Apps that match the search string
$_.Children | Foreach-Object {
if ($sync.configs.applicationsHashtable.$($_.Tag).Content -like "*$SearchString*") {
$appEntry = $sync.configs.applicationsHashtable.$($_.Tag)
if ($appEntry.Content -like "*$SearchString*" -or $appEntry.Description -like "*$SearchString*") {
# Show the App and the parent CategoryWrapPanel if the string is found
$_.Visibility = [Windows.Visibility]::Visible
$_.parent.Visibility = [Windows.Visibility]::Visible

View File

@ -45,7 +45,6 @@ function Find-TweaksByNameOrDescription {
# Search for matching tweaks when search string is not null
$tweakspanel = $sync.Form.FindName("tweakspanel")
$matchFound = $false
$tweakspanel.Children | ForEach-Object {
$categoryBorder = $_
@ -96,9 +95,6 @@ function Find-TweaksByNameOrDescription {
# Set the visibility based on if any item matched
$categoryBorder.Visibility = if ($categoryVisible) { [Windows.Visibility]::Visible } else { [Windows.Visibility]::Collapsed }
if ($categoryVisible) {
$matchFound = $true
}
}
}
}

View File

@ -15,14 +15,11 @@ function Initialize-InstallAppEntry {
# Create the outer Border for the application type
$border = New-Object Windows.Controls.Border
$border.Style = $sync.Form.Resources.AppTileBorderStyle
$border.Style = $sync.Form.Resources.AppEntryBorderStyle
$border.Tag = $appKey
$border.ToolTip = $Apps.$appKey.description
$border.Add_MouseUp({
if ($_.ChangedButton -eq [System.Windows.Input.MouseButton]::Right) {
Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFInstall*";
}
$childCheckbox = ($this.Child.Children | Where-Object {$_.Template.TargetType -eq [System.Windows.Controls.Checkbox]})[0]
$border.Add_MouseLeftButtonUp({
$childCheckbox = ($this.Child | Where-Object {$_.Template.TargetType -eq [System.Windows.Controls.Checkbox]})[0]
$childCheckBox.isChecked = -not $childCheckbox.IsChecked
})
$border.Add_MouseEnter({
@ -35,101 +32,42 @@ function Initialize-InstallAppEntry {
$this.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
}
})
# Create a DockPanel inside the Border
$dockPanel = New-Object Windows.Controls.DockPanel
$dockPanel.LastChildFill = $true
$border.Child = $dockPanel
$border.Add_MouseRightButtonUp({
# Store the selected app in a global variable so it can be used in the popup
$sync.appPopupSelectedApp = $this.Tag
# Set the popup position to the current mouse position
$sync.appPopup.PlacementTarget = $this
$sync.appPopup.IsOpen = $true
})
# Create the CheckBox, vertically centered
$checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $appKey
$checkbox.Style = $sync.Form.Resources.AppTileCheckboxStyle
$checkbox.Style = $sync.Form.Resources.AppEntryCheckboxStyle
$checkbox.Add_Checked({
Invoke-WPFSelectedAppsUpdate -type "Add" -checkbox $this
$borderElement = $this.Parent.Parent
$borderElement = $this.Parent
$borderElement.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallSelectedColor")
})
$checkbox.Add_Unchecked({
Invoke-WPFSelectedAppsUpdate -type "Remove" -checkbox $this
$borderElement = $this.Parent.Parent
$borderElement = $this.Parent
$borderElement.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
})
# Create a StackPanel for the image and name
$imageAndNamePanel = New-Object Windows.Controls.StackPanel
$imageAndNamePanel.Orientation = "Horizontal"
$imageAndNamePanel.VerticalAlignment = "Center"
# Create the Image and set a placeholder
$image = New-Object Windows.Controls.Image
# $image.Name = "wpfapplogo" + $App.Name
$image.Style = $sync.Form.Resources.AppTileImageStyle
$image.Source = $noimage # Ensure $noimage is defined in your script
$imageAndNamePanel.Children.Add($image) | Out-Null
# Create the TextBlock for the application name
$appName = New-Object Windows.Controls.TextBlock
$appName.Style = $sync.Form.Resources.AppTileNameStyle
$appName.Style = $sync.Form.Resources.AppEntryNameStyle
$appName.Text = $Apps.$appKey.content
$imageAndNamePanel.Children.Add($appName) | Out-Null
# Add the image and name panel to the Checkbox
$checkBox.Content = $imageAndNamePanel
# Add the name to the Checkbox
$checkBox.Content = $appName
# Add the checkbox to the DockPanel
[Windows.Controls.DockPanel]::SetDock($checkBox, [Windows.Controls.Dock]::Left)
$dockPanel.Children.Add($checkBox) | Out-Null
# Create the StackPanel for the buttons and dock it to the right
$buttonPanel = New-Object Windows.Controls.StackPanel
$buttonPanel.Style = $sync.Form.Resources.AppTileButtonPanelStyle
[Windows.Controls.DockPanel]::SetDock($buttonPanel, [Windows.Controls.Dock]::Right)
# Define the button properties
$buttons = @(
[PSCustomObject]@{ Name = "Install"; Description = "Install or Upgrade the application"; Tooltip = "Install or Upgrade the application"; Icon = [char]0xE118 },
[PSCustomObject]@{ Name = "Uninstall"; Description = "Uninstall the application"; Tooltip = "Uninstall the application"; Icon = [char]0xE74D },
[PSCustomObject]@{ Name = "Info"; Description = "Open the application's website in your default browser"; Tooltip = "Open the application's website in your default browser"; Icon = [char]0xE946 }
)
# Iterate over each button and create it
foreach ($button in $buttons) {
$newButton = New-Object Windows.Controls.Button
$newButton.Style = $sync.Form.Resources.AppTileButtonStyle
$newButton.Content = $button.Icon
$newButton.ToolTip = $button.Tooltip
$buttonPanel.Children.Add($newButton) | Out-Null
switch ($button.Name) {
"Install" {
$newButton.Add_Click({
$appKey = $this.Parent.Parent.Parent.Tag
$appObject = $sync.configs.applicationsHashtable.$appKey
Invoke-WPFInstall -PackagesToInstall $appObject
})
}
"Uninstall" {
$newButton.Add_Click({
$appKey = $this.Parent.Parent.Parent.Tag
$appObject = $sync.configs.applicationsHashtable.$appKey
Invoke-WPFUnInstall -PackagesToUninstall $appObject
})
}
"Info" {
$newButton.Add_Click({
$appKey = $this.Parent.Parent.Parent.Tag
$appObject = $sync.configs.applicationsHashtable.$appKey
Start-Process $appObject.link
})
}
}
}
# Add the button panel to the DockPanel
$dockPanel.Children.Add($buttonPanel) | Out-Null
# Add accessibility properties to make the elements screen reader friendly
$checkBox.SetValue([Windows.Automation.AutomationProperties]::NameProperty, $Apps.$appKey.content)
$border.SetValue([Windows.Automation.AutomationProperties]::NameProperty, $Apps.$appKey.content)
$border.Child = $checkBox
# Add the border to the corresponding Category
$TargetElement.Children.Add($border) | Out-Null
return $checkbox

View File

@ -10,27 +10,36 @@
#>
param($TargetElement)
$targetGrid = $sync.Form.FindName($TargetElement)
$null = $targetGrid.Children.Clear()
# Create the outer Border for the aren where the apps will be placed
$Border = New-Object Windows.Controls.Border
$Border.VerticalAlignment = "Stretch"
$Border.SetResourceReference([Windows.Controls.Control]::StyleProperty, "BorderStyle")
# Add a ScrollViewer, because the ItemsControl does not support scrolling by itself
$scrollViewer = New-Object Windows.Controls.ScrollViewer
$scrollViewer.VerticalScrollBarVisibility = 'Auto'
$scrollViewer.HorizontalAlignment = 'Stretch'
$scrollViewer.VerticalAlignment = 'Stretch'
$scrollViewer.CanContentScroll = $true
## Create the ItemsControl, which will be the parent of all the app entries
$itemsControl = New-Object Windows.Controls.ItemsControl
$itemsControl.HorizontalAlignment = 'Stretch'
$itemsControl.VerticalAlignment = 'Stretch'
# Enable virtualization for the ItemsControl to improve performance (It's hard to test if this is actually working, so if you know what you're doing, please check this)
$itemsPanelTemplate = New-Object Windows.Controls.ItemsPanelTemplate
$factory = New-Object Windows.FrameworkElementFactory ([Windows.Controls.VirtualizingStackPanel])
$itemsPanelTemplate.VisualTree = $factory
$itemsControl.ItemsPanel = $itemsPanelTemplate
$itemsControl.SetValue([Windows.Controls.VirtualizingStackPanel]::IsVirtualizingProperty, $true)
$itemsControl.SetValue([Windows.Controls.VirtualizingStackPanel]::VirtualizationModeProperty, [Windows.Controls.VirtualizationMode]::Recycling)
$scrollViewer.Content = $itemsControl
[Windows.Controls.DockPanel]::SetDock($scrollViewer, [Windows.Controls.Dock]::Bottom)
$null = $TargetElement.Children.Add($scrollViewer)
$Border.Child = $scrollViewer
$null = $targetGrid.Children.Add($Border)
return $itemsControl
}

View File

@ -1,28 +0,0 @@
function Initialize-InstallAppsMainElement {
<#
.SYNOPSIS
Clears the given WPF Grid and creates a [Windows.Controls.Border] containing a [Windows.Controls.StackPanel]
Used to as part of the Install Tab UI generation
.PARAMETER TargetGridName
The WPF Grid name
.OUTPUTS
Returns the created [Windows.Controls.StackPanel] element
#>
param(
[Parameter(Mandatory)]
[string]$TargetGridName
)
$targetGrid = $sync.Form.FindName($TargetGridName)
$null = $targetGrid.Children.Clear()
$Border = New-Object Windows.Controls.Border
$Border.VerticalAlignment = "Stretch"
$Border.SetResourceReference([Windows.Controls.Control]::StyleProperty, "BorderStyle")
$dockPanel = New-Object Windows.Controls.DockPanel
$Border.Child = $dockPanel
$null = $targetGrid.Children.Add($Border)
return $dockPanel
}

View File

@ -21,61 +21,36 @@ function Initialize-InstallCategoryAppList {
[Windows.Controls.ItemsControl]$TargetElement
)
$toggleButton = New-Object Windows.Controls.Primitives.ToggleButton
$toggleButton = New-Object Windows.Controls.Label
$toggleButton.Content = "$Category"
$toggleButton.Tag = "CategoryToggleButton"
$toggleButton.Cursor = [System.Windows.Input.Cursors]::Hand
$toggleButton.SetResourceReference([Windows.Controls.Control]::StyleProperty, "CategoryToggleButtonStyle")
$sync.Buttons.Add($toggleButton)
$toggleButton.Add_Checked({
# Clear the search bar when a category is clicked
$sync.SearchBar.Text = ""
Set-CategoryVisibility -Category $this.Content -overrideState Expand
})
$toggleButton.Add_Unchecked({
Set-CategoryVisibility -Category $this.Content -overrideState Collapse
})
$sync.$Category = $Category
$null = $TargetElement.Items.Add($toggleButton)
}
$loadingLabel = New-Object Windows.Controls.Label
$loadingLabel.Content = "Loading, please wait..."
$loadingLabel.HorizontalAlignment = "Center"
$loadingLabel.VerticalAlignment = "Center"
$loadingLabel.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "HeaderFontSize")
$loadingLabel.FontWeight = [Windows.FontWeights]::Bold
$loadingLabel.Foreground = [Windows.Media.Brushes]::Gray
$sync.LoadingLabel = $loadingLabel
$TargetElement.Items.Clear()
$null = $TargetElement.Items.Add($sync.LoadingLabel)
# Use the Dispatcher to make sure the Loading message is shown before the logic loading the apps starts, and only is removed when the loading is complete and the apps are added to the UI
$TargetElement.Dispatcher.Invoke([System.Windows.Threading.DispatcherPriority]::Background, [action]{
$TargetElement.Items.Clear() # Remove the loading message
# Pre-group apps by category
$appsByCategory = @{}
foreach ($appKey in $Apps.Keys) {
$category = $Apps.$appKey.Category
if (-not $appsByCategory.ContainsKey($category)) {
$appsByCategory[$category] = @()
}
$appsByCategory[$category] += $appKey
# Pre-group apps by category
$appsByCategory = @{}
foreach ($appKey in $Apps.Keys) {
$category = $Apps.$appKey.Category
if (-not $appsByCategory.ContainsKey($category)) {
$appsByCategory[$category] = @()
}
foreach ($category in $($appsByCategory.Keys | Sort-Object)) {
Add-Category -Category $category -TargetElement $TargetElement
$wrapPanel = New-Object Windows.Controls.WrapPanel
$wrapPanel.Orientation = "Horizontal"
$wrapPanel.HorizontalAlignment = "Stretch"
$wrapPanel.VerticalAlignment = "Center"
$wrapPanel.Margin = New-Object Windows.Thickness(0, 0, 0, 20)
$wrapPanel.Visibility = [Windows.Visibility]::Collapsed
$wrapPanel.Tag = "CategoryWrapPanel_$category"
$null = $TargetElement.Items.Add($wrapPanel)
$appsByCategory[$category] |Sort-Object | ForEach-Object {
$sync.$_ = $(Initialize-InstallAppEntry -TargetElement $wrapPanel -AppKey $_)
$appsByCategory[$category] += $appKey
}
foreach ($category in $($appsByCategory.Keys | Sort-Object)) {
Add-Category -Category $category -TargetElement $TargetElement
$wrapPanel = New-Object Windows.Controls.WrapPanel
$wrapPanel.Orientation = "Horizontal"
$wrapPanel.HorizontalAlignment = "Stretch"
$wrapPanel.VerticalAlignment = "Center"
$wrapPanel.Margin = New-Object Windows.Thickness(0, 0, 0, 20)
$wrapPanel.Visibility = [Windows.Visibility]::Visible
$wrapPanel.Tag = "CategoryWrapPanel_$category"
$null = $TargetElement.Items.Add($wrapPanel)
$appsByCategory[$category] |Sort-Object | ForEach-Object {
$sync.$_ = $(Initialize-InstallAppEntry -TargetElement $wrapPanel -AppKey $_)
}
}
})
}

View File

@ -1,78 +0,0 @@
function Initialize-InstallHeader {
<#
.SYNOPSIS
Creates the Multi Selection Header Elements on the Install Tab
Used to as part of the Install Tab UI generation
.PARAMETER TargetElement
The Parent Element into which the Header should be placed
#>
param($TargetElement)
function New-WPFButton {
param (
[string]$Name,
[string]$Content
)
$button = New-Object Windows.Controls.Button
$button.Name = $Name
$button.Content = $Content
$button.Margin = New-Object Windows.Thickness(2)
$button.HorizontalAlignment = "Stretch"
return $button
}
$wrapPanelTop = New-Object Windows.Controls.WrapPanel
$wrapPanelTop.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "MainBackgroundColor")
$wrapPanelTop.HorizontalAlignment = "Left"
$wrapPanelTop.VerticalAlignment = "Top"
$wrapPanelTop.Orientation = "Horizontal"
$wrapPanelTop.SetResourceReference([Windows.Controls.Control]::MarginProperty, "TabContentMargin")
$buttonConfigs = @(
@{Name="WPFInstall"; Content="Install/Upgrade Selected"},
@{Name="WPFInstallUpgrade"; Content="Upgrade All"},
@{Name="WPFUninstall"; Content="Uninstall Selected"},
@{Name="WPFselectedAppsButton"; Content="Selected Apps: 0"}
)
foreach ($config in $buttonConfigs) {
$button = New-WPFButton -Name $config.Name -Content $config.Content
$null = $wrapPanelTop.Children.Add($button)
$sync[$config.Name] = $button
}
$selectedAppsPopup = New-Object Windows.Controls.Primitives.Popup
$selectedAppsPopup.IsOpen = $false
$selectedAppsPopup.PlacementTarget = $sync.WPFselectedAppsButton
$selectedAppsPopup.Placement = [System.Windows.Controls.Primitives.PlacementMode]::Bottom
$selectedAppsPopup.AllowsTransparency = $true
$selectedAppsBorder = New-Object Windows.Controls.Border
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "MainBackgroundColor")
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BorderBrushProperty, "MainForegroundColor")
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BorderThicknessProperty, "ButtonBorderThickness")
$selectedAppsBorder.Width = 200
$selectedAppsBorder.Padding = 5
$selectedAppsPopup.Child = $selectedAppsBorder
$sync.selectedAppsPopup = $selectedAppsPopup
$sync.selectedAppsstackPanel = New-Object Windows.Controls.StackPanel
$selectedAppsBorder.Child = $sync.selectedAppsstackPanel
# Toggle selectedAppsPopup open/close with button
$sync.WPFselectedAppsButton.Add_Click({
$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen
})
# Close selectedAppsPopup when mouse leaves both button and selectedAppsPopup
$sync.WPFselectedAppsButton.Add_MouseLeave({
if (-not $sync.selectedAppsPopup.IsMouseOver) {
$sync.selectedAppsPopup.IsOpen = $false
}
})
$selectedAppsPopup.Add_MouseLeave({
if (-not $sync.WPFselectedAppsButton.IsMouseOver) {
$sync.selectedAppsPopup.IsOpen = $false
}
})
[Windows.Controls.DockPanel]::SetDock($wrapPanelTop, [Windows.Controls.Dock]::Top)
$null = $TargetElement.Children.Add($wrapPanelTop)
}

View File

@ -1,44 +0,0 @@
function Set-CategoryVisibility {
<#
.SYNOPSIS
Used to expand or collapse categories and corresponding apps on the install tab
.PARAMETER Category
Can eigther be a specific category name like "Browsers" OR "*" to affect all categories at once
.PARAMETER overrideState
"Expand" => expands the corresponding elements
"Collapse" => collapses the corresponding elements
N/A => if compactView is active expand, otherwise collapse elements
#>
param(
[Parameter(Mandatory=$true)]
[string]$Category,
[ValidateSet("Expand", "Collapse")]
[string]$overrideState
)
switch ($overrideState) {
"Expand" {$state = $true}
"Collapse" {$state = $false}
default {$state = $sync.CompactView}
}
# If all the Categories are affected, update the Checked state of the ToggleButtons.
# Otherwise, the state is not synced when toggling between the display modes
if ($category -eq "*") {
$items = $sync.ItemsControl.Items | Where-Object {($_.Tag -like "CategoryWrapPanel_*")}
$sync.ItemsControl.Items | Where-Object {($_.Tag -eq "CategoryToggleButton")} | Foreach-Object { $_.Visibility = [Windows.Visibility]::Visible; $_.IsChecked = $state }
} else {
$items = $sync.ItemsControl.Items | Where-Object {($_.Tag -eq "CategoryWrapPanel_$Category")}
}
$elementVisibility = if ($state -eq $true) {[Windows.Visibility]::Visible} else {[Windows.Visibility]::Collapsed}
$items | ForEach-Object {
$_.Visibility = $elementVisibility
}
$items.Children | ForEach-Object {
$_.Visibility = $elementVisibility
}
}

View File

@ -1,54 +0,0 @@
function Show-OnlyCheckedApps {
<#
.SYNOPSIS
Toggle between showing only the actively selected apps on the Install Tab and hiding everything else and displaying every app.
If no apps are selected, dont do anything
.PARAMETER appKeys
Expects a List of appKeys that are selected at the moment
If not provided, or empty, the function exits without any visual change to the ui
.EXAMPLE
Show-OnlyCheckedApps -appKeys $sync.SelectedApps
Show-OnlyCheckedApps -appKeys ("WPFInstallChrome", "WPFInstall7zip")
#>
param (
[Parameter(Mandatory=$false)]
[String[]]$appKeys
)
# If no apps are selected, do not allow switching to show only selected
if (($false -eq $sync.ShowOnlySelected) -and ($appKeys.Length -eq 0)) {
Write-Host "No apps selected"
$sync.wpfselectedfilter.IsChecked = $false
return
}
$sync.ShowOnlySelected = -not $sync.ShowOnlySelected
if ($sync.ShowOnlySelected) {
$sync.Buttons | Where-Object {$_.Name -like "ShowSelectedAppsButton"} | ForEach-Object {
$_.Content = "Show All"
}
$sync.ItemsControl.Items | Foreach-Object {
# Search for App Container and set them to visible
if ($_.Tag -like "CategoryWrapPanel_*") {
$_.Visibility = [Windows.Visibility]::Visible
# Iterate through all the apps in the container and set them to visible if they are in the appKeys array
$_.Children | ForEach-Object {
if ($appKeys -contains $_.Tag) {
$_.Visibility = [Windows.Visibility]::Visible
}
else {
$_.Visibility = [Windows.Visibility]::Collapsed
}
}
}
else {
# Set all other items to collapsed
$_.Visibility = [Windows.Visibility]::Collapsed
}
}
} else {
$sync.Buttons | Where-Object {$_.Name -like "ShowSelectedAppsButton"} | ForEach-Object {
$_.Content = "Show Selected"
}
Set-CategoryVisibility -Category "*"
}
}

View File

@ -0,0 +1,120 @@
function Initialize-WPFUI {
[OutputType([void])]
param(
[Parameter(Mandatory)]
[string]$TargetGridName
)
switch ($TargetGridName) {
"appscategory"{
# TODO
# Switch UI generation of the sidebar to this function
# $sync.ItemsControl = Initialize-InstallAppArea -TargetElement $TargetGridName
# ...
# Create and configure a popup for displaying selected apps
$selectedAppsPopup = New-Object Windows.Controls.Primitives.Popup
$selectedAppsPopup.IsOpen = $false
$selectedAppsPopup.PlacementTarget = $sync.WPFselectedAppsButton
$selectedAppsPopup.Placement = [System.Windows.Controls.Primitives.PlacementMode]::Bottom
$selectedAppsPopup.AllowsTransparency = $true
# Style the popup with a border and background
$selectedAppsBorder = New-Object Windows.Controls.Border
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "MainBackgroundColor")
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BorderBrushProperty, "MainForegroundColor")
$selectedAppsBorder.SetResourceReference([Windows.Controls.Control]::BorderThicknessProperty, "ButtonBorderThickness")
$selectedAppsBorder.Width = 200
$selectedAppsBorder.Padding = 5
$selectedAppsPopup.Child = $selectedAppsBorder
$sync.selectedAppsPopup = $selectedAppsPopup
# Add a stack panel inside the popup's border to organize its child elements
$sync.selectedAppsstackPanel = New-Object Windows.Controls.StackPanel
$selectedAppsBorder.Child = $sync.selectedAppsstackPanel
# Close selectedAppsPopup when mouse leaves both button and selectedAppsPopup
$sync.WPFselectedAppsButton.Add_MouseLeave({
if (-not $sync.selectedAppsPopup.IsMouseOver) {
$sync.selectedAppsPopup.IsOpen = $false
}
})
$selectedAppsPopup.Add_MouseLeave({
if (-not $sync.WPFselectedAppsButton.IsMouseOver) {
$sync.selectedAppsPopup.IsOpen = $false
}
})
# Creates the popup that is displayed when the user right-clicks on an app entry
# This popup contains buttons for installing, uninstalling, and viewing app information
$appPopup = New-Object Windows.Controls.Primitives.Popup
$appPopup.StaysOpen = $false
$appPopup.Placement = [System.Windows.Controls.Primitives.PlacementMode]::Bottom
$appPopup.AllowsTransparency = $true
# Store the popup globally so the position can be set later
$sync.appPopup = $appPopup
$appPopupStackPanel = New-Object Windows.Controls.StackPanel
$appPopupStackPanel.Orientation = "Horizontal"
$appPopupStackPanel.Add_MouseLeave({
$sync.appPopup.IsOpen = $false
})
$appPopup.Child = $appPopupStackPanel
$appButtons = @(
[PSCustomObject]@{ Name = "Install"; Icon = [char]0xE118 },
[PSCustomObject]@{ Name = "Uninstall"; Icon = [char]0xE74D },
[PSCustomObject]@{ Name = "Info"; Icon = [char]0xE946 }
)
foreach ($button in $appButtons) {
$newButton = New-Object Windows.Controls.Button
$newButton.Style = $sync.Form.Resources.AppEntryButtonStyle
$newButton.Content = $button.Icon
$appPopupStackPanel.Children.Add($newButton) | Out-Null
# Dynamically load the selected app object so the buttons can be reused and do not need to be created for each app
switch ($button.Name) {
"Install" {
$newButton.Add_MouseEnter({
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
$this.ToolTip = "Install or Upgrade $($appObject.content)"
})
$newButton.Add_Click({
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
Invoke-WPFInstall -PackagesToInstall $appObject
})
}
"Uninstall" {
$newButton.Add_MouseEnter({
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
$this.ToolTip = "Uninstall $($appObject.content)"
})
$newButton.Add_Click({
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
Invoke-WPFUnInstall -PackagesToUninstall $appObject
})
}
"Info" {
$newButton.Add_MouseEnter({
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
$this.ToolTip = "Open the application's website in your default browser`n$($appObject.link)"
})
$newButton.Add_Click({
$appObject = $sync.configs.applicationsHashtable.$($sync.appPopupSelectedApp)
Start-Process $appObject.link
})
}
}
}
}
"appspanel" {
$sync.ItemsControl = Initialize-InstallAppArea -TargetElement $TargetGridName
Initialize-InstallCategoryAppList -TargetElement $sync.ItemsControl -Apps $sync.configs.applicationsHashtable
}
default {
Write-Output "$TargetGridName not yet implemented"
}
}
}

View File

@ -26,8 +26,7 @@ function Invoke-WPFButton {
"WPFStandard" {Invoke-WPFPresets "Standard" -checkboxfilterpattern "WPFTweak*"}
"WPFMinimal" {Invoke-WPFPresets "Minimal" -checkboxfilterpattern "WPFTweak*"}
"WPFClearTweaksSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFTweak*"}
"WPFClearInstallSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFInstall*"; Show-OnlyCheckedApps; $sync.wpfselectedfilter.IsChecked = $false}
"WPFSelectedFilter" {Show-OnlyCheckedApps -appKeys $sync.SelectedApps}
"WPFClearInstallSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFInstall*"}
"WPFtweaksbutton" {Invoke-WPFtweaksbutton}
"WPFOOSUbutton" {Invoke-WPFOOSU}
"WPFAddUltPerf" {Invoke-WPFUltimatePerformance -State "Enable"}
@ -62,5 +61,6 @@ function Invoke-WPFButton {
"WPFWinUtilInstallPSProfile" {Invoke-WinUtilInstallPSProfile}
"WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile}
"WPFWinUtilSSHServer" {Invoke-WPFSSHServer}
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
}
}

View File

@ -19,15 +19,11 @@ function Invoke-WPFGetInstalled {
return
}
$managerPreference = $sync["ManagerPreference"]
$sync.ItemsControl.Dispatcher.Invoke([action] {
$sync.ItemsControl.Items | ForEach-Object { $_.Visibility = [Windows.Visibility]::Collapsed }
$null = $sync.itemsControl.Items.Add($sync.LoadingLabel)
})
Invoke-WPFRunspace -ParameterList @(("managerPreference", $managerPreference),("checkbox", $checkbox),("ShowOnlyCheckedApps", ${function:Show-OnlyCheckedApps})) -DebugPreference $DebugPreference -ScriptBlock {
Invoke-WPFRunspace -ParameterList @(("managerPreference", $managerPreference),("checkbox", $checkbox)) -DebugPreference $DebugPreference -ScriptBlock {
param (
[string]$checkbox,
[PackageManagers]$managerPreference,
[scriptblock]$ShowOnlyCheckedApps
[PackageManagers]$managerPreference
)
$sync.ProcessRunning = $true
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "Indeterminate" })
@ -49,11 +45,7 @@ function Invoke-WPFGetInstalled {
$sync.$checkbox.ischecked = $True
}
})
$sync.ItemsControl.Dispatcher.Invoke([action] {
$ShowOnlyCheckedApps.Invoke($sync.SelectedApps)
$sync["WPFSelectedFilter"].IsChecked = $true
$sync.ItemsControl.Items.Remove($sync.LoadingLabel)
})
Write-Host "Done..."
$sync.ProcessRunning = $false
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state "None" })

View File

@ -34,7 +34,6 @@ function Invoke-WPFInstall {
try {
$sync.ProcessRunning = $true
$errorPackages = @()
if($packagesWinget.Count -gt 0) {
Install-WinUtilWinget
Install-WinUtilProgramWinget -Action Install -Programs $packagesWinget

View File

@ -20,7 +20,7 @@ function Invoke-WPFSelectedAppsUpdate {
$selectedAppsButton = $sync.WPFselectedAppsButton
# Get the actual Name from the selectedAppLabel inside the Checkbox
$appKey = $checkbox.Parent.Parent.Tag
$appKey = $checkbox.Parent.Tag
if ($type -eq "Add") {
$sync.selectedApps.Add($appKey)
# The List type needs to be specified again, because otherwise Sort-Object will convert the list to a string if there is only a single entry

View File

@ -1,22 +0,0 @@
function Invoke-WPFUIApps {
[OutputType([void])]
param(
[Parameter(Mandatory, Position = 0)]
[PSCustomObject[]]$Apps,
[Parameter(Mandatory, Position = 1)]
[string]$TargetGridName
)
switch ($TargetGridName) {
"appspanel" {
$dockPanel = Initialize-InstallAppsMainElement -TargetGridName $TargetGridName
$null = Initialize-InstallHeader -TargetElement $dockPanel
$sync.ItemsControl = Initialize-InstallAppArea -TargetElement $dockPanel
Initialize-InstallCategoryAppList -TargetElement $sync.ItemsControl -Apps $Apps
}
default {
Write-Output "$TargetGridName not yet implemented"
}
}
}

View File

@ -93,12 +93,6 @@ function Invoke-WPFUIElements {
# Store application data in an array under the category
$organizedData[$entryObject.Panel][$entryObject.Category] += $entryObject
# Only apply the logic for distributing entries across columns if the targetGridName is "appspanel"
if ($targetGridName -eq "appspanel") {
$panelcount = 0
$entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count
}
}
# Initialize panel count

View File

@ -32,10 +32,10 @@ function Invoke-WPFUnInstall {
$ManagerPreference = $sync["ManagerPreference"]
Invoke-WPFRunspace -ArgumentList @(("PackagesToUninstall", $PackagesToInstall),("ManagerPreference", $ManagerPreference)) -DebugPreference $DebugPreference -ScriptBlock {
Invoke-WPFRunspace -ArgumentList @(("PackagesToUninstall", $PackagesToUninstall),("ManagerPreference", $ManagerPreference)) -DebugPreference $DebugPreference -ScriptBlock {
param($PackagesToUninstall, $ManagerPreference, $DebugPreference)
$packagesSorted = Get-WinUtilSelectedPackages -PackageList $PackagesToInstall -Preference $ManagerPreference
$packagesSorted = Get-WinUtilSelectedPackages -PackageList $PackagesToUninstall -Preference $ManagerPreference
$packagesWinget = $packagesSorted[[PackageManagers]::Winget]
$packagesChoco = $packagesSorted[[PackageManagers]::Choco]

View File

@ -25,7 +25,7 @@ function Invoke-WPFtweaksbutton {
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
# The leading "," in the ParameterList is nessecary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
$tweaksHandle = Invoke-WPFRunspace -ParameterList @(,("tweaks",$tweaks)) -DebugPreference $DebugPreference -ScriptBlock {
Invoke-WPFRunspace -ParameterList @(,("tweaks",$tweaks)) -DebugPreference $DebugPreference -ScriptBlock {
param(
$tweaks,
$DebugPreference

View File

@ -117,9 +117,6 @@ $sync.Form.Add_Loaded({
Invoke-WinutilThemeChange -init $true
# Load the configuration files
$noimage = "https://images.emojiterra.com/google/noto-emoji/unicode-15/color/512px/1f4e6.png"
$noimage = [Windows.Media.Imaging.BitmapImage]::new([Uri]::new($noimage))
$sync.configs.applicationsHashtable = @{}
$sync.configs.applications.PSObject.Properties | ForEach-Object {
$sync.configs.applicationsHashtable[$_.Name] = $_.Value
@ -127,13 +124,9 @@ $sync.configs.applications.PSObject.Properties | ForEach-Object {
# Now call the function with the final merged config
Invoke-WPFUIElements -configVariable $sync.configs.appnavigation -targetGridName "appscategory" -columncount 1
Initialize-WPFUI -targetGridName "appscategory"
# Add logic to handle click to the ToggleView Button on the Install Tab
$sync.WPFToggleView.Add_Click({
$sync.CompactView = -not $sync.CompactView
Update-AppTileProperties
})
Invoke-WPFUIApps -Apps $sync.configs.applicationsHashtable -targetGridName "appspanel"
Initialize-WPFUI -targetGridName "appspanel"
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
@ -211,44 +204,6 @@ Invoke-WPFRunspace -ScriptBlock {
# Print the logo
Show-CTTLogo
$sync.CompactView = $true
$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
$sync.Form.Resources.AppTileCompactVisibility = [Windows.Visibility]::Collapsed
$sync.Form.Resources.AppTileFontSize = [double]12
$sync.Form.Resources.AppTileMargins = [Windows.Thickness]2
$sync.Form.Resources.AppTileBorderThickness = [Windows.Thickness]0
}
else {
# 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
})
# Progress bar in taskbaritem > Set-WinUtilProgressbar
$sync["Form"].TaskbarItemInfo = New-Object System.Windows.Shell.TaskbarItemInfo
@ -421,12 +376,15 @@ if ($sync["ISOLanguage"].Items.Count -eq 1) {
}
$sync["ISOLanguage"].SelectedIndex = 0
$sync["SearchBar"].Add_TextChanged({
if ($sync.SearchBar.Text -ne "") {
$sync.SearchBarClearButton.Visibility = "Visible"
} else {
$sync.SearchBarClearButton.Visibility = "Collapsed"
}
# The SearchBarTimer is used to delay the search operation until the user has stopped typing for a short period
# This prevents the ui from stuttering when the user types quickly as it dosnt need to update the ui for every keystroke
$searchBarTimer = New-Object System.Windows.Threading.DispatcherTimer
$searchBarTimer.Interval = [TimeSpan]::FromMilliseconds(300)
$searchBarTimer.IsEnabled = $false
$searchBarTimer.add_Tick({
$searchBarTimer.Stop()
switch ($sync.currentTab) {
"Install" {
Find-AppsByNameOrDescription -SearchString $sync.SearchBar.Text
@ -436,6 +394,17 @@ $sync["SearchBar"].Add_TextChanged({
}
}
})
$sync["SearchBar"].Add_TextChanged({
if ($sync.SearchBar.Text -ne "") {
$sync.SearchBarClearButton.Visibility = "Visible"
} else {
$sync.SearchBarClearButton.Visibility = "Collapsed"
}
if ($searchBarTimer.IsEnabled) {
$searchBarTimer.Stop()
}
$searchBarTimer.Start()
})
$sync["Form"].Add_Loaded({
param($e)
@ -510,7 +479,8 @@ $sync["AboutMenuItem"].Add_Click({
$authorInfo = @"
Author : <a href="https://github.com/ChrisTitusTech">@christitustech</a>
Runspace : <a href="https://github.com/DeveloperDurp">@DeveloperDurp</a>
UI : <a href="https://github.com/MyDrift-user">@MyDrift-user</a>, <a href="https://github.com/Marterich">@Marterich</a>
Runspace : <a href="https://github.com/DeveloperDurp">@DeveloperDurp</a>, <a href="https://github.com/Marterich">@Marterich</a>
MicroWin : <a href="https://github.com/KonTy">@KonTy</a>, <a href="https://github.com/CodingWonders">@CodingWonders</a>
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>

View File

@ -40,10 +40,7 @@ $sync.configs = @{}
$sync.Buttons = [System.Collections.Generic.List[PSObject]]::new()
$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
@ -87,5 +84,5 @@ $logdir = "$env:localappdata\winutil\logs"
Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-Null
# Set PowerShell window title
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)"
$Host.UI.RawUI.WindowTitle = "WinUtil (Admin)"
clear-host

1
sign.bat Normal file
View File

@ -0,0 +1 @@
signtool.exe sign /td sha256 /tr http://timestamp.digicert.com /fd sha256 /n "CT Tech Group LLC" .\winutil.ps1

View File

@ -12,19 +12,34 @@
Height="Auto"
MaxWidth="1380"
MaxHeight="800"
Title="Chris Titus Tech's Windows Utility">
Title="WinUtil">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="10"/>
</WindowChrome.WindowChrome>
<Window.Resources>
<Style TargetType="ToolTip">
<Setter Property="Background" Value="{DynamicResource MainBackgroundColor}"/>
<Setter Property="Background" Value="{DynamicResource ToolTipBackgroundColor}"/>
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBackgroundSelectedColor}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderColor}"/>
<Setter Property="MaxWidth" Value="{DynamicResource ToolTipWidth}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="FontSize" Value="{DynamicResource FontSize}"/>
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}"/>
<!-- This ContentTemplate ensures that the content of the ToolTip wraps text properly for better readability -->
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<ContentPresenter Content="{TemplateBinding Content}">
<ContentPresenter.Resources>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type MenuItem}">
@ -67,22 +82,22 @@
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="AppTileBorderStyle" TargetType="Border">
<Style x:Key="AppEntryBorderStyle" TargetType="Border">
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="BorderThickness" Value="{DynamicResource AppTileBorderThickness}"/>
<Setter Property="BorderThickness" Value="{DynamicResource AppEntryBorderThickness}"/>
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="Padding" Value="{DynamicResource AppTileMargins}"/>
<Setter Property="Width" Value="{DynamicResource AppTileWidth}"/>
<Setter Property="Padding" Value="{DynamicResource AppEntryMargin}"/>
<Setter Property="Width" Value="{DynamicResource AppEntryWidth}"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Margin" Value="{DynamicResource AppTileMargins}"/>
<Setter Property="Margin" Value="{DynamicResource AppEntryMargin}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Background" Value="{DynamicResource AppInstallUnselectedColor}"/>
</Style>
<Style x:Key="AppTileCheckboxStyle" TargetType="CheckBox">
<Style x:Key="AppEntryCheckboxStyle" TargetType="CheckBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="{DynamicResource AppTileMargins}"/>
<Setter Property="Margin" Value="{DynamicResource AppEntryMargin}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
@ -94,40 +109,18 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="AppTileImageStyle" TargetType="Image">
<Setter Property="Width" Value="{DynamicResource AppTileImageSize}"/>
<Setter Property="Height" Value="{DynamicResource AppTileImageSize}"/>
<Setter Property="Margin">
<Setter.Value>
<Thickness Left="0" Top="0" Right="10" Bottom="0"/>
</Setter.Value>
</Setter>
<Setter Property="Clip">
<Setter.Value>
<RectangleGeometry Rect="0,0,40,40" RadiusX="5" RadiusY="5"/>
</Setter.Value>
</Setter>
<Setter Property="Visibility" Value="{DynamicResource AppTileCompactVisibility}"/>
</Style>
<Style x:Key="AppTileNameStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{DynamicResource AppTileFontSize}"/>
<Style x:Key="AppEntryNameStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{DynamicResource AppEntryFontSize}"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="{DynamicResource AppTileMargins}"/>
<Setter Property="Margin" Value="{DynamicResource AppEntryMargin}"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Key="AppTileButtonPanelStyle" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="{DynamicResource AppTileMargins}"/>
<Setter Property="Visibility" Value="{DynamicResource AppTileCompactVisibility}"/>
</Style>
<Style x:Key="AppTileButtonStyle" TargetType="Button">
<Setter Property="Width" Value="45"/>
<Setter Property="Height" Value="35"/>
<Setter Property="Margin" Value="0,0,10,0"/>
<Style x:Key="AppEntryButtonStyle" TargetType="Button">
<Setter Property="Width" Value="{DynamicResource IconButtonSize}"/>
<Setter Property="Height" Value="{DynamicResource IconButtonSize}"/>
<Setter Property="Margin" Value="{DynamicResource AppEntryMargin}"/>
<Setter Property="Foreground" Value="{DynamicResource ButtonForegroundColor}"/>
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundColor}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
@ -135,15 +128,43 @@
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="Segoe MDL2 Assets" FontSize="20"
Foreground="{DynamicResource MainForegroundColor}"
Background="Transparent" HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<TextBlock Text="{Binding}"
FontFamily="Segoe MDL2 Assets"
FontSize="{DynamicResource IconFontSize}"
Background="Transparent"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Border x:Name="BackgroundBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{DynamicResource ButtonBorderThickness}"
CornerRadius="{DynamicResource ButtonCornerRadius}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="BackgroundBorder" Property="Background" Value="{DynamicResource ButtonBackgroundPressedColor}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand"/>
<Setter TargetName="BackgroundBorder" Property="Background" Value="{DynamicResource ButtonBackgroundMouseoverColor}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="BackgroundBorder" Property="Background" Value="{DynamicResource ButtonBackgroundSelectedColor}"/>
<Setter Property="Foreground" Value="DimGray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="HoverButtonStyle">
<Setter Property="Foreground" Value="{DynamicResource MainForegroundColor}" />
<Setter Property="FontWeight" Value="Normal" />
@ -273,45 +294,6 @@
<Setter Property="Background" Value="{DynamicResource LabelBackgroundColor}"/>
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}"/>
</Style>
<!-- Category Toggle Button Style for the Apps Window-->
<Style x:Key="CategoryToggleButtonStyle" TargetType="ToggleButton">
<Setter Property="Foreground" Value="{DynamicResource LabelboxForegroundColor}"/>
<Setter Property="Background" Value="{DynamicResource MainBackgroundColor}"/>
<Setter Property="FontFamily" Value="{DynamicResource HeaderFontFamily}"/>
<Setter Property="FontSize" Value="{DynamicResource HeaderFontSize}"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Padding" Value="10,2,10,2"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}"
BorderBrush="{DynamicResource BorderColor}"
BorderThickness="0"
CornerRadius="{DynamicResource ButtonCornerRadius}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
<TextBlock x:Name="PrefixTextBlock"/>
<ContentPresenter Content="{TemplateBinding Content}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="PrefixTextBlock" Property="Text" Value="[-] "/>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="PrefixTextBlock" Property="Text" Value="[+] "/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ButtonBackgroundMouseoverColor}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- TextBlock template -->
<Style TargetType="TextBlock">