Skip to content

Commit a29ff07

Browse files
authored
[Settings][PTRun]Show plugin version and website (#36580)
1 parent cd2a887 commit a29ff07

File tree

25 files changed

+95
-25
lines changed

25 files changed

+95
-25
lines changed

doc/devdocs/modules/launcher/new-plugin-checklist.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"Author": string,
1717
"Version": "1.0.0", // For future compatibility
1818
"Language": "csharp", // So far we support only csharp
19-
"Website": "https://aka.ms/powertoys",
19+
"Website": "https://aka.ms/powertoys", // Has to be an absolute uri starting with "http://" or "https://".
2020
"ExecuteFileName": string, // Should be {Type}.PowerToys.Run.Plugin.{PluginName}.dll
2121
"IcoPathDark": string, // Path to dark theme icon. The path is relative to the root plugin folder
2222
"IcoPathLight": string // Path to light theme icon. The path is relative to the root plugin folder
@@ -42,3 +42,4 @@ In the PR that adds a new plugin, reference a new issue to track the work for fu
4242

4343
- [ ] Add the resource folder to https://github.com/microsoft/PowerToys/blob/21247c0bb09a1bee3d14d6efa53d0c247f7236af/installer/PowerToysSetup/Product.wxs#L825
4444
- [ ] Add the resource files under the section https://github.com/microsoft/PowerToys/blob/21247c0bb09a1bee3d14d6efa53d0c247f7236af/installer/PowerToysSetup/Product.wxs#L882
45+
- [ ] 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.)

src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.UnitConverter/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "ThiefZero",
77
"Version": "0.0.1",
88
"Language": "csharp",
9-
"Website": "https://github.com/ThiefZero",
9+
"Website": "https://aka.ms/PowerToys",
1010
"IcoPathDark": "Images\\unitconverter.dark.png",
1111
"IcoPathLight": "Images\\unitconverter.light.png",
1212
"ExecuteFileName": "Community.PowerToys.Run.Plugin.UnitConverter.dll"

src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.VSCodeWorkspaces/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "ricardosantos9521",
77
"Version": "1.2.0",
88
"Language": "csharp",
9-
"Website": "https://github.com/ricardosantos9521/PowerToys/",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll",
1111
"IsGlobal": false,
1212
"IcoPathDark": "Images\\code.dark.png",

src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Author": "IHorvalds",
88
"Version": "1.0.0",
99
"Language": "csharp",
10-
"Website": "https://github/com/IHorvalds",
10+
"Website": "https://aka.ms/PowerToys",
1111
"IcoPathDark": "Images\\ValueGenerator.dark.png",
1212
"IcoPathLight": "Images\\ValueGenerator.light.png",
1313
"ExecuteFileName": "Community.PowerToys.Run.Plugin.ValueGenerator.dll"

src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.WebSearch/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "cyberrex5",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Community.PowerToys.Run.Plugin.WebSearch.dll",
1111
"IcoPathDark": "Images\\WebSearch.dark.png",
1212
"IcoPathLight": "Images\\WebSearch.light.png"

src/modules/launcher/Plugins/Microsoft.Plugin.Folder/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "qianlifeng",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.Plugin.Folder.dll",
1111
"IcoPathDark": "Images\\folder.dark.png",
1212
"IcoPathLight": "Images\\folder.light.png"

src/modules/launcher/Plugins/Microsoft.Plugin.Shell/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "qianlifeng",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.Plugin.Shell.dll",
1111
"IcoPathDark": "Images\\shell.dark.png",
1212
"IcoPathLight": "Images\\shell.light.png"

src/modules/launcher/Plugins/Microsoft.Plugin.Uri/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "Microsoft",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "http://aka.ms/PowerToys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.Plugin.Uri.dll",
1111
"IcoPathDark": "Images\\uri.dark.png",
1212
"IcoPathLight": "Images\\uri.light.png"

src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "betadele",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://www.windowwalker.com/",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.Plugin.WindowWalker.dll",
1111
"IcoPathDark": "Images\\windowwalker.dark.png",
1212
"IcoPathLight": "Images\\windowwalker.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "cxfksword",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.Calculator.dll",
1111
"IcoPathDark": "Images\\calculator.dark.png",
1212
"IcoPathLight": "Images\\calculator.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.History/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "jefflord",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.History.dll",
1111
"IcoPathDark": "Images\\history.dark.png",
1212
"IcoPathLight": "Images\\history.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.OneNote/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Author": "palenshus",
88
"Version": "1.0.0",
99
"Language": "csharp",
10-
"Website": "https://aka.ms/powertoys",
10+
"Website": "https://aka.ms/PowerToys",
1111
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.OneNote.dll",
1212
"IcoPathDark": "Images\\oneNote.dark.png",
1313
"IcoPathLight": "Images\\oneNote.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.PowerToys/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "davidegiacometti",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.PowerToys.dll",
1111
"IcoPathDark": "Images\\PowerToys.dark.png",
1212
"IcoPathLight": "Images\\PowerToys.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Registry/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "TobiasSekan",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.Registry.dll",
1111
"IcoPathDark": "Images\\reg.dark.png",
1212
"IcoPathLight": "Images\\reg.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Service/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "davidegiacometti",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.Service.dll",
1111
"IcoPathDark": "Images\\service.dark.png",
1212
"IcoPathLight": "Images\\service.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "Wox",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.System.dll",
1111
"IcoPathDark": "Images\\lock.dark.png",
1212
"IcoPathLight": "Images\\lock.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "htcfreek",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.TimeDate.dll",
1111
"IcoPathDark": "Images\\timeDate.dark.png",
1212
"IcoPathLight": "Images\\timeDate.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Author": "TobiasSekan",
77
"Version": "1.0.0",
88
"Language": "csharp",
9-
"Website": "https://aka.ms/powertoys",
9+
"Website": "https://aka.ms/PowerToys",
1010
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll",
1111
"IcoPathDark": "Images\\WindowsSettings.dark.png",
1212
"IcoPathLight": "Images\\WindowsSettings.light.png"

src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsTerminal/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"Author": "davidegiacometti",
88
"Version": "1.0.0",
99
"Language": "csharp",
10-
"Website": "https://aka.ms/powertoys",
10+
"Website": "https://aka.ms/PowerToys",
1111
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.WindowsTerminal.dll",
1212
"IcoPathDark": "Images\\WindowsTerminal.dark.png",
1313
"IcoPathLight": "Images\\WindowsTerminal.light.png"

src/modules/launcher/PowerLauncher/SettingsReader.cs

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System;
66
using System.Collections.Generic;
7+
using System.Diagnostics;
78
using System.IO;
89
using System.IO.Abstractions;
910
using System.Linq;
@@ -251,7 +252,9 @@ private static IEnumerable<PowerLauncherPluginSettings> GetDefaultPluginsSetting
251252
Id = x.Metadata.ID,
252253
Name = x.Plugin == null ? x.Metadata.Name : x.Plugin.Name,
253254
Description = x.Plugin?.Description,
255+
Version = FileVersionInfo.GetVersionInfo(x.Metadata.ExecuteFilePath).FileVersion,
254256
Author = x.Metadata.Author,
257+
Website = x.Metadata.Website,
255258
Disabled = x.Metadata.Disabled,
256259
IsGlobal = x.Metadata.IsGlobal,
257260
ActionKeyword = x.Metadata.ActionKeyword,
@@ -281,7 +284,9 @@ private static void UpdateSettings(PowerLauncherSettings settings)
281284
var enabledPolicyState = GPOWrapper.GetRunPluginEnabledValue(id);
282285
plugin.Name = name;
283286
plugin.Description = value.Description;
287+
plugin.Version = value.Version;
284288
plugin.Author = value.Author;
289+
plugin.Website = value.Website;
285290
plugin.IconPathDark = value.IconPathDark;
286291
plugin.IconPathLight = value.IconPathLight;
287292
plugin.EnabledPolicyUiState = (int)enabledPolicyState;

src/settings-ui/Settings.UI.Library/PowerLauncherPluginSettings.cs

+4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ public class PowerLauncherPluginSettings
1414

1515
public string Description { get; set; }
1616

17+
public string Version { get; set; }
18+
1719
public string Author { get; set; }
1820

21+
public string Website { get; set; }
22+
1923
public bool Disabled { get; set; }
2024

2125
// Use to communicate the state to settings UI (Using int type because we can't reference GPOWrapper.)

src/settings-ui/Settings.UI/SettingsXAML/Styles/TextBlock.xaml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
2020
</Style>
2121

22+
<x:Double x:Key="SecondaryLinkFontSize">12</x:Double>
23+
<Style x:Key="SecondaryLinkTextStyle" TargetType="TextBlock">
24+
<Setter Property="FontSize" Value="{StaticResource SecondaryTextFontSize}" />
25+
</Style>
26+
2227
<x:Double x:Key="HeaderTextFontSize">12</x:Double>
2328
<Style x:Key="HeaderTextStyle" TargetType="TextBlock">
2429
<Setter Property="FontSize" Value="{StaticResource HeaderTextFontSize}" />

src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml

+40-5
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,46 @@
687687
<tkcontrols:SettingsCard
688688
MinHeight="0"
689689
BorderThickness="0"
690-
ContentAlignment="Right">
691-
<TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}">
692-
<Run x:Uid="PowerLauncher_AuthoredBy" />
693-
<Run FontWeight="SemiBold" Text="{x:Bind Author}" />
694-
</TextBlock>
690+
ContentAlignment="Right"
691+
IsEnabled="{x:Bind Enabled, Mode=OneWay}">
692+
<StackPanel
693+
HorizontalAlignment="Right"
694+
Orientation="Horizontal"
695+
Spacing="4">
696+
<TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}">
697+
<Run x:Uid="PowerLauncher_PluginVersion" />
698+
<Run FontWeight="SemiBold" Text="{x:Bind Version}" />
699+
</TextBlock>
700+
<TextBlock
701+
AutomationProperties.Name=","
702+
IsTabStop="False"
703+
Opacity="{x:Bind DisabledOpacity}"
704+
Style="{ThemeResource SecondaryTextStyle}"
705+
Text="|" />
706+
<TextBlock Opacity="{x:Bind DisabledOpacity}" Style="{ThemeResource SecondaryTextStyle}">
707+
<Run x:Uid="PowerLauncher_AuthoredBy" />
708+
<Run FontWeight="SemiBold" Text="{x:Bind Author}" />
709+
</TextBlock>
710+
<TextBlock
711+
AutomationProperties.Name=","
712+
IsTabStop="False"
713+
Opacity="{x:Bind DisabledOpacity}"
714+
Style="{ThemeResource SecondaryTextStyle}"
715+
Text="|"
716+
Visibility="{x:Bind HasValidWebsiteUri, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
717+
<HyperlinkButton
718+
Margin="0"
719+
Padding="0"
720+
NavigateUri="{x:Bind WebsiteUri}"
721+
Opacity="{x:Bind DisabledOpacity}"
722+
Style="{StaticResource TextButtonStyle}"
723+
Visibility="{x:Bind HasValidWebsiteUri, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
724+
<TextBlock
725+
x:Uid="PowerLauncher_PluginWebsite"
726+
FontWeight="SemiBold"
727+
Style="{ThemeResource SecondaryLinkTextStyle}" />
728+
</HyperlinkButton>
729+
</StackPanel>
695730
</tkcontrols:SettingsCard>
696731
</tkcontrols:SettingsExpander.Items>
697732
</tkcontrols:SettingsExpander>

src/settings-ui/Settings.UI/Strings/en-us/Resources.resw

+7-1
Original file line numberDiff line numberDiff line change
@@ -3969,7 +3969,7 @@ Activate by holding the key for the character you want to add an accent to, then
39693969
</data>
39703970
<data name="AdvancedPaste_EnableAdvancedAI.Description" xml:space="preserve">
39713971
<value>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.</value>
3972-
</data>
3972+
</data>
39733973
<data name="Oobe_AdvancedPaste.Description" xml:space="preserve">
39743974
<value>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.</value>
39753975
</data>
@@ -4698,4 +4698,10 @@ Activate by holding the key for the character you want to add an accent to, then
46984698
<data name="Enable_Module.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
46994699
<value>Enable module</value>
47004700
</data>
4701+
<data name="PowerLauncher_PluginVersion.Text" xml:space="preserve">
4702+
<value>Version</value>
4703+
</data>
4704+
<data name="PowerLauncher_PluginWebsite.Text" xml:space="preserve">
4705+
<value>Project website</value>
4706+
</data>
47014707
</root>

src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs

+14
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func<b
3838

3939
_enabledGpoRuleConfiguration = (GpoRuleConfigured)settings.EnabledPolicyUiState;
4040
_enabledGpoRuleIsConfigured = _enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
41+
42+
_hasValidWebsiteUri = Uri.IsWellFormedUriString(settings.Website, UriKind.Absolute);
43+
_websiteUri = _hasValidWebsiteUri ? settings.Website : WebsiteFallbackUri;
4144
}
4245

4346
public string Id { get => settings.Id; }
@@ -46,8 +49,19 @@ public PowerLauncherPluginViewModel(PowerLauncherPluginSettings settings, Func<b
4649

4750
public string Description { get => settings.Description; }
4851

52+
public string Version { get => settings.Version; }
53+
4954
public string Author { get => settings.Author; }
5055

56+
// Fallback value for the website in case the uri from json is not well formatted
57+
private const string WebsiteFallbackUri = "https://aka.ms/PowerToys";
58+
private string _websiteUri;
59+
private bool _hasValidWebsiteUri;
60+
61+
public string WebsiteUri => _websiteUri;
62+
63+
public bool HasValidWebsiteUri => _hasValidWebsiteUri;
64+
5165
private GpoRuleConfigured _enabledGpoRuleConfiguration;
5266
private bool _enabledGpoRuleIsConfigured;
5367

0 commit comments

Comments
 (0)