[PT Run] VirtualDesktopHelper & WindowWalker improvements (#16325)

* Import vdh from poc

* last changes

* push changes

* small change

* add error handling to vdh

* last changes

* make spellchecker happy

* last changes

* last changes

* spell check

* fix settings defaults

* Improve WindowWalkerSettings class

* add comment

* New settings and improvements

* new features

* subtitle and tool tip

* spell fixes

* small fixes

* fixes

* Explorer info

* spell fixes

* fixes and CloseWindow feature

* last changes

* first part of implementing KillProcess

* killProcess Part 2 & Fixes

* text fix and installer

* update access modifiers

* some fixes

* update dev docs

* fix dev docs

* dev doc change

* dev docs: add missed infos

* dev docs: add link

* Update src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowWalkerSettings.cs

* fix build

* resolve feedback

* fix settings

* add tests
This commit is contained in:
Heiko
2022-03-07 12:45:29 +01:00
committed by GitHub
parent 27611593bd
commit e8363a3be1
33 changed files with 1764 additions and 103 deletions

View File

@@ -4,23 +4,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows.Controls;
using ManagedCommon;
using Microsoft.Plugin.WindowWalker.Components;
using Microsoft.PowerToys.Settings.UI.Library;
using Wox.Plugin;
using Wox.Plugin.Common.VirtualDesktop.Helper;
namespace Microsoft.Plugin.WindowWalker
{
public class Main : IPlugin, IPluginI18n
public class Main : IPlugin, IPluginI18n, ISettingProvider, IContextMenu
{
private string IconPath { get; set; }
private string InfoIconPath { get; set; }
private PluginInitContext Context { get; set; }
public string Name => Properties.Resources.wox_plugin_windowwalker_plugin_name;
private readonly string _assemblyName = Assembly.GetExecutingAssembly().GetName().Name;
public string Description => Properties.Resources.wox_plugin_windowwalker_plugin_description;
internal static readonly VirtualDesktopHelper VirtualDesktopHelperInstance = new VirtualDesktopHelper();
static Main()
{
OpenWindows.Instance.UpdateOpenWindowsList();
@@ -33,24 +42,17 @@ namespace Microsoft.Plugin.WindowWalker
throw new ArgumentNullException(nameof(query));
}
VirtualDesktopHelperInstance.UpdateDesktopList();
OpenWindows.Instance.UpdateOpenWindowsList();
SearchController.Instance.UpdateSearchText(query.Search);
List<SearchResult> searchControllerResults = SearchController.Instance.SearchMatches;
return searchControllerResults.Select(x => new Result()
{
Title = x.Result.Title,
IcoPath = IconPath,
SubTitle = Properties.Resources.wox_plugin_windowwalker_running + ": " + x.Result.ProcessInfo.Name,
Action = c =>
{
x.Result.SwitchToWindow();
return true;
},
return ResultHelper.GetResultList(searchControllerResults, !string.IsNullOrEmpty(query.ActionKeyword), IconPath, InfoIconPath);
}
// For debugging you can remove the comment sign in the next line.
// ToolTipData = new ToolTipData(x.Result.Title, $"hWnd: {x.Result.Hwnd}\nWindow class: {x.Result.ClassName}\nProcess ID: {x.Result.ProcessInfo.ProcessID}\nThread ID: {x.Result.ProcessInfo.ThreadID}\nProcess: {x.Result.ProcessInfo.Name}\nProcess exists: {x.Result.ProcessInfo.DoesExist}\nIs full access denied: {x.Result.ProcessInfo.IsFullAccessDenied}\nIs uwp app: {x.Result.ProcessInfo.IsUwpApp}\nIs ShellProcess: {x.Result.ProcessInfo.IsShellProcess}\nIs window cloaked: {x.Result.IsCloaked}\nWindow cloak state: {x.Result.GetWindowCloakState()}"),
}).ToList();
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
{
return ContextMenuHelper.GetContextMenuResults(selectedResult);
}
public void Init(PluginInitContext context)
@@ -60,16 +62,23 @@ namespace Microsoft.Plugin.WindowWalker
UpdateIconPath(Context.API.GetCurrentTheme());
}
public IEnumerable<PluginAdditionalOption> AdditionalOptions
{
get { return WindowWalkerSettings.GetAdditionalOptions(); }
}
// Todo : Update with theme based IconPath
private void UpdateIconPath(Theme theme)
{
if (theme == Theme.Light || theme == Theme.HighContrastWhite)
{
IconPath = "Images/windowwalker.light.png";
InfoIconPath = "Images/info.light.png";
}
else
{
IconPath = "Images/windowwalker.dark.png";
InfoIconPath = "Images/info.dark.png";
}
}
@@ -87,5 +96,15 @@ namespace Microsoft.Plugin.WindowWalker
{
return Properties.Resources.wox_plugin_windowwalker_plugin_description;
}
public Control CreateSettingPanel()
{
throw new NotImplementedException();
}
public void UpdateSettings(PowerLauncherPluginSettings settings)
{
WindowWalkerSettings.Instance.UpdateSettings(settings);
}
}
}