Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Settings > PT Run] Plugin manager: Add plugins version and website #36580

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
3 changes: 2 additions & 1 deletion doc/devdocs/modules/launcher/new-plugin-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"Author": string,
"Version": "1.0.0", // For future compatibility
"Language": "csharp", // So far we support only csharp
"Website": "https://aka.ms/powertoys",
"Website": "https://aka.ms/powertoys", // Has to be an absolute uri starting with "http://" or "https://".
"ExecuteFileName": string, // Should be {Type}.PowerToys.Run.Plugin.{PluginName}.dll
"IcoPathDark": string, // Path to dark theme icon. The path is relative to the root plugin folder
"IcoPathLight": string // Path to light theme icon. The path is relative to the root plugin folder
Expand All @@ -42,3 +42,4 @@ In the PR that adds a new plugin, reference a new issue to track the work for fu

- [ ] Add the resource folder to https://github.com/microsoft/PowerToys/blob/21247c0bb09a1bee3d14d6efa53d0c247f7236af/installer/PowerToysSetup/Product.wxs#L825
- [ ] Add the resource files under the section https://github.com/microsoft/PowerToys/blob/21247c0bb09a1bee3d14d6efa53d0c247f7236af/installer/PowerToysSetup/Product.wxs#L882
- [ ] Your plugin's executable file (DLL) has to have correct version informations after building it. (This version information will be shown on the settings page.)
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions src/modules/launcher/PowerLauncher/SettingsReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Abstractions;
using System.Linq;
Expand Down Expand Up @@ -251,7 +252,9 @@ private static IEnumerable<PowerLauncherPluginSettings> 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).FileVersion,
Author = x.Metadata.Author,
Website = x.Metadata.Website,
Disabled = x.Metadata.Disabled,
IsGlobal = x.Metadata.IsGlobal,
ActionKeyword = x.Metadata.ActionKeyword,
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// 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; }

/// <summary>
/// Gets or sets a template for the separator between the items
/// </summary>
public DataTemplate MetadataSeparatorTemplate { get; set; }

/// <summary>
/// Gets or sets an empty template used as fall back in case of malformed data
/// </summary>
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));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<UserControl
x:Class="Microsoft.PowerToys.Settings.UI.Controls.MetadataDotSeparator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">

<TextBlock
AutomationProperties.Name=","
IsTabStop="False"
Style="{ThemeResource SecondaryTextStyle}"
Text="&#x2022;" />
</UserControl>
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
</Style>

<x:Double x:Key="SecondaryLinkFontSize">12</x:Double>
<Style x:Key="SecondaryLinkTextStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource SecondaryTextFontSize}" />
</Style>

<x:Double x:Key="HeaderTextFontSize">12</x:Double>
<Style x:Key="HeaderTextStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="{StaticResource HeaderTextFontSize}" />
Expand Down
Loading
Loading