add compatibility for every app

This commit is contained in:
MyDrift 2024-09-28 00:43:56 +02:00
parent db521534bc
commit 71c35eccd6
2 changed files with 289 additions and 305 deletions

View File

@ -171,7 +171,6 @@
"category": "Browsers", "category": "Browsers",
"choco": "brave", "choco": "brave",
"content": "Brave", "content": "Brave",
"Type": "application",
"description": "Brave is a privacy-focused web browser that blocks ads and trackers, offering a faster and safer browsing experience.", "description": "Brave is a privacy-focused web browser that blocks ads and trackers, offering a faster and safer browsing experience.",
"link": "https://www.brave.com", "link": "https://www.brave.com",
"winget": "Brave.Brave" "winget": "Brave.Brave"
@ -234,7 +233,6 @@
}, },
"chrome": { "chrome": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "googlechrome", "choco": "googlechrome",
"content": "Chrome", "content": "Chrome",
"description": "Google Chrome is a widely used web browser known for its speed, simplicity, and seamless integration with Google services.", "description": "Google Chrome is a widely used web browser known for its speed, simplicity, and seamless integration with Google services.",
@ -243,7 +241,6 @@
}, },
"chromium": { "chromium": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "chromium", "choco": "chromium",
"content": "Chromium", "content": "Chromium",
"description": "Chromium is the open-source project that serves as the foundation for various web browsers, including Chrome.", "description": "Chromium is the open-source project that serves as the foundation for various web browsers, including Chrome.",
@ -252,7 +249,6 @@
}, },
"arc": { "arc": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "na", "choco": "na",
"content": "Arc", "content": "Arc",
"description": "Arc is a Chromium based browser, known for it's clean and modern design.", "description": "Arc is a Chromium based browser, known for it's clean and modern design.",
@ -477,7 +473,6 @@
}, },
"edge": { "edge": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "microsoft-edge", "choco": "microsoft-edge",
"content": "Edge", "content": "Edge",
"description": "Microsoft Edge is a modern web browser built on Chromium, offering performance, security, and integration with Microsoft services.", "description": "Microsoft Edge is a modern web browser built on Chromium, offering performance, security, and integration with Microsoft services.",
@ -534,7 +529,6 @@
}, },
"falkon": { "falkon": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "falkon", "choco": "falkon",
"content": "Falkon", "content": "Falkon",
"description": "Falkon is a lightweight and fast web browser with a focus on user privacy and efficiency.", "description": "Falkon is a lightweight and fast web browser with a focus on user privacy and efficiency.",
@ -591,7 +585,6 @@
}, },
"firefox": { "firefox": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "firefox", "choco": "firefox",
"content": "Firefox", "content": "Firefox",
"description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions.", "description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions.",
@ -600,7 +593,6 @@
}, },
"firefoxesr": { "firefoxesr": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "FirefoxESR", "choco": "FirefoxESR",
"content": "Firefox ESR", "content": "Firefox ESR",
"description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions. Firefox ESR (Extended Support Release) receives major updates every 42 weeks with minor updates such as crash fixes, security fixes and policy updates as needed, but at least every four weeks.", "description": "Mozilla Firefox is an open-source web browser known for its customization options, privacy features, and extensions. Firefox ESR (Extended Support Release) receives major updates every 42 weeks with minor updates such as crash fixes, security fixes and policy updates as needed, but at least every four weeks.",
@ -625,7 +617,6 @@
}, },
"floorp": { "floorp": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "na", "choco": "na",
"content": "Floorp", "content": "Floorp",
"description": "Floorp is an open-source web browser project that aims to provide a simple and fast browsing experience.", "description": "Floorp is an open-source web browser project that aims to provide a simple and fast browsing experience.",
@ -1098,7 +1089,6 @@
}, },
"librewolf": { "librewolf": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "librewolf", "choco": "librewolf",
"content": "LibreWolf", "content": "LibreWolf",
"description": "LibreWolf is a privacy-focused web browser based on Firefox, with additional privacy and security enhancements.", "description": "LibreWolf is a privacy-focused web browser based on Firefox, with additional privacy and security enhancements.",
@ -1291,7 +1281,6 @@
}, },
"mullvadbrowser": { "mullvadbrowser": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "na", "choco": "na",
"content": "Mullvad Browser", "content": "Mullvad Browser",
"description": "Mullvad Browser is a privacy-focused web browser, developed in partnership with the Tor Project.", "description": "Mullvad Browser is a privacy-focused web browser, developed in partnership with the Tor Project.",
@ -2204,7 +2193,6 @@
}, },
"thorium": { "thorium": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "na", "choco": "na",
"content": "Thorium Browser AVX2", "content": "Thorium Browser AVX2",
"description": "Browser built for speed over vanilla chromium. It is built with AVX2 optimizations and is the fastest browser on the market.", "description": "Browser built for speed over vanilla chromium. It is built with AVX2 optimizations and is the fastest browser on the market.",
@ -2237,7 +2225,6 @@
}, },
"tor": { "tor": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "tor-browser", "choco": "tor-browser",
"content": "Tor Browser", "content": "Tor Browser",
"description": "Tor Browser is designed for anonymous web browsing, utilizing the Tor network to protect user privacy and security.", "description": "Tor Browser is designed for anonymous web browsing, utilizing the Tor network to protect user privacy and security.",
@ -2286,7 +2273,6 @@
}, },
"ungoogled": { "ungoogled": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "ungoogled-chromium", "choco": "ungoogled-chromium",
"content": "Ungoogled", "content": "Ungoogled",
"description": "Ungoogled Chromium is a version of Chromium without Google's integration for enhanced privacy and control.", "description": "Ungoogled Chromium is a version of Chromium without Google's integration for enhanced privacy and control.",
@ -2367,7 +2353,6 @@
}, },
"vivaldi": { "vivaldi": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "vivaldi", "choco": "vivaldi",
"content": "Vivaldi", "content": "Vivaldi",
"description": "Vivaldi is a highly customizable web browser with a focus on user personalization and productivity features.", "description": "Vivaldi is a highly customizable web browser with a focus on user personalization and productivity features.",
@ -2424,7 +2409,6 @@
}, },
"waterfox": { "waterfox": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "waterfox", "choco": "waterfox",
"content": "Waterfox", "content": "Waterfox",
"description": "Waterfox is a fast, privacy-focused web browser based on Firefox, designed to preserve user choice and privacy.", "description": "Waterfox is a fast, privacy-focused web browser based on Firefox, designed to preserve user choice and privacy.",
@ -2897,7 +2881,6 @@
}, },
"PaleMoon": { "PaleMoon": {
"category": "Browsers", "category": "Browsers",
"Type": "application",
"choco": "paleMoon", "choco": "paleMoon",
"content": "PaleMoon", "content": "PaleMoon",
"description":"Pale Moon is an Open Source, Goanna-based web browser available for Microsoft Windows and Linux (with other operating systems in development), focusing on efficiency and ease of use.", "description":"Pale Moon is an Open Source, Goanna-based web browser available for Microsoft Windows and Linux (with other operating systems in development), focusing on efficiency and ease of use.",

View File

@ -134,6 +134,157 @@ function Invoke-WPFUIElements {
foreach ($entryInfo in $entries) { foreach ($entryInfo in $entries) {
$count++ $count++
if ($configVariable -eq $sync.configs.applications) {
# Create the outer Border for the application type
$border = New-Object Windows.Controls.Border
$border.BorderBrush = [Windows.Media.Brushes]::Gray
$border.BorderThickness = 1
$border.CornerRadius = 5
$border.Padding = New-Object Windows.Thickness(10)
$border.HorizontalAlignment = "Stretch"
$border.VerticalAlignment = "Top"
$border.Margin = New-Object Windows.Thickness(0, 10, 0, 0)
# Create a DockPanel inside the Border
$dockPanel = New-Object Windows.Controls.DockPanel
$dockPanel.LastChildFill = $true
$border.Child = $dockPanel
# Create the CheckBox, vertically centered
$checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $entryInfo.Name
$checkBox.HorizontalAlignment = "Left"
$checkBox.VerticalAlignment = "Center"
$checkBox.Margin = New-Object Windows.Thickness(5, 0, 10, 0)
[Windows.Controls.DockPanel]::SetDock($checkBox, [Windows.Controls.Dock]::Left)
$dockPanel.Children.Add($checkBox) | Out-Null
# Create a StackPanel for the image and name (for better alignment)
$imageAndNamePanel = New-Object Windows.Controls.StackPanel
$imageAndNamePanel.Orientation = "Horizontal"
$imageAndNamePanel.VerticalAlignment = "Center"
# Create the Image and load it from the local path
$image = New-Object Windows.Controls.Image
$image.Width = 40
$image.Height = 40
$image.Margin = New-Object Windows.Thickness(0, 0, 10, 0)
if (-not [string]::IsNullOrEmpty($kaka)) {
try {
$packageinfo = (choco info $entryInfo.choco --limit-output).Split(' ')[0]
$packageinfo = $packageinfo -replace '\|', '.'
$iconlink = "https://community.chocolatey.org/content/packageimages/" + $packageinfo
$finishediconlink = $iconlink + ".png"
$webimage = Invoke-WebRequest -Uri $finishediconlink -Method Head -ErrorAction SilentlyContinue
if ($webimage.StatusCode -eq 200) {
$image.Source = [Windows.Media.Imaging.BitmapImage]::new([Uri]::new($finishediconlink))
} else {
$finishediconlink = $iconlink + ".svg"
$image.Source = $noimage
}
} catch {
$image.Source = $noimage
}
} else {
$image.Source = $noimage
}
$image.Clip = New-Object Windows.Media.RectangleGeometry
$image.Clip.Rect = New-Object Windows.Rect(0, 0, $image.Width, $image.Height)
$image.Clip.RadiusX = 5
$image.Clip.RadiusY = 5
$imageAndNamePanel.Children.Add($image) | Out-Null
# Create the TextBlock for the application name (bigger and bold)
$appName = New-Object Windows.Controls.TextBlock
$appName.Text = $entryInfo.Content
$appName.FontSize = 16
$appName.FontWeight = [Windows.FontWeights]::Bold
$appName.VerticalAlignment = "Center"
$appName.Margin = New-Object Windows.Thickness(5, 0, 0, 0)
$imageAndNamePanel.Children.Add($appName) | Out-Null
# Add the image and name panel to the dock panel (after the checkbox)
[Windows.Controls.DockPanel]::SetDock($imageAndNamePanel, [Windows.Controls.Dock]::Left)
$dockPanel.Children.Add($imageAndNamePanel) | Out-Null
# Create the StackPanel for the buttons and dock it to the right
$buttonPanel = New-Object Windows.Controls.StackPanel
$buttonPanel.Orientation = "Horizontal"
$buttonPanel.HorizontalAlignment = "Right"
$buttonPanel.VerticalAlignment = "Center"
$buttonPanel.Margin = New-Object Windows.Thickness(10, 0, 0, 0)
[Windows.Controls.DockPanel]::SetDock($buttonPanel, [Windows.Controls.Dock]::Right)
# Create the "Install" button with the install icon from Segoe MDL2 Assets
$button1 = New-Object Windows.Controls.Button
$button1.Width = 45
$button1.Height = 35
$button1.Margin = New-Object Windows.Thickness(0, 0, 10, 0)
$installIcon = New-Object Windows.Controls.TextBlock
$installIcon.Text = [char]0xE118 # Install Icon
$installIcon.FontFamily = "Segoe MDL2 Assets"
$installIcon.FontSize = 20
$installIcon.Foreground = $theme.MainForegroundColor
$installIcon.Background = "Transparent"
$installIcon.HorizontalAlignment = "Center"
$installIcon.VerticalAlignment = "Center"
$button1.Content = $installIcon
$buttonPanel.Children.Add($button1) | Out-Null
# Create the "Uninstall" button with the uninstall icon from Segoe MDL2 Assets
$button2 = New-Object Windows.Controls.Button
$button2.Width = 45
$button2.Height = 35
$uninstallIcon = New-Object Windows.Controls.TextBlock
$uninstallIcon.Text = [char]0xE74D # Uninstall Icon
$uninstallIcon.FontFamily = "Segoe MDL2 Assets"
$uninstallIcon.FontSize = 20
$uninstallIcon.Foreground = $theme.MainForegroundColor
$uninstallIcon.Background = "Transparent"
$uninstallIcon.HorizontalAlignment = "Center"
$uninstallIcon.VerticalAlignment = "Center"
$button2.Content = $uninstallIcon
$buttonPanel.Children.Add($button2) | Out-Null
# Create the "Info" button with the info icon from Segoe MDL2 Assets
$infoButton = New-Object Windows.Controls.Button
$infoButton.Width = 45
$infoButton.Height = 35
$infoButton.Margin = New-Object Windows.Thickness(10, 0, 0, 0)
$infoIcon = New-Object Windows.Controls.TextBlock
$infoIcon.Text = [char]0xE946 # Info Icon
$infoIcon.FontFamily = "Segoe MDL2 Assets"
$infoIcon.FontSize = 20
$infoIcon.Foreground = $theme.MainForegroundColor
$infoIcon.Background = "Transparent"
$infoIcon.HorizontalAlignment = "Center"
$infoIcon.VerticalAlignment = "Center"
$infoButton.Content = $infoIcon
$buttonPanel.Children.Add($infoButton) | Out-Null
# Add the button panel to the DockPanel
$dockPanel.Children.Add($buttonPanel) | Out-Null
# Add the border to the main stack panel in the grid
$stackPanel.Children.Add($border) | Out-Null
# Sync the CheckBox, buttons, and info to the sync object for further use
$sync[$entryInfo.Name] = $checkBox
$sync[$entryInfo.Name + "_InstallButton"] = $button1
$sync[$entryInfo.Name + "_UninstallButton"] = $button2
$sync[$entryInfo.Name + "_InfoButton"] = $infoButton
} else {
# Create the UI elements based on the entry type
switch ($entryInfo.Type) { switch ($entryInfo.Type) {
"Toggle" { "Toggle" {
$dockPanel = New-Object Windows.Controls.DockPanel $dockPanel = New-Object Windows.Controls.DockPanel
@ -262,157 +413,6 @@ function Invoke-WPFUIElements {
$sync[$entryInfo.Name] = $radioButton $sync[$entryInfo.Name] = $radioButton
} }
"application" {
# Create the outer Border for the application type
$border = New-Object Windows.Controls.Border
$border.BorderBrush = [Windows.Media.Brushes]::Gray
$border.BorderThickness = 1
$border.CornerRadius = 5
$border.Padding = New-Object Windows.Thickness(10)
$border.HorizontalAlignment = "Stretch"
$border.VerticalAlignment = "Top"
$border.Margin = New-Object Windows.Thickness(0, 10, 0, 0)
# Create a DockPanel inside the Border
$dockPanel = New-Object Windows.Controls.DockPanel
$dockPanel.LastChildFill = $true
$border.Child = $dockPanel
# Create the CheckBox, vertically centered
$checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $entryInfo.Name
$checkBox.HorizontalAlignment = "Left"
$checkBox.VerticalAlignment = "Center"
$checkBox.Margin = New-Object Windows.Thickness(5, 0, 10, 0)
[Windows.Controls.DockPanel]::SetDock($checkBox, [Windows.Controls.Dock]::Left)
$dockPanel.Children.Add($checkBox) | Out-Null
# Create a StackPanel for the image and name (for better alignment)
$imageAndNamePanel = New-Object Windows.Controls.StackPanel
$imageAndNamePanel.Orientation = "Horizontal"
$imageAndNamePanel.VerticalAlignment = "Center"
# Create the Image and load it from the local path
$image = New-Object Windows.Controls.Image
$image.Width = 40
$image.Height = 40
$image.Margin = New-Object Windows.Thickness(0, 0, 10, 0)
if (-not [string]::IsNullOrEmpty($entryInfo.choco)) {
try {
$packageinfo = (choco info $entryInfo.choco --limit-output).Split(' ')[0]
$packageinfo = $packageinfo -replace '\|', '.'
$iconlink = "https://community.chocolatey.org/content/packageimages/" + $packageinfo
$finishediconlink = $iconlink + ".png"
$webimage = Invoke-WebRequest -Uri $finishediconlink -Method Head -ErrorAction SilentlyContinue
if ($webimage.StatusCode -eq 200) {
$image.Source = [Windows.Media.Imaging.BitmapImage]::new([Uri]::new($finishediconlink))
} else {
$finishediconlink = $iconlink + ".svg"
$image.Source = $noimage
}
} catch {
$image.Source = $noimage
}
} else {
$image.Source = $noimage
}
$image.Clip = New-Object Windows.Media.RectangleGeometry
$image.Clip.Rect = New-Object Windows.Rect(0, 0, $image.Width, $image.Height)
$image.Clip.RadiusX = 5
$image.Clip.RadiusY = 5
$imageAndNamePanel.Children.Add($image) | Out-Null
# Create the TextBlock for the application name (bigger and bold)
$appName = New-Object Windows.Controls.TextBlock
$appName.Text = $entryInfo.Content
$appName.FontSize = 16
$appName.FontWeight = [Windows.FontWeights]::Bold
$appName.VerticalAlignment = "Center"
$appName.Margin = New-Object Windows.Thickness(5, 0, 0, 0)
$imageAndNamePanel.Children.Add($appName) | Out-Null
# Add the image and name panel to the dock panel (after the checkbox)
[Windows.Controls.DockPanel]::SetDock($imageAndNamePanel, [Windows.Controls.Dock]::Left)
$dockPanel.Children.Add($imageAndNamePanel) | Out-Null
# Create the StackPanel for the buttons and dock it to the right
$buttonPanel = New-Object Windows.Controls.StackPanel
$buttonPanel.Orientation = "Horizontal"
$buttonPanel.HorizontalAlignment = "Right"
$buttonPanel.VerticalAlignment = "Center"
$buttonPanel.Margin = New-Object Windows.Thickness(10, 0, 0, 0)
[Windows.Controls.DockPanel]::SetDock($buttonPanel, [Windows.Controls.Dock]::Right)
# Create the "Install" button with the install icon from Segoe MDL2 Assets
$button1 = New-Object Windows.Controls.Button
$button1.Width = 45
$button1.Height = 35
$button1.Margin = New-Object Windows.Thickness(0, 0, 10, 0)
$installIcon = New-Object Windows.Controls.TextBlock
$installIcon.Text = [char]0xE118 # Install Icon
$installIcon.FontFamily = "Segoe MDL2 Assets"
$installIcon.FontSize = 20
$installIcon.Foreground = $theme.MainForegroundColor
$installIcon.Background = "Transparent"
$installIcon.HorizontalAlignment = "Center"
$installIcon.VerticalAlignment = "Center"
$button1.Content = $installIcon
$buttonPanel.Children.Add($button1) | Out-Null
# Create the "Uninstall" button with the uninstall icon from Segoe MDL2 Assets
$button2 = New-Object Windows.Controls.Button
$button2.Width = 45
$button2.Height = 35
$uninstallIcon = New-Object Windows.Controls.TextBlock
$uninstallIcon.Text = [char]0xE74D # Uninstall Icon
$uninstallIcon.FontFamily = "Segoe MDL2 Assets"
$uninstallIcon.FontSize = 20
$uninstallIcon.Foreground = $theme.MainForegroundColor
$uninstallIcon.Background = "Transparent"
$uninstallIcon.HorizontalAlignment = "Center"
$uninstallIcon.VerticalAlignment = "Center"
$button2.Content = $uninstallIcon
$buttonPanel.Children.Add($button2) | Out-Null
# Create the "Info" button with the info icon from Segoe MDL2 Assets
$infoButton = New-Object Windows.Controls.Button
$infoButton.Width = 45
$infoButton.Height = 35
$infoButton.Margin = New-Object Windows.Thickness(10, 0, 0, 0)
$infoIcon = New-Object Windows.Controls.TextBlock
$infoIcon.Text = [char]0xE946 # Info Icon
$infoIcon.FontFamily = "Segoe MDL2 Assets"
$infoIcon.FontSize = 20
$infoIcon.Foreground = $theme.MainForegroundColor
$infoIcon.Background = "Transparent"
$infoIcon.HorizontalAlignment = "Center"
$infoIcon.VerticalAlignment = "Center"
$infoButton.Content = $infoIcon
$buttonPanel.Children.Add($infoButton) | Out-Null
# Add the button panel to the DockPanel
$dockPanel.Children.Add($buttonPanel) | Out-Null
# Add the border to the main stack panel in the grid
$stackPanel.Children.Add($border) | Out-Null
# Sync the CheckBox, buttons, and info to the sync object for further use
$sync[$entryInfo.Name] = $checkBox
$sync[$entryInfo.Name + "_InstallButton"] = $button1
$sync[$entryInfo.Name + "_UninstallButton"] = $button2
$sync[$entryInfo.Name + "_InfoButton"] = $infoButton
}
default { default {
$horizontalStackPanel = New-Object Windows.Controls.StackPanel $horizontalStackPanel = New-Object Windows.Controls.StackPanel
$horizontalStackPanel.Orientation = "Horizontal" $horizontalStackPanel.Orientation = "Horizontal"
@ -448,3 +448,4 @@ function Invoke-WPFUIElements {
} }
} }
} }
}