mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-29 16:36:40 +01:00
Compare commits
3 Commits
jay/LightS
...
v0.51.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a4ff5e0a0 | ||
|
|
903b393884 | ||
|
|
010428e134 |
@@ -138,24 +138,24 @@ build:
|
||||
- 'modules\launcher\Microsoft.Launcher.dll'
|
||||
- 'modules\launcher\Plugins\Calculator\Microsoft.PowerToys.Run.Plugin.Calculator.dll'
|
||||
- 'modules\launcher\Plugins\Calculator\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Folder\Microsoft.Plugin.Folder.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Folder\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Indexer\Microsoft.Plugin.Indexer.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Indexer\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Program\Microsoft.Plugin.Program.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Program\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Registry\Microsoft.PowerToys.Run.Plugin.Registry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Registry\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\WindowsSettings.json'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Shell\Microsoft.Plugin.Shell.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Shell\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Uri\Microsoft.Plugin.Uri.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.Uri\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Microsoft.Plugin.WindowWalker.dll'
|
||||
- 'modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Community.UnitConverter\Community.PowerToys.Run.Plugin.UnitConverter.dll'
|
||||
- 'modules\launcher\Plugins\Folder\Microsoft.Plugin.Folder.dll'
|
||||
- 'modules\launcher\Plugins\Folder\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Indexer\Microsoft.Plugin.Indexer.dll'
|
||||
- 'modules\launcher\Plugins\Indexer\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Program\Microsoft.Plugin.Program.dll'
|
||||
- 'modules\launcher\Plugins\Program\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Registry\Microsoft.PowerToys.Run.Plugin.Registry.dll'
|
||||
- 'modules\launcher\Plugins\Registry\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\WindowsSettings\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\WindowsSettings\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll'
|
||||
- 'modules\launcher\Plugins\WindowsSettings\WindowsSettings.json'
|
||||
- 'modules\launcher\Plugins\Shell\Microsoft.Plugin.Shell.dll'
|
||||
- 'modules\launcher\Plugins\Shell\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\Uri\Microsoft.Plugin.Uri.dll'
|
||||
- 'modules\launcher\Plugins\Uri\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\WindowWalker\Microsoft.Plugin.WindowWalker.dll'
|
||||
- 'modules\launcher\Plugins\WindowWalker\ManagedTelemetry.dll'
|
||||
- 'modules\launcher\Plugins\UnitConverter\Community.PowerToys.Run.Plugin.UnitConverter.dll'
|
||||
- 'modules\launcher\Plugins\VSCodeWorkspaces\Community.PowerToys.Run.Plugin.VSCodeWorkspaces.dll'
|
||||
- 'modules\launcher\Plugins\Service\Microsoft.PowerToys.Run.Plugin.Service.dll'
|
||||
- 'modules\launcher\Plugins\System\Microsoft.PowerToys.Run.Plugin.System.dll'
|
||||
|
||||
@@ -12,31 +12,6 @@ namespace NonLocalizable
|
||||
const wchar_t RegKeyVirtualDesktopsFromSession[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%d\\VirtualDesktops";
|
||||
}
|
||||
|
||||
const CLSID CLSID_ImmersiveShell = { 0xC2F03A33, 0x21F5, 0x47FA, 0xB4, 0xBB, 0x15, 0x63, 0x62, 0xA2, 0xF2, 0x39 };
|
||||
|
||||
IServiceProvider* GetServiceProvider()
|
||||
{
|
||||
IServiceProvider* provider{ nullptr };
|
||||
if (FAILED(CoCreateInstance(CLSID_ImmersiveShell, nullptr, CLSCTX_LOCAL_SERVER, __uuidof(provider), (PVOID*)&provider)))
|
||||
{
|
||||
Logger::error("Failed to get ServiceProvider for VirtualDesktopManager");
|
||||
return nullptr;
|
||||
}
|
||||
return provider;
|
||||
}
|
||||
|
||||
IVirtualDesktopManager* GetVirtualDesktopManager()
|
||||
{
|
||||
IVirtualDesktopManager* manager{ nullptr };
|
||||
IServiceProvider* serviceProvider = GetServiceProvider();
|
||||
if (serviceProvider == nullptr || FAILED(serviceProvider->QueryService(__uuidof(manager), &manager)))
|
||||
{
|
||||
Logger::error("Failed to get VirtualDesktopManager");
|
||||
return nullptr;
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
std::optional<GUID> NewGetCurrentDesktopId()
|
||||
{
|
||||
wil::unique_hkey key{};
|
||||
@@ -99,9 +74,21 @@ HKEY GetVirtualDesktopsRegKey()
|
||||
|
||||
VirtualDesktop::VirtualDesktop(const std::function<void()>& vdInitCallback, const std::function<void()>& vdUpdatedCallback) :
|
||||
m_vdInitCallback(vdInitCallback),
|
||||
m_vdUpdatedCallback(vdUpdatedCallback),
|
||||
m_vdManager(GetVirtualDesktopManager())
|
||||
m_vdUpdatedCallback(vdUpdatedCallback)
|
||||
{
|
||||
auto res = CoCreateInstance(CLSID_VirtualDesktopManager, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&m_vdManager));
|
||||
if (FAILED(res))
|
||||
{
|
||||
Logger::error("Failed to create VirtualDesktopManager instance");
|
||||
}
|
||||
}
|
||||
|
||||
VirtualDesktop::~VirtualDesktop()
|
||||
{
|
||||
if (m_vdManager)
|
||||
{
|
||||
m_vdManager->Release();
|
||||
}
|
||||
}
|
||||
|
||||
void VirtualDesktop::Init()
|
||||
@@ -203,7 +190,7 @@ std::optional<GUID> VirtualDesktop::GetDesktopId(HWND window) const
|
||||
{
|
||||
GUID id;
|
||||
BOOL isWindowOnCurrentDesktop = false;
|
||||
if (m_vdManager->IsWindowOnCurrentVirtualDesktop(window, &isWindowOnCurrentDesktop) == S_OK && isWindowOnCurrentDesktop)
|
||||
if (m_vdManager && m_vdManager->IsWindowOnCurrentVirtualDesktop(window, &isWindowOnCurrentDesktop) == S_OK && isWindowOnCurrentDesktop)
|
||||
{
|
||||
// Filter windows such as Windows Start Menu, Task Switcher, etc.
|
||||
if (m_vdManager->GetWindowDesktopId(window, &id) == S_OK && id != GUID_NULL)
|
||||
|
||||
@@ -7,7 +7,7 @@ class VirtualDesktop
|
||||
{
|
||||
public:
|
||||
VirtualDesktop(const std::function<void()>& vdInitCallback, const std::function<void()>& vdUpdatedCallback);
|
||||
~VirtualDesktop() = default;
|
||||
~VirtualDesktop();
|
||||
|
||||
inline bool IsVirtualDesktopIdSavedInRegistry(GUID id) const
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
@@ -52,6 +53,24 @@ namespace PowerLauncher.Plugin
|
||||
{
|
||||
_allPlugins = PluginConfig.Parse(Directories)
|
||||
.Where(x => x.Language.ToUpperInvariant() == AllowedLanguage.CSharp)
|
||||
.GroupBy(x => x.ID) // Deduplicates plugins by ID, choosing for each ID the highest DLL product version. This fixes issues such as https://github.com/microsoft/PowerToys/issues/14701
|
||||
.Select(g => g.OrderByDescending(x => // , where an upgrade didn't remove older versions of the plugins.
|
||||
{
|
||||
try
|
||||
{
|
||||
// Return a comparable produce version.
|
||||
var fileVersion = FileVersionInfo.GetVersionInfo(x.ExecuteFilePath);
|
||||
return ((uint)fileVersion.ProductMajorPart << 48)
|
||||
| ((uint)fileVersion.ProductMinorPart << 32)
|
||||
| ((uint)fileVersion.ProductBuildPart << 16)
|
||||
| ((uint)fileVersion.ProductPrivatePart);
|
||||
}
|
||||
catch (System.IO.FileNotFoundException)
|
||||
{
|
||||
// We'll get an error when loading the DLL later on if there's not a decent version of this plugin.
|
||||
return 0U;
|
||||
}
|
||||
}).First())
|
||||
.Select(x => new PluginPair(x))
|
||||
.ToList();
|
||||
}
|
||||
@@ -168,7 +187,7 @@ namespace PowerLauncher.Plugin
|
||||
{
|
||||
List<Result> results = null;
|
||||
var metadata = pair.Metadata;
|
||||
var milliseconds = Stopwatch.Debug($"PluginManager.QueryForPlugin - Cost for {metadata.Name}", () =>
|
||||
var milliseconds = Wox.Infrastructure.Stopwatch.Debug($"PluginManager.QueryForPlugin - Cost for {metadata.Name}", () =>
|
||||
{
|
||||
if (delayedExecution && (pair.Plugin is IDelayedExecutionPlugin))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user