mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-18 10:47:44 -06:00
dd70526731
* Added Applications AFFiNE: Open source Notion alternative with selfhostable option for syncing. Wazuh Agent: Adgent for open-source security monitoring platform * Change layout of toggles Change the layout of the toggles to first show toggles and then the content (text). - testet, works * added snap related toggles - disable snapping entirely (requires relogin of windows user) - disable suggestion to snap other windows next to the snapped window -tested * Layouted Checkboxes, redesigned Toggles & renamed RDCMan - Removed text inside toggle as it can be confusing because it sais "enable" while enabled and "disable" if disabled. The coloring should be enough to know in what state that setting is. - without the text i could make it a little bit smaller while still letting it look good. - Renamed "Remote Desktop Connection Manager (RDCMan)" to "RDCMan" because that name is shorter and also mostly used by the linked site. - layouted checkboxes so they are not more left than the title and look tidy. - tested * Disable Acrobat auto-updates - added script & undoscript to disable automatic downloads & installation of acrobat reader. The user gets a notified if there is an update available. I put some info to that inside the code * edited AFFiNE description * Tweak Adobe Debloater -disable Adobe Desktop Service by getting ownership and renaming it. - added AGMService service - disable AGMService and AGSService entirely * Block Adobe Network, Debloat Adobe & Compile - fixes order of tweaks to always run "WPFTweaksRestorePoint" first. Before it was only the case because if was one of the first letter0s of the alphabet - Fixed some stuff at Debloat Adobe & added Adobe Reader update stopper & "deactivated" Adobe Desktop Service. - Added Blocking of Adobe Servers (as of your suggestion) to it's own Tweak. - ran compile for testing & showing * undo compilation * added Note to AcrobatUpdates Management in Tweak "Debloat Adobe" * Fix Right Click Method to use accurate names * fixed my mistake in README --------- Co-authored-by: Chris Titus <contact@christitus.com>
127 lines
6.8 KiB
PowerShell
127 lines
6.8 KiB
PowerShell
function Get-TabXaml {
|
|
<#
|
|
.SYNOPSIS
|
|
Generates XAML for a tab in the WinUtil GUI
|
|
This function is used to generate the XAML for the applications tab in the WinUtil GUI
|
|
It takes the tabname and the number of columns to display the applications in as input and returns the XAML for the tab as output
|
|
.PARAMETER tabname
|
|
The name of the tab to generate XAML for
|
|
.PARAMETER columncount
|
|
The number of columns to display the applications in
|
|
.OUTPUTS
|
|
The XAML for the tab
|
|
.EXAMPLE
|
|
Get-TabXaml "applications" 3
|
|
#>
|
|
|
|
|
|
param( [Parameter(Mandatory=$true)]
|
|
$tabname,
|
|
$columncount = 0
|
|
)
|
|
$organizedData = @{}
|
|
# Iterate through JSON data and organize by panel and category
|
|
foreach ($appName in $sync.configs.$tabname.PSObject.Properties.Name) {
|
|
$appInfo = $sync.configs.$tabname.$appName
|
|
|
|
# Create an object for the application
|
|
$appObject = [PSCustomObject]@{
|
|
Name = $appName
|
|
Category = $appInfo.Category
|
|
Content = $appInfo.Content
|
|
Choco = $appInfo.choco
|
|
Winget = $appInfo.winget
|
|
Panel = if ($columncount -gt 0 ) { "0" } else {$appInfo.panel}
|
|
Link = $appInfo.link
|
|
Description = $appInfo.description
|
|
# Type is (Checkbox,Toggle,Button,Combobox ) (Default is Checkbox)
|
|
Type = $appInfo.type
|
|
ComboItems = $appInfo.ComboItems
|
|
# Checked is the property to set startup checked status of checkbox (Default is false)
|
|
Checked = $appInfo.Checked
|
|
}
|
|
|
|
if (-not $organizedData.ContainsKey($appObject.panel)) {
|
|
$organizedData[$appObject.panel] = @{}
|
|
}
|
|
|
|
if (-not $organizedData[$appObject.panel].ContainsKey($appObject.Category)) {
|
|
$organizedData[$appObject.panel][$appObject.Category] = @{}
|
|
}
|
|
|
|
# Store application data in a sub-array under the category
|
|
# Add Order property to keep the original order of tweaks and features
|
|
$organizedData[$appObject.panel][$appInfo.Category]["$($appInfo.order)$appName"] = $appObject
|
|
}
|
|
$panelcount=0
|
|
$paneltotal = $organizedData.Keys.Count
|
|
if ($columncount -gt 0) {
|
|
$appcount = $sync.configs.$tabname.PSObject.Properties.Name.count + $organizedData["0"].Keys.count
|
|
$maxcount = [Math]::Round( $appcount / $columncount + 0.5)
|
|
$paneltotal = $columncount
|
|
}
|
|
# add ColumnDefinitions to evenly draw colums
|
|
$blockXml="<Grid.ColumnDefinitions>`n"+("<ColumnDefinition Width=""*""/>`n"*($paneltotal))+"</Grid.ColumnDefinitions>`n"
|
|
# Iterate through organizedData by panel, category, and application
|
|
$count = 0
|
|
foreach ($panel in ($organizedData.Keys | Sort-Object)) {
|
|
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
|
|
$panelcount++
|
|
foreach ($category in ($organizedData[$panel].Keys | Sort-Object)) {
|
|
$count++
|
|
if ($columncount -gt 0) {
|
|
$panelcount2 = [Int](($count)/$maxcount-0.5)
|
|
if ($panelcount -eq $panelcount2 ) {
|
|
$blockXml +="`n</StackPanel>`n</Border>`n"
|
|
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
|
|
$panelcount++
|
|
}
|
|
}
|
|
$blockXml += "<Label Content=""$($category -replace '^.__', '')"" FontSize=""16""/>`n"
|
|
$sortedApps = $organizedData[$panel][$category].Keys | Sort-Object
|
|
foreach ($appName in $sortedApps) {
|
|
$count++
|
|
if ($columncount -gt 0) {
|
|
$panelcount2 = [Int](($count)/$maxcount-0.5)
|
|
if ($panelcount -eq $panelcount2 ) {
|
|
$blockXml +="`n</StackPanel>`n</Border>`n"
|
|
$blockXml += "<Border Grid.Row=""1"" Grid.Column=""$panelcount"">`n<StackPanel Background=""{MainBackgroundColor}"" SnapsToDevicePixels=""True"">`n"
|
|
$panelcount++
|
|
}
|
|
}
|
|
$appInfo = $organizedData[$panel][$category][$appName]
|
|
if ("Toggle" -eq $appInfo.Type) {
|
|
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,10,0,0`">`n"
|
|
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Style=`"{StaticResource ColorfulToggleSwitchStyle}`" Margin=`"2.5,0`"/>`n"
|
|
$blockXml += "<Label Content=`"$($appInfo.Content)`" Style=`"{StaticResource labelfortweaks}`" ToolTip=`"$($appInfo.Description)`" />`n</StackPanel>`n"
|
|
} elseif ("Combobox" -eq $appInfo.Type) {
|
|
$blockXml += "<StackPanel Orientation=`"Horizontal`" Margin=`"0,5,0,0`">`n<Label Content=`"$($appInfo.Content)`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`"/>`n"
|
|
$blockXml += "<ComboBox Name=`"$($appInfo.Name)`" Height=`"32`" Width=`"186`" HorizontalAlignment=`"Left`" VerticalAlignment=`"Center`" Margin=`"5,5`">`n"
|
|
$addfirst="IsSelected=`"True`""
|
|
foreach ($comboitem in ($appInfo.ComboItems -split " ")) {
|
|
$blockXml += "<ComboBoxItem $addfirst Content=`"$comboitem`"/>`n"
|
|
$addfirst=""
|
|
}
|
|
$blockXml += "</ComboBox>`n</StackPanel>"
|
|
# If it is a digit, type is button and button length is digits
|
|
} elseif ($appInfo.Type -match "^[\d\.]+$") {
|
|
$blockXml += "<Button Name=`"$($appInfo.Name)`" Content=`"$($appInfo.Content)`" HorizontalAlignment = `"Left`" Width=`"$($appInfo.Type)`" Margin=`"5`" Padding=`"20,5`" />`n"
|
|
# else it is a checkbox
|
|
} else {
|
|
$checkedStatus = If ($null -eq $appInfo.Checked) {""} Else {"IsChecked=`"$($appInfo.Checked)`" "}
|
|
if ($null -eq $appInfo.Link)
|
|
{
|
|
$blockXml += "<CheckBox Name=`"$($appInfo.Name)`" Content=`"$($appInfo.Content)`" $($checkedStatus)Margin=`"5,0`" ToolTip=`"$($appInfo.Description)`"/>`n"
|
|
}
|
|
else
|
|
{
|
|
$blockXml += "<StackPanel Orientation=""Horizontal"">`n<CheckBox Name=""$($appInfo.Name)"" Content=""$($appInfo.Content)"" $($checkedStatus)ToolTip=""$($appInfo.Description)"" Margin=""0,0,2,0""/><TextBlock Name=""$($appInfo.Name)Link"" Style=""{StaticResource HoverTextBlockStyle}"" Text=""(?)"" ToolTip=""$($appInfo.Link)"" />`n</StackPanel>`n"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$blockXml +="`n</StackPanel>`n</Border>`n"
|
|
}
|
|
return ($blockXml)
|
|
}
|