From c65cc2d167c076f5f894e0a2d41e40a95623e956 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 26 Dec 2024 13:49:28 +0100 Subject: [PATCH 01/23] XAML code first step --- .../SettingsXAML/Views/PowerLauncherPage.xaml | 37 +++++++++++++++++-- .../Settings.UI/Strings/en-us/Resources.resw | 8 +++- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index a0b4bca96622..e1b03c4f1b75 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -688,10 +688,39 @@ MinHeight="0" BorderThickness="0" ContentAlignment="Right"> - - - - + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index 7f3b5fdabab7..759219ea28ff 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -3966,7 +3966,7 @@ Activate by holding the key for the character you want to add an accent to, then Add advanced capabilities when using 'Paste with AI' including the power to 'chain' multiple transformations together and work with images and files. This feature may consume more API credits when used. - + Advanced Paste is a tool to put your clipboard content into any format you need, focused towards developer workflows. It can paste as plain text, markdown, or json directly with the UX or with a direct keystroke invoke. These are fully locally executed. In addition, it has an AI powered option that is 100% opt-in and requires an Open AI key. Note: this will replace the formatted text in your clipboard with the selected format. @@ -4695,4 +4695,10 @@ Activate by holding the key for the character you want to add an accent to, then Enable module + + Version + + + Open website + \ No newline at end of file From b08a3a2ce0797a1384cf5e157ca0297eb77527ab Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:28:22 +0100 Subject: [PATCH 02/23] Update plugin.json --- .../Community.PowerToys.Run.Plugin.UnitConverter/plugin.json | 2 +- .../Community.PowerToys.Run.Plugin.VSCodeWorkspaces/plugin.json | 2 +- .../Community.PowerToys.Run.Plugin.ValueGenerator/plugin.json | 2 +- .../Community.PowerToys.Run.Plugin.WebSearch/plugin.json | 2 +- .../launcher/Plugins/Microsoft.Plugin.Folder/plugin.json | 2 +- src/modules/launcher/Plugins/Microsoft.Plugin.Shell/plugin.json | 2 +- src/modules/launcher/Plugins/Microsoft.Plugin.Uri/plugin.json | 2 +- .../launcher/Plugins/Microsoft.Plugin.WindowWalker/plugin.json | 2 +- .../Microsoft.PowerToys.Run.Plugin.Calculator/plugin.json | 2 +- .../Plugins/Microsoft.PowerToys.Run.Plugin.History/plugin.json | 2 +- .../Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/plugin.json | 2 +- .../Microsoft.PowerToys.Run.Plugin.PowerToys/plugin.json | 2 +- .../Plugins/Microsoft.PowerToys.Run.Plugin.Registry/plugin.json | 2 +- .../Plugins/Microsoft.PowerToys.Run.Plugin.Service/plugin.json | 2 +- .../Plugins/Microsoft.PowerToys.Run.Plugin.System/plugin.json | 2 +- .../Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/plugin.json | 2 +- .../Microsoft.PowerToys.Run.Plugin.WindowsSettings/plugin.json | 2 +- .../Microsoft.PowerToys.Run.Plugin.WindowsTerminal/plugin.json | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/plugin.json b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/plugin.json index 267dd5687b66..51d639f12c6c 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/plugin.json +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/plugin.json @@ -6,7 +6,7 @@ "Author": "ThiefZero", "Version": "0.0.1", "Language": "csharp", - "Website": "https://github.com/ThiefZero", + "Website": "https://aka.ms/PowerToys", "IcoPathDark": "Images\\unitconverter.dark.png", "IcoPathLight": "Images\\unitconverter.light.png", "ExecuteFileName": "Community.PowerToys.Run.Plugin.UnitConverter.dll" diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/plugin.json b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/plugin.json index 2c6d9cb70d70..fe3bafb91292 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/plugin.json +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/plugin.json @@ -6,7 +6,7 @@ "Author": "ricardosantos9521", "Version": "1.1.0", "Language": "csharp", - "Website": "https://github.com/ricardosantos9521/PowerToys/", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll", "IsGlobal": false, "IcoPathDark": "Images\\code.dark.png", diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/plugin.json b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/plugin.json index 085efe787b85..0e2814ebe2a8 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/plugin.json +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/plugin.json @@ -7,7 +7,7 @@ "Author": "IHorvalds", "Version": "1.0.0", "Language": "csharp", - "Website": "https://github/com/IHorvalds", + "Website": "https://aka.ms/PowerToys", "IcoPathDark": "Images\\ValueGenerator.dark.png", "IcoPathLight": "Images\\ValueGenerator.light.png", "ExecuteFileName": "Community.PowerToys.Run.Plugin.ValueGenerator.dll" diff --git a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/plugin.json b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/plugin.json index 6a751c6071c8..5d6975ee2777 100644 --- a/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/plugin.json +++ b/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/plugin.json @@ -6,7 +6,7 @@ "Author": "cyberrex5", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Community.PowerToys.Run.Plugin.WebSearch.dll", "IcoPathDark": "Images\\WebSearch.dark.png", "IcoPathLight": "Images\\WebSearch.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/plugin.json b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/plugin.json index b806f829450b..0e4fcc031b86 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/plugin.json @@ -6,7 +6,7 @@ "Author": "qianlifeng", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.Plugin.Folder.dll", "IcoPathDark": "Images\\folder.dark.png", "IcoPathLight": "Images\\folder.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/plugin.json b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/plugin.json index d38d25985841..a0fa25c12c5c 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/plugin.json @@ -6,7 +6,7 @@ "Author": "qianlifeng", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.Plugin.Shell.dll", "IcoPathDark": "Images\\shell.dark.png", "IcoPathLight": "Images\\shell.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/plugin.json b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/plugin.json index f6b619e34c00..d5e17ed64a95 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/plugin.json @@ -6,7 +6,7 @@ "Author": "Microsoft", "Version": "1.0.0", "Language": "csharp", - "Website": "http://aka.ms/PowerToys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.Plugin.Uri.dll", "IcoPathDark": "Images\\uri.dark.png", "IcoPathLight": "Images\\uri.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/plugin.json b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/plugin.json index c12c917325bd..6f3877115dc5 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/plugin.json @@ -6,7 +6,7 @@ "Author": "betadele", "Version": "1.0.0", "Language": "csharp", - "Website": "https://www.windowwalker.com/", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.Plugin.WindowWalker.dll", "IcoPathDark": "Images\\windowwalker.dark.png", "IcoPathLight": "Images\\windowwalker.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/plugin.json index 3c78e8c18361..d8a6356f4b31 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/plugin.json @@ -6,7 +6,7 @@ "Author": "cxfksword", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.Calculator.dll", "IcoPathDark": "Images\\calculator.dark.png", "IcoPathLight": "Images\\calculator.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/plugin.json index 6ef0a02b0f17..1a25b9ec7a2b 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/plugin.json @@ -6,7 +6,7 @@ "Author": "jefflord", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.History.dll", "IcoPathDark": "Images\\history.dark.png", "IcoPathLight": "Images\\history.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/plugin.json index 94d50990a3bd..88874001b66c 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/plugin.json @@ -7,7 +7,7 @@ "Author": "palenshus", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.OneNote.dll", "IcoPathDark": "Images\\oneNote.dark.png", "IcoPathLight": "Images\\oneNote.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/plugin.json index f6c44a4b6658..ad56c9bfb283 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/plugin.json @@ -6,7 +6,7 @@ "Author": "davidegiacometti", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.PowerToys.dll", "IcoPathDark": "Images\\PowerToys.dark.png", "IcoPathLight": "Images\\PowerToys.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/plugin.json index 082e47b56f93..c15a62abb534 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/plugin.json @@ -6,7 +6,7 @@ "Author": "TobiasSekan", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.Registry.dll", "IcoPathDark": "Images\\reg.dark.png", "IcoPathLight": "Images\\reg.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/plugin.json index 6833dc8a99e2..2d5883332206 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/plugin.json @@ -6,7 +6,7 @@ "Author": "davidegiacometti", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.Service.dll", "IcoPathDark": "Images\\service.dark.png", "IcoPathLight": "Images\\service.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/plugin.json index 30811cbad515..0c83f63db0d0 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/plugin.json @@ -6,7 +6,7 @@ "Author": "Wox", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.System.dll", "IcoPathDark": "Images\\lock.dark.png", "IcoPathLight": "Images\\lock.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/plugin.json index 7b0a55d195c6..f96e13c7ffaa 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/plugin.json @@ -6,7 +6,7 @@ "Author": "htcfreek", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.TimeDate.dll", "IcoPathDark": "Images\\timeDate.dark.png", "IcoPathLight": "Images\\timeDate.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/plugin.json index 478a5d38b2be..30e7308fcb54 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/plugin.json @@ -6,7 +6,7 @@ "Author": "TobiasSekan", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll", "IcoPathDark": "Images\\WindowsSettings.dark.png", "IcoPathLight": "Images\\WindowsSettings.light.png" diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/plugin.json b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/plugin.json index ea70b4a6527f..d8a048112152 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/plugin.json +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/plugin.json @@ -7,7 +7,7 @@ "Author": "davidegiacometti", "Version": "1.0.0", "Language": "csharp", - "Website": "https://aka.ms/powertoys", + "Website": "https://aka.ms/PowerToys", "ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll", "IcoPathDark": "Images\\WindowsTerminal.dark.png", "IcoPathLight": "Images\\WindowsTerminal.light.png" From 9299dbae09cc7602fde3d8c656bc75285ea10420 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:38:28 +0100 Subject: [PATCH 03/23] update settings shema --- .../Settings.UI.Library/PowerLauncherPluginSettings.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/settings-ui/Settings.UI.Library/PowerLauncherPluginSettings.cs b/src/settings-ui/Settings.UI.Library/PowerLauncherPluginSettings.cs index 2b84fe16f230..0eac24b1269e 100644 --- a/src/settings-ui/Settings.UI.Library/PowerLauncherPluginSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerLauncherPluginSettings.cs @@ -14,8 +14,12 @@ public class PowerLauncherPluginSettings public string Description { get; set; } + public string Version { get; set; } + public string Author { get; set; } + public string Website { get; set; } + public bool Disabled { get; set; } // Use to communicate the state to settings UI (Using int type because we can't reference GPOWrapper.) From 571a3c460907bed07124a8686ede6d3677a37d80 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:38:44 +0100 Subject: [PATCH 04/23] update xaml code and viewmodel --- .../Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml | 6 +++--- .../Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index e1b03c4f1b75..e64c6fec2ef9 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -694,7 +694,7 @@ Spacing="5"> - + + ToolTipService.ToolTip="{x:Bind Website}"> settings.Description; } + public string Version { get => settings.Version; } + public string Author { get => settings.Author; } + public string Website { get => settings.Website; } + private GpoRuleConfigured _enabledGpoRuleConfiguration; private bool _enabledGpoRuleIsConfigured; From 8edd0a79d6cc367a8c16353f58b7020b3e6472e6 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:59:02 +0100 Subject: [PATCH 05/23] update PT Run's code --- src/modules/launcher/PowerLauncher/SettingsReader.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/launcher/PowerLauncher/SettingsReader.cs b/src/modules/launcher/PowerLauncher/SettingsReader.cs index d70d34a14455..a083f9cd23f7 100644 --- a/src/modules/launcher/PowerLauncher/SettingsReader.cs +++ b/src/modules/launcher/PowerLauncher/SettingsReader.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.IO.Abstractions; using System.Linq; @@ -251,7 +252,9 @@ private static IEnumerable GetDefaultPluginsSetting Id = x.Metadata.ID, Name = x.Plugin == null ? x.Metadata.Name : x.Plugin.Name, Description = x.Plugin?.Description, + Version = FileVersionInfo.GetVersionInfo(x.Metadata.ExecuteFilePath).ProductVersion, Author = x.Metadata.Author, + Website = x.Metadata.Website, Disabled = x.Metadata.Disabled, IsGlobal = x.Metadata.IsGlobal, ActionKeyword = x.Metadata.ActionKeyword, @@ -281,7 +284,9 @@ private static void UpdateSettings(PowerLauncherSettings settings) var enabledPolicyState = GPOWrapper.GetRunPluginEnabledValue(id); plugin.Name = name; plugin.Description = value.Description; + plugin.Version = value.Version; plugin.Author = value.Author; + plugin.Website = value.Website; plugin.IconPathDark = value.IconPathDark; plugin.IconPathLight = value.IconPathLight; plugin.EnabledPolicyUiState = (int)enabledPolicyState; From bd63b7355ce9ff9f7ab727720a08ada9cb5bf5de Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Thu, 26 Dec 2024 17:30:11 +0100 Subject: [PATCH 06/23] xaml code improvements --- .../Settings.UI/SettingsXAML/Styles/TextBlock.xaml | 5 +++++ .../Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml | 8 +++++--- .../ViewModels/PowerLauncherPluginViewModel.cs | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Styles/TextBlock.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Styles/TextBlock.xaml index 1872581498fc..eea4a05401ff 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Styles/TextBlock.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Styles/TextBlock.xaml @@ -19,6 +19,11 @@ + 12 + + 12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -688,45 +746,11 @@ MinHeight="0" BorderThickness="0" ContentAlignment="Right"> - - - - - - - - - - - - - - - + diff --git a/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs new file mode 100644 index 000000000000..be714a3847e7 --- /dev/null +++ b/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; + +namespace Microsoft.PowerToys.Settings.UI.ViewModels +{ + public class PluginMetadataViewModel : INotifyPropertyChanged + { + public PluginMetadataViewModel(string value, PluginMetadataType type) + { + _value = value; + _type = type; + } + + private string _value; + + private PluginMetadataType _type; + + public string Value => _value; + + public PluginMetadataType Type => _type; + + // Handle property changes + public event PropertyChangedEventHandler PropertyChanged; + + private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public enum PluginMetadataType + { + Version, + Author, + Link, + } + } +} diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index 237ad9167697..2c72c4b52d17 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -11,6 +11,7 @@ using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; +using Windows.Media.Playback; namespace Microsoft.PowerToys.Settings.UI.ViewModels { @@ -46,7 +47,7 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func settings.Description; } - public string Version { get => settings.Version; } + public string Version { get => settings.Version; } public string Author { get => settings.Author; } @@ -176,6 +177,25 @@ public IEnumerable AdditionalOptions } } + public IEnumerable PluginMetadatItems + { + get + { + List metadataList = new() + { + { new PluginMetadataViewModel(settings.Version, PluginMetadataViewModel.PluginMetadataType.Version) }, + { new PluginMetadataViewModel(settings.Author, PluginMetadataViewModel.PluginMetadataType.Author) }, + }; + + if (Uri.IsWellFormedUriString(settings.Website, UriKind.Absolute)) + { + metadataList.Add(new PluginMetadataViewModel(settings.Website, PluginMetadataViewModel.PluginMetadataType.Link)); + } + + return metadataList; + } + } + public bool ShowAdditionalOptions { get => AdditionalOptions.Any(); From 98557652ef34d6e209136f84bb0c7b114150b9f5 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:22:38 +0100 Subject: [PATCH 12/23] cleanup --- .../SettingsXAML/Views/PowerLauncherPage.xaml | 2 +- .../ViewModels/PowerLauncherPluginViewModel.cs | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index 5d4ceacdbaeb..cb949a2d70dc 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -748,7 +748,7 @@ ContentAlignment="Right"> diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index 2c72c4b52d17..4bb601d2271e 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -47,14 +47,6 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func settings.Description; } - public string Version { get => settings.Version; } - - public string Author { get => settings.Author; } - - public string Website { get => settings.Website; } - - public bool HasValidWebsiteUri { get => Uri.IsWellFormedUriString(settings.Website, UriKind.Absolute); } - private GpoRuleConfigured _enabledGpoRuleConfiguration; private bool _enabledGpoRuleIsConfigured; @@ -177,7 +169,10 @@ public IEnumerable AdditionalOptions } } - public IEnumerable PluginMetadatItems + /// + /// Note: The items oder in the array defines the order in the ui. + /// + public IEnumerable PluginMetadataItems { get { From 7ffadb6ec680e027c001544cd7e1f2747d7947a2 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:26:10 +0100 Subject: [PATCH 13/23] comment fix --- .../Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index 4bb601d2271e..dca9937f6460 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -11,7 +11,6 @@ using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; -using Windows.Media.Playback; namespace Microsoft.PowerToys.Settings.UI.ViewModels { @@ -170,8 +169,11 @@ public IEnumerable AdditionalOptions } /// - /// Note: The items oder in the array defines the order in the ui. + /// Gets the list of metadata properties like version, author, website. /// + /// + /// The items oder in the array defines the order in the ui. + /// public IEnumerable PluginMetadataItems { get From eebf75831bb241a3dc84b7f23dc3a9ffb4a9bef0 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:27:00 +0100 Subject: [PATCH 14/23] spell fix --- .../Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index dca9937f6460..9a5c04843130 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -172,7 +172,7 @@ public IEnumerable AdditionalOptions /// Gets the list of metadata properties like version, author, website. /// /// - /// The items oder in the array defines the order in the ui. + /// The items order in the array defines the order in the ui. /// public IEnumerable PluginMetadataItems { From d395fea9f674f6fb44c1c21682c40861a841d2ba Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sat, 28 Dec 2024 14:41:30 +0100 Subject: [PATCH 15/23] Move separator into custom control --- .../Controls/MetadataDotSeparator.xaml | 16 ++++++++++++++++ .../Controls/MetadataDotSeparator.xaml.cs | 17 +++++++++++++++++ .../SettingsXAML/Views/PowerLauncherPage.xaml | 12 ++---------- 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml create mode 100644 src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml.cs diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml new file mode 100644 index 000000000000..a3d3eed8249c --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml.cs new file mode 100644 index 000000000000..82b06b564342 --- /dev/null +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; + +namespace Microsoft.PowerToys.Settings.UI.Controls +{ + public sealed partial class MetadataDotSeparator : UserControl + { + public MetadataDotSeparator() + { + this.InitializeComponent(); + } + } +} diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index cb949a2d70dc..29b15a4490bd 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -321,11 +321,7 @@ - + @@ -335,11 +331,7 @@ - + Date: Sat, 28 Dec 2024 15:04:44 +0100 Subject: [PATCH 16/23] fix layout if plugin is desabled --- .../Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index 29b15a4490bd..f77c3ec4d01a 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -737,7 +737,8 @@ + ContentAlignment="Right" + IsEnabled="{x:Bind Enabled, Mode=OneWay}"> Date: Sat, 28 Dec 2024 19:32:38 +0100 Subject: [PATCH 17/23] code cleanup and improvements --- .../RunPluginMetadataTemplateSelector.cs | 6 +++ .../SettingsXAML/Views/PowerLauncherPage.xaml | 41 +++++++++---------- .../ViewModels/PluginMetadataViewModel.cs | 25 +++++++++-- .../PowerLauncherPluginViewModel.cs | 8 ++-- 4 files changed, 53 insertions(+), 27 deletions(-) diff --git a/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs b/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs index 8e1cb79f4377..492b204bdd90 100644 --- a/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs +++ b/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs @@ -19,6 +19,11 @@ public sealed partial class RunPluginMetadataTemplateSelector : DataTemplateSele public DataTemplate MetadataWebsiteTemplate { get; set; } + /// + /// Gets or sets a template for the separator between the items + /// + public DataTemplate MetadataSeparatorTemplate { get; set; } + /// /// Gets or sets an empty template used as fall back in case of malformed data /// @@ -33,6 +38,7 @@ protected override DataTemplate SelectTemplateCore(object item, DependencyObject PluginMetadataViewModel.PluginMetadataType.Version => MetadataVersionTemplate, PluginMetadataViewModel.PluginMetadataType.Author => MetadataAuthorTemplate, PluginMetadataViewModel.PluginMetadataType.Link => MetadataWebsiteTemplate, + PluginMetadataViewModel.PluginMetadataType.ItemSeparator => MetadataSeparatorTemplate, _ => EmptyMetadataTemplate, }; } diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index f77c3ec4d01a..720d4697ccf4 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -43,6 +43,7 @@ x:Key="RunPluginMetadataTemplateSelector" EmptyMetadataTemplate="{StaticResource EmptyMetadataTemplate}" MetadataAuthorTemplate="{StaticResource MetadataAuthorTemplate}" + MetadataSeparatorTemplate="{StaticResource MetadataSeparatorTemplate}" MetadataVersionTemplate="{StaticResource MetadataVersionTemplate}" MetadataWebsiteTemplate="{StaticResource MetadataWebsiteTemplate}" /> @@ -320,30 +321,28 @@ - - - - - - - + + + + - - - - - - + + + + + + + diff --git a/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs index be714a3847e7..831854fc5efb 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs @@ -13,7 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { public class PluginMetadataViewModel : INotifyPropertyChanged { - public PluginMetadataViewModel(string value, PluginMetadataType type) + private PluginMetadataViewModel(string value, PluginMetadataType type) { _value = value; _type = type; @@ -21,12 +21,29 @@ public PluginMetadataViewModel(string value, PluginMetadataType type) private string _value; - private PluginMetadataType _type; - public string Value => _value; + private PluginMetadataType _type; + public PluginMetadataType Type => _type; + // Do not user for item separator initialization. + public static PluginMetadataViewModel MetadataItem(string value, PluginMetadataType type) + { + ArgumentNullException.ThrowIfNullOrWhiteSpace(value); + if (type == PluginMetadataType.ItemSeparator) + { + throw new ArgumentOutOfRangeException(nameof(type)); + } + + return new PluginMetadataViewModel(value, type); + } + + public static PluginMetadataViewModel ItemSeparator() + { + return new PluginMetadataViewModel(string.Empty, PluginMetadataType.ItemSeparator); + } + // Handle property changes public event PropertyChangedEventHandler PropertyChanged; @@ -35,11 +52,13 @@ private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } + // Type enum public enum PluginMetadataType { Version, Author, Link, + ItemSeparator, } } } diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index 9a5c04843130..68acaf21c2bf 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -180,13 +180,15 @@ public IEnumerable PluginMetadataItems { List metadataList = new() { - { new PluginMetadataViewModel(settings.Version, PluginMetadataViewModel.PluginMetadataType.Version) }, - { new PluginMetadataViewModel(settings.Author, PluginMetadataViewModel.PluginMetadataType.Author) }, + { PluginMetadataViewModel.MetadataItem(settings.Version, PluginMetadataViewModel.PluginMetadataType.Version) }, + { PluginMetadataViewModel.ItemSeparator() }, + { PluginMetadataViewModel.MetadataItem(settings.Author, PluginMetadataViewModel.PluginMetadataType.Author) }, }; if (Uri.IsWellFormedUriString(settings.Website, UriKind.Absolute)) { - metadataList.Add(new PluginMetadataViewModel(settings.Website, PluginMetadataViewModel.PluginMetadataType.Link)); + metadataList.Add(PluginMetadataViewModel.ItemSeparator()); + metadataList.Add(PluginMetadataViewModel.MetadataItem(settings.Website, PluginMetadataViewModel.PluginMetadataType.Link)); } return metadataList; From 65a72a8073a5338c600bdafe9485eb22c75d8c03 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sat, 28 Dec 2024 19:59:31 +0100 Subject: [PATCH 18/23] clean up usings --- .../Converters/RunPluginMetadataTemplateSelector.cs | 1 - .../Settings.UI/ViewModels/PluginMetadataViewModel.cs | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs b/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs index 492b204bdd90..7219efc78985 100644 --- a/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs +++ b/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs @@ -4,7 +4,6 @@ using System; -using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.ViewModels; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs index 831854fc5efb..348554d93b9d 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs @@ -5,8 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.IO; -using System.Linq; + using System.Runtime.CompilerServices; namespace Microsoft.PowerToys.Settings.UI.ViewModels From c1a2e8561090422004519104f6a8e137a14327ab Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sun, 29 Dec 2024 14:02:57 +0100 Subject: [PATCH 19/23] Accesibility improvement --- .../Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index 720d4697ccf4..59a083ebdc4c 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -331,6 +331,7 @@ From 75bc0f00328de35f68a73610cb3c06f489ff4f8b Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Sun, 29 Dec 2024 14:03:22 +0100 Subject: [PATCH 20/23] ViewModel code improvement --- .../PowerLauncherPluginViewModel.cs | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index 68acaf21c2bf..aa98af91eb0b 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -38,6 +38,8 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func settings.Id; } @@ -49,6 +51,8 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func _pluginMetadataList; + public bool Disabled { get @@ -168,31 +172,30 @@ public IEnumerable AdditionalOptions } } + public IEnumerable PluginMetadataItems => _pluginMetadataList; + /// - /// Gets the list of metadata properties like version, author, website. + /// Generates the list of metadata properties like version, author, website from the plugin settings. /// /// - /// The items order in the array defines the order in the ui. + /// The items order in the list defines the order in the ui. /// - public IEnumerable PluginMetadataItems + private static List GeneratePluginMetadataList(PowerLauncherPluginSettings pluginSettings) { - get - { - List metadataList = new() + List metadataList = new() { - { PluginMetadataViewModel.MetadataItem(settings.Version, PluginMetadataViewModel.PluginMetadataType.Version) }, + { PluginMetadataViewModel.MetadataItem(pluginSettings.Version, PluginMetadataViewModel.PluginMetadataType.Version) }, { PluginMetadataViewModel.ItemSeparator() }, - { PluginMetadataViewModel.MetadataItem(settings.Author, PluginMetadataViewModel.PluginMetadataType.Author) }, + { PluginMetadataViewModel.MetadataItem(pluginSettings.Author, PluginMetadataViewModel.PluginMetadataType.Author) }, }; - if (Uri.IsWellFormedUriString(settings.Website, UriKind.Absolute)) - { - metadataList.Add(PluginMetadataViewModel.ItemSeparator()); - metadataList.Add(PluginMetadataViewModel.MetadataItem(settings.Website, PluginMetadataViewModel.PluginMetadataType.Link)); - } - - return metadataList; + if (Uri.IsWellFormedUriString(pluginSettings.Website, UriKind.Absolute)) + { + metadataList.Add(PluginMetadataViewModel.ItemSeparator()); + metadataList.Add(PluginMetadataViewModel.MetadataItem(pluginSettings.Website, PluginMetadataViewModel.PluginMetadataType.Link)); } + + return metadataList; } public bool ShowAdditionalOptions From 804c3059699a903fb358a56cf12ccbd79a16e0f1 Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Mon, 30 Dec 2024 19:05:17 +0100 Subject: [PATCH 21/23] feedback --- .../RunPluginMetadataTemplateSelector.cs | 48 ---------- .../Controls/MetadataDotSeparator.xaml | 16 ---- .../Controls/MetadataDotSeparator.xaml.cs | 17 ---- .../SettingsXAML/Views/PowerLauncherPage.xaml | 93 ++++++++----------- .../ViewModels/PluginMetadataViewModel.cs | 63 ------------- .../PowerLauncherPluginViewModel.cs | 44 +++------ 6 files changed, 53 insertions(+), 228 deletions(-) delete mode 100644 src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs delete mode 100644 src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml delete mode 100644 src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml.cs delete mode 100644 src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs diff --git a/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs b/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs deleted file mode 100644 index 7219efc78985..000000000000 --- a/src/settings-ui/Settings.UI/Converters/RunPluginMetadataTemplateSelector.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -using Microsoft.PowerToys.Settings.UI.ViewModels; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; - -namespace Microsoft.PowerToys.Settings.UI.Converters -{ - public sealed partial class RunPluginMetadataTemplateSelector : DataTemplateSelector - { - public DataTemplate MetadataAuthorTemplate { get; set; } - - public DataTemplate MetadataVersionTemplate { get; set; } - - public DataTemplate MetadataWebsiteTemplate { get; set; } - - /// - /// Gets or sets a template for the separator between the items - /// - public DataTemplate MetadataSeparatorTemplate { get; set; } - - /// - /// Gets or sets an empty template used as fall back in case of malformed data - /// - public DataTemplate EmptyMetadataTemplate { get; set; } - - protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) - { - if (item is PluginMetadataViewModel optionViewModel) - { - return optionViewModel.Type switch - { - PluginMetadataViewModel.PluginMetadataType.Version => MetadataVersionTemplate, - PluginMetadataViewModel.PluginMetadataType.Author => MetadataAuthorTemplate, - PluginMetadataViewModel.PluginMetadataType.Link => MetadataWebsiteTemplate, - PluginMetadataViewModel.PluginMetadataType.ItemSeparator => MetadataSeparatorTemplate, - _ => EmptyMetadataTemplate, - }; - } - - throw new ArgumentException("Item must be an PluginAdditionalOptionViewModel", nameof(item)); - } - } -} diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml deleted file mode 100644 index a3d3eed8249c..000000000000 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml.cs deleted file mode 100644 index 82b06b564342..000000000000 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/MetadataDotSeparator.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; - -namespace Microsoft.PowerToys.Settings.UI.Controls -{ - public sealed partial class MetadataDotSeparator : UserControl - { - public MetadataDotSeparator() - { - this.InitializeComponent(); - } - } -} diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index 59a083ebdc4c..4a038b67bc88 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -21,11 +21,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -739,11 +689,44 @@ BorderThickness="0" ContentAlignment="Right" IsEnabled="{x:Bind Enabled, Mode=OneWay}"> - + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs deleted file mode 100644 index 348554d93b9d..000000000000 --- a/src/settings-ui/Settings.UI/ViewModels/PluginMetadataViewModel.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.ComponentModel; - -using System.Runtime.CompilerServices; - -namespace Microsoft.PowerToys.Settings.UI.ViewModels -{ - public class PluginMetadataViewModel : INotifyPropertyChanged - { - private PluginMetadataViewModel(string value, PluginMetadataType type) - { - _value = value; - _type = type; - } - - private string _value; - - public string Value => _value; - - private PluginMetadataType _type; - - public PluginMetadataType Type => _type; - - // Do not user for item separator initialization. - public static PluginMetadataViewModel MetadataItem(string value, PluginMetadataType type) - { - ArgumentNullException.ThrowIfNullOrWhiteSpace(value); - if (type == PluginMetadataType.ItemSeparator) - { - throw new ArgumentOutOfRangeException(nameof(type)); - } - - return new PluginMetadataViewModel(value, type); - } - - public static PluginMetadataViewModel ItemSeparator() - { - return new PluginMetadataViewModel(string.Empty, PluginMetadataType.ItemSeparator); - } - - // Handle property changes - public event PropertyChangedEventHandler PropertyChanged; - - private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - - // Type enum - public enum PluginMetadataType - { - Version, - Author, - Link, - ItemSeparator, - } - } -} diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index aa98af91eb0b..322690fee4e3 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -39,7 +39,8 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func settings.Id; } @@ -48,11 +49,22 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func settings.Description; } + public string Version { get; set; } + + public string Author { get; set; } + + // Fallback value for the website in case the uri from json is not well formatted + private const string WebsiteFallbackUri = "https://aka.ms/PowerToys"; + private string _websiteUri; + private bool _hasValidWebsiteUri; + + public string WebsiteUri => _websiteUri; + + public bool HasValidWebsiteUri => _hasValidWebsiteUri; + private GpoRuleConfigured _enabledGpoRuleConfiguration; private bool _enabledGpoRuleIsConfigured; - private List _pluginMetadataList; - public bool Disabled { get @@ -172,32 +184,6 @@ public IEnumerable AdditionalOptions } } - public IEnumerable PluginMetadataItems => _pluginMetadataList; - - /// - /// Generates the list of metadata properties like version, author, website from the plugin settings. - /// - /// - /// The items order in the list defines the order in the ui. - /// - private static List GeneratePluginMetadataList(PowerLauncherPluginSettings pluginSettings) - { - List metadataList = new() - { - { PluginMetadataViewModel.MetadataItem(pluginSettings.Version, PluginMetadataViewModel.PluginMetadataType.Version) }, - { PluginMetadataViewModel.ItemSeparator() }, - { PluginMetadataViewModel.MetadataItem(pluginSettings.Author, PluginMetadataViewModel.PluginMetadataType.Author) }, - }; - - if (Uri.IsWellFormedUriString(pluginSettings.Website, UriKind.Absolute)) - { - metadataList.Add(PluginMetadataViewModel.ItemSeparator()); - metadataList.Add(PluginMetadataViewModel.MetadataItem(pluginSettings.Website, PluginMetadataViewModel.PluginMetadataType.Link)); - } - - return metadataList; - } - public bool ShowAdditionalOptions { get => AdditionalOptions.Any(); From f1ca618424f4f8946df80bed6ca112f1eef799cc Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Mon, 30 Dec 2024 19:10:23 +0100 Subject: [PATCH 22/23] fixes --- src/settings-ui/Settings.UI/Strings/en-us/Resources.resw | 2 +- .../Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index 759219ea28ff..988e5ffa6d0c 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -4699,6 +4699,6 @@ Activate by holding the key for the character you want to add an accent to, then Version - Open website + Project website \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index 322690fee4e3..1543ce727d2b 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -49,9 +49,9 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func settings.Description; } - public string Version { get; set; } + public string Version { get => settings.Version; } - public string Author { get; set; } + public string Author { get => settings.Author; } // Fallback value for the website in case the uri from json is not well formatted private const string WebsiteFallbackUri = "https://aka.ms/PowerToys"; From 437563cea5c01879905746ef7242d0fbc07760cc Mon Sep 17 00:00:00 2001 From: htcfreek <61519853+htcfreek@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:46:12 +0100 Subject: [PATCH 23/23] update spacing --- .../Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml index 4a038b67bc88..ba0f55c6b620 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml @@ -692,7 +692,7 @@ + Spacing="4">