Dev Documentation of PowerToys Run (#7333)
* Architecture and (#7267) * Added debugging steps for PT Run * Updated architecture markdown for launcher * updated project architecture markdown for launcher * Added telemetry docs for launcher * Added the basic folder structure and files * Added a basic overview of all common functionalities of the plugins * Added information about the functioning of the calculator plugin * update score section of overview * added information about the uri plugin * added info about the indexer plugin * Added the documentation for the indexer plugin * Added information about the program plugin * Added info about the shell plugin * updated some plugin info and added information about the ww plugin * documenting the folder plugin * updated window walker docs * dev docs for the folder plugin * added images to each of the plugins * Added link to pt run documents * fix typos and some minor corrections * Add table of contents for pt run dev docs * Fix image path and project link for Wox.plugin Co-authored-by: Divyansh Srivastava <somm14divi@gmail.com>
48
doc/devdocs/modules/launcher/architecture.md
Normal file
@ -0,0 +1,48 @@
|
||||
# Architecture
|
||||
|
||||
## Overview
|
||||
`PowerToys Run` is a plugin-based .net core desktop application. It is written in WPF using `Model-View-ViewModel (MVVM)` structural design pattern. This article provides an overview of `PowerToys Run` architecture and introduces major components in the data flow.
|
||||
|
||||
Note : We refer to base application without plugins as `PowerLauncher`, which is same as the name of startup WPF project.
|
||||
|
||||
## UI
|
||||
PowerToys Run UI is written in the WPF framework. The UI code is present in the Powerlauncher project and is spanned across three high-level components: [`MainWindow.xaml`](/src/modules/launcher/PowerLauncher/MainWindow.xaml), [`LauncherControl.xaml`](/src/modules/launcher/PowerLauncher/LauncherControl.xaml) and [`ResultList.xaml`](/src/modules/launcher/PowerLauncher/LauncherControl.xaml). These components are discussed below.
|
||||
|
||||
![Image of PowerToys Run UI](/doc/images/launcher/pt_run_ui.png)
|
||||
**Fig 1: PowerToys Run UI architecture**
|
||||
|
||||
1. **[`MainWindow.xaml`](/src/modules/launcher/PowerLauncher/MainWindow.xaml)**: This is the outermost-level UI control. It is composed of lower-level UI components such as [`LauncherControl.xaml`](/src/modules/launcher/PowerLauncher/LauncherControl.xaml) and [`ResultList.xaml`](/src/modules/launcher/PowerLauncher/LauncherControl.xaml). The corresponding code-behind file implements all the UI related functionalities such as autosuggest, key-bindings, toggling visibility of WPF window and animations.
|
||||
2. **[`LauncherControl.xaml`](/src/modules/launcher/PowerLauncher/LauncherControl.xaml)**: This control implements the UI component for editing query text.(marked in red in Fig 1) It consists of two overlapping WPF controls, `TextBox` and `TextBlock`. The outer `TextBox` is used for editing query whereas the inner `TextBlock` is used to display autosuggest text.
|
||||
3. **[`ResultList.xaml`](/src/modules/launcher/PowerLauncher/LauncherControl.xaml)**: This control implements the UI component for displaying results (marked in green in Fig 1). It consists of a `ListView` WPF control with a custom `ItemTemplate` to display application logo, name, tooltip text, and context menu.
|
||||
|
||||
## Data flow
|
||||
The backend code is written using the `Model-View-ViewModel (MVVM)` structural design pattern. Plugins act as `Model` in this project. A detailed overview of the project's structure is given [here](/doc/devdocs/modules/launcher/project_structure.md).
|
||||
|
||||
#### Flow of data between UI(view) and ViewModels
|
||||
Data flow between View and ViewModel follows typical `MVVM` scheme. Properties in viewModels are bound to WPF controls and when these properties are updated, `INotifyPropertyChanged` handler is invoked, which in turn updates UI. The diagram below provides a rough sketch of the components involved.
|
||||
![Flow of data between UI(view) and ViewModels](/doc/images/launcher/ui_vm_interaction.PNG)
|
||||
**Fig 2: Flow of data between UI and ViewModels.**
|
||||
|
||||
#### Flow of data between ViewModels and Plugins(Model)
|
||||
`PowerLauncher` interact with plugins using [`IPlugin`](/src/modules/launcher/Wox.Plugin/IPlugin.cs) and `IDelayedExecutionPlugin` interface. [`IPlugin`](/src/modules/launcher/Wox.Plugin/IPlugin.cs) is used for initialization and making queries which are fast (typically return results in less than 100ms).[`IDelayedExecutionPlugin`](/src/modules/launcher/Wox.Plugin/IDelayedExecutionPlugin.cs) is used for long-running queries and is implemented only when required. For example, [`IDelayedExecutionPlugin`](/src/modules/launcher/Wox.Plugin/IDelayedExecutionPlugin.cs) is implemented by indexer plugin for searching files with names of form \*abc\*.
|
||||
```
|
||||
public interface IPlugin
|
||||
{
|
||||
// Query plugin
|
||||
List<Result> Query(Query query);
|
||||
|
||||
// Initialize plugin
|
||||
void Init(PluginInitContext context);
|
||||
}
|
||||
|
||||
public interface IDelayedExecutionPlugin : IFeatures
|
||||
{
|
||||
// Query plugin
|
||||
List<Result> Query(Query query, bool delayedExecution);
|
||||
}
|
||||
```
|
||||
![Flow of data between UI(view) and ViewModels](/doc/images/launcher/vm_plugin_interaction.PNG)
|
||||
**Fig 3: Flow of data between ViewModels and Plugins.**
|
||||
|
||||
#### Requesting services from powerlauncher
|
||||
Plugins could use the [`IPublicAPI`](/src/modules/launcher/Wox.Plugin/IPublicAPI.cs) interface to request services such as getting the current theme (for deciding logo background), displaying messages to the user, and toggling the visibility of PowerLauncher.
|
20
doc/devdocs/modules/launcher/debugging.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Debugging
|
||||
`PowerToys Run` is a single exe file associated with `launcher.exe` process and debugger should be attached to this process. There are two approaches to debug `PowerToys Run`. Both these approaches differ in the compile-time and the range of functionalities that could be debugged. These methods are discussed in detail in the following sections.
|
||||
|
||||
|
||||
## Debugging Prerequisite
|
||||
Setup development environment for PowerToys by following instruction [here.](https://github.com/microsoft/PowerToys/tree/master/doc/devdocs#prerequisites-for-compiling-powertoys)
|
||||
|
||||
## Direct debugging
|
||||
This approach is used to test UI, plugins, and core `PowerToys Run` functionality. This **cannot** be used to test `PowerToys Run` settings. The approach is significantly faster compared to `Debugging with runner`, as it requires compiling projects relevant to `PowerToys Run`. Please follow the steps below for direct debugging.
|
||||
1. Right-click on `modules->launcher->PowerLauncher` and select `Set as startup Project`.
|
||||
2. Press `F5` to start debugging.
|
||||
|
||||
## Debugging with runner
|
||||
This approach can be used to test UI, plugins, core `PowerToys Run` functionality and `PowerToys Run` settings. This approach **cannot** be used to debugg functions that execute on starting `launcher.exe` process. This requires building runner along with all the other modules on first compile, making it slower than `Direct debugging` approach. The subsequent compilations should be fast.
|
||||
1. Right-click on `runner` and select `Set as startup Project`.
|
||||
2. Press `F5` to start debugging.
|
||||
3. Attach debugger to `launcher.exe` process.
|
||||
1. Go to `Debug->Attach to process..`
|
||||
2. Filter and select `launcher.exe` process.
|
||||
3. Click on `Attach`.
|
23
doc/devdocs/modules/launcher/plugins/calculator.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Calculator Plugin
|
||||
The Calculator plugin as the name suggests is used to perform calculations on the user entered query.
|
||||
|
||||
![Image of Calculator plugin](/doc/images/launcher/plugins/calculator.png)
|
||||
|
||||
### [`CalculateHelper`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateHelper.cs)
|
||||
- The [`CalculateHelper.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateHelper.cs) class checks to see if the user entered query is a valid input to the calculator and only if the input is valid does it perform the operation.
|
||||
- It does so by matching the user query to a valid regex.
|
||||
|
||||
### [`CalculateEngine`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs)
|
||||
- The main computation is done in the [`CalculateEngine.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs) file using the `Mages` library.
|
||||
|
||||
```csharp
|
||||
var result = CalculateEngine.Interpret(query.Search, CultureInfo.CurrentUICulture);
|
||||
```
|
||||
|
||||
### [`CalculateResult`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateResult.cs)
|
||||
- The class which encapsulates the result of the computation.
|
||||
- It comprises of the `Result` and `RoundedResult` properties.
|
||||
|
||||
### Score
|
||||
The score of each result from the calculator plugin is `300`.
|
||||
|
17
doc/devdocs/modules/launcher/plugins/folder.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Folder Plugin
|
||||
The Folder plugin is used to navigate the directory structure and display the sub-folders and files within a folder.
|
||||
![Image of Folder plugin](/doc/images/launcher/plugins/folder.png)
|
||||
|
||||
### [`FolderHelper.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs)
|
||||
- The [`FolderHelper`](src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs) class leverages the `DriveInformation` and `folderLinks` to get the folder results for a user query.
|
||||
- The [`DriveInformation`](src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/DriveInformation.cs) class gets the list of all drives on the system.
|
||||
- The [`FolderLink`](src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/FolderLink.cs) object corresponds to a user created link for frequently accessed projects. This was inherited from Wox but is presently not functional as we don't have the UI setup in settings to get this user input. Each folderLink object has a `nickname`, which is the name of the folder and this can be used to directly access that folder instead of entering the entire path.
|
||||
|
||||
### [`IFolderProcessor.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/IFolderProcessor.cs)
|
||||
The `IFolderProcessor` utilizes the `FolderHelper` class to extract the folders and return the results.
|
||||
There are two types of Folder Processors, based on the type of information they are processing -
|
||||
1. [`UserFolderProcessor`](src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderProcessor.cs) - This Processor is currently not used in PT Run but it is used to process the user created folder links.
|
||||
2. [`InternalDirectoryProcessor`](src/modules/launcher/Plugins/Microsoft.Plugin.Folder/InternalDirectoryProcessor.cs) - This processor is used to retrieve the files and folders located within the current drive or shared folder.
|
||||
|
||||
### Score
|
||||
The first result is of score 500 and the following results are scored 10.
|
39
doc/devdocs/modules/launcher/plugins/indexer.md
Normal file
@ -0,0 +1,39 @@
|
||||
# Indexer Plugin
|
||||
The indexer plugin is used to search for files within the indexed locations of the system.
|
||||
|
||||
![Image of Indexer plugin](/doc/images/launcher/plugins/indexer.png)
|
||||
|
||||
### [Drive Detection](src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/DriveDetection)
|
||||
- There are two indexing modes in Windows:
|
||||
1. **Classic mode**: Only the desktop and certain customizable locations in the system are indexed. All the systems have the classic mode enabled by default.
|
||||
2. **Enhanced Mode**: This mode indexes the entire PC when enabled. The user can exclude certain locations from being indexed in this mode from the Windows Search settings options.
|
||||
- A drive detection warning is displayed to the users when only the custom mode is enabled on the system informing the user that not all the locations on their PC are indexed as this could lead to some results not showing up.
|
||||
- The [`IndexerDriveDetection.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/DriveDetection/IndexerDriveDetection.cs) file gets the status of the drive detection checkbox in the settings UI and depending on whether the enhanced mode is enabled or disabled, displays the warning.
|
||||
- To determine whether the `EnhancedMode` is enabled or not, we check the local machine registry entry for `EnableFindMyFiles`. If it is set to 1, the enhanced mode is enabled.
|
||||
|
||||
### [`OleDBSearch`](src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/OleDBSearch.cs)
|
||||
- The `Query` function within the [`OleDBSearch.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/OleDBSearch.cs) class takes in the query and the connection string to the SystemIndex catalog as arguments and returns a list of results.
|
||||
- It first opens a [connection][OLEDBConnection] to the Windows Indexer database, creates an [OleDB command][OLEDBCommand] and executes the command to get a list of results.
|
||||
|
||||
### [`WindowsSearchAPI`](src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs)
|
||||
- The [`WindowsSearchAPI`](src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs) class leverages the [`OleDBSearch.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/OleDBSearch.cs) class to execute the query.
|
||||
- It initializes the `QueryHelper` in the `InitQueryHelper()` function by creating a catalog manager to the SystemIndex catalog.
|
||||
- The metadata is initialized within the query helper, such as the number of results to retrive, the type of information to retrieve for each file (currently we retrieve the item URL, the file name and the file attributes).
|
||||
- The query helper matches results using the name of the file only and they are sorted by the last modified date, ensuring that the recently modified files are ranked higher.
|
||||
- The File attributes are utilized to filter out hidden files from being displayed.
|
||||
|
||||
### Additional Information
|
||||
- There are two major types of queries generated by the indexer plugin:
|
||||
1. Full Text predicates - eg: [CONTAINS][Contains]
|
||||
2. Non-Full Text predicates - eg: [LIKE][Like]
|
||||
- The Full text predicates are much faster than non-full text predicates as they are based on finding matches rather than comparing the query with each item in the indexer database. Hence, queries which have the `CONTAINS` keyword are much faster than those which contain the `LIKE` keyword.
|
||||
- To prevent the indexer query from taking a long time and blocking the UI thread, there are two types of indexer queries which are executed. A simplified query and a full query, without and with the `LIKE` keyword respectively.
|
||||
- The result list is updated with the results of the full query once they are obtained.
|
||||
|
||||
### Score
|
||||
Each of the indexer plugin results has a score set to 0 so they are present at the bottom of the list.
|
||||
|
||||
[OLEDBCommand]: https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb.oledbcommand?view=dotnet-plat-ext-3.1
|
||||
[OLEDBConnection]: https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb.oledbconnection?view=dotnet-plat-ext-3.1
|
||||
[Contains]: https://docs.microsoft.com/en-us/windows/win32/search/-search-sql-contains
|
||||
[Like]: https://docs.microsoft.com/en-us/windows/win32/search/-search-sql-like
|
35
doc/devdocs/modules/launcher/plugins/overview.md
Normal file
@ -0,0 +1,35 @@
|
||||
# Structural Overview
|
||||
The following basic functions are common to each of the plugins. They perform some rudimentary operations such as initialization of the plugin, executing the query that has been entered, loading context menu icons, updating settings when configurations are altered in the settings UI, and updating the theme of the icons when the theme changed event is triggered.
|
||||
|
||||
## IPlugin Interface
|
||||
Each plugin implements the `IPlugin` interface which comprises of the `Init()` and `Query()` functions.
|
||||
|
||||
### `Init`
|
||||
- The `Init()` function initializes the context, storage and settings of each plugin. This is equivalent to a contructor and is the first function to be called in the `Main.cs` file for each plugin.
|
||||
|
||||
### `Query`
|
||||
- For every query that the user enters into PT Run, the `PluginManager.cs` executes the `Query()` function in the `Main.cs` file corresponding to each Plugin.
|
||||
|
||||
### Context Menu Icons
|
||||
- The `ContextMenus` are loaded for each result based on the type of the result.
|
||||
- The various types of `ContextMenu` functionalities are:
|
||||
- Open containing folder
|
||||
- Run as Administrator
|
||||
- Open in console
|
||||
- Copy path
|
||||
|
||||
### UpdateSettings
|
||||
- This function updates the settings of each plugin based on the changes made by the user in the settings UI.
|
||||
- Eg: To disable drive detection in the indexer plugin, when the user checks or unchecks the drive detection check box, the `UpdateSettings()` function dispatches the changes in the check box to the plugin.
|
||||
|
||||
### ThemeChanged
|
||||
- This function is invoked when there is a change in the theme of PT Run.
|
||||
- It is used to update the `IconPath` for each plugin based on the theme.
|
||||
|
||||
### Save
|
||||
- This function saves the configurations of each plugin so that they can be loaded the next time.
|
||||
|
||||
### Score
|
||||
- The user query is executed against each of the plugins and the result list view is updated with results from each of the plugins.
|
||||
- The ordering of the results is based on the `Score` of each Result.
|
||||
- Each plugin assigns a score to a result based on it's relevance. The results with higher scores are displayed higher in the list view and vice versa.
|
43
doc/devdocs/modules/launcher/plugins/program.md
Normal file
@ -0,0 +1,43 @@
|
||||
# Program Plugin
|
||||
The program plugin as the name suggests is used to search for programs installed on the system.
|
||||
|
||||
![Image of Program plugin](/doc/images/launcher/plugins/program.png)
|
||||
|
||||
There are broadly two different categories of applications:
|
||||
|
||||
1. Packaged applications
|
||||
2. Win32 applications
|
||||
|
||||
### [UWP](src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs)
|
||||
- The logic for indexing Packaged applications is present within the [`UWP.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs) file.
|
||||
- There can be multiple applications present within a package. The [`UWPApplication.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs) file encapsulates the properties of a packaged application.
|
||||
- To index packaged applications, the `PackageManager` retrives all the packages for the current user and indexes all the applications.
|
||||
- To retrieve the app icon for packaged applications, the assets path is retrieved from the `Application Manifest` file. There are multiple icons corresponding to each scale, target size and theme. The best icon is chosen given the theme of powerToys Run.
|
||||
|
||||
### [Win32Program](src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs)
|
||||
- Win32 programs in the following locations are indexed by PT Run-
|
||||
1. Desktop
|
||||
2. Public Desktop (Applications present on the desktop of all the users)
|
||||
3. Registry (Some programs)
|
||||
4. Start Menu
|
||||
5. Common start menu (Applications which are common to all users)
|
||||
8. Locations pointed to by the PATH environment variable.
|
||||
- To prevent applications and shortcuts present in multiple locations from showing up as duplicate results, we consider apps with the same name, executable name and full path to be the same.
|
||||
- The subtitle of the application result is set based on it's application type. It could be one of the following:
|
||||
1. Lnk Shortcuts
|
||||
2. Appref files
|
||||
3. Internet shortcut - steam and epic games
|
||||
4. PWAs
|
||||
5. Run commands - these are indexed by the PATH environment variable
|
||||
|
||||
### Score
|
||||
- The score for each application result is based on the how many letters are matched, how close the matched letters are to the actual word and the index of the matched characters.
|
||||
- There is a threshold score to decide the apps which are to be displayed and applications which have a lower score are not displayed by PT Run.
|
||||
|
||||
### Update Program List in Runtime
|
||||
- Packaged and Win32 app helpers exist to reflect changes in the list of indexed apps when applications are installed on the system while PT Run is executing.
|
||||
- Packaged applications trigger events when the package is being installed and uninstalled. PT Run listens to those events to index applications which are newly installed or to delete an app which no longer exists from the database.
|
||||
- No such events exist for Win32 applications. We therefore use FileSystem Watchers to monitor the locations that we index for newly created, deleted or renamed application files and update the indexed Win32 catalog accordingly.
|
||||
|
||||
### Additional Notes
|
||||
- Arguments can be provided to the program plugin by entering them after `--` (a double dash).
|
14
doc/devdocs/modules/launcher/plugins/shell.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Shell Plugin
|
||||
- Shell plugin emulates the Windows Run Prompt (Win+R).
|
||||
- Shell Plugin is one of the non-global plugins which has an action keyword set to `>`.
|
||||
|
||||
![Image of Shell plugin](/doc/images/launcher/plugins/shell.png)
|
||||
|
||||
### Functionality
|
||||
- The Shell command expands environment variables, so `>%appdata%` works as expected.
|
||||
- On inheriting the Shell plugin from Wox, there are three different ways of executing a command, using the command prompt, powershell or the run prompt. To uphold the name of PT Run, the Shell plugin always executes commands as the Run prompt would.
|
||||
- The Shell plugin has a concept of history where the previously executed commands show up in the drop down list along with the number of times they have been executed.
|
||||
- The Run prompt has the folder plugin function where we can navigate to different locations and entering the path to a directory displays all the sub-directories. To prevent reimplementing this logic, the shell plugin references the folder plugin to implement this functionality.
|
||||
|
||||
### Score
|
||||
The Shell plugin results have a very high score of 5000. Hence, they are one of the first results in the list.
|
19
doc/devdocs/modules/launcher/plugins/uri.md
Normal file
@ -0,0 +1,19 @@
|
||||
# URI Plugin
|
||||
The URI Plugin, as the name suggests is used to dierctly run the URI that has been entered by the user as a query. This is done by parsing the entry and validating the URI, followed by executing it.
|
||||
|
||||
![Image of URI plugin](/doc/images/launcher/plugins/uri.png)
|
||||
|
||||
### [`URI Parser`](src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs)
|
||||
- The [`ExtendedUriParser.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs) file tries to parse the user input and returns a `System.Uri` result by using the `UriBuilder`.
|
||||
- It also captures other cases which the UriBuilder does not handle such as when the input ends with a `:`, `.` or `:/`.
|
||||
|
||||
### [`URI Resolver`](src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/UriResolver.cs)
|
||||
- The [`UriResolver.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/UriResolver.cs) file returns true for Valid hosts.
|
||||
- Currently there is no additional logic for filtering out invalid hosts and it always returns true for a valid Uri that was created by parsing the user query. It can be expanded in the future to filter out certain hosts.
|
||||
|
||||
### Default Browser Icon
|
||||
- The icon for each uri result is that of the default browser set by the user.
|
||||
- These details are obtained from the user registry and updated each time the theme of PT Run is changed.
|
||||
|
||||
### Score
|
||||
- All uri plugin results have a score of 0 which indicates that they would show up after each of the other plugins, other than the indexer plugin which also has a score of 0.
|
18
doc/devdocs/modules/launcher/plugins/windowwalker.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Window Walker plugin
|
||||
The window walker plugin matches the user entered query with the open windows on the system.
|
||||
|
||||
![Image of Window Walker plugin](/doc/images/launcher/plugins/windowwalker.png)
|
||||
|
||||
### [`OpenWindows.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs)
|
||||
- The window walker plugin uses the `EnumWindows` function to enumerate all the open windows in the [`OpenWindows.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/OpenWindows.cs) class.
|
||||
|
||||
|
||||
### [`SearchController.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs)
|
||||
- The [`SearchController`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs) encapsulates the functions needed to search and find matches.
|
||||
- It is responsible for updating the search text and performing a fuzzy search on all the open windows in an asynchronous manner.
|
||||
|
||||
### [`Window.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs)
|
||||
- The [`Window`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs) class represents a specific window and has functions to get the name of the process, the state of the window (whether it is visible or not), and the `SwitchTowindow` function which switches the desktop focus to the selected window. This action is performed when the user clicks on a window walker plugin result.
|
||||
|
||||
### Score
|
||||
The window walker plugin uses [`FuzzyMatching`](src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs) to get the matching indices and calculates the score by creating a 2 dimensional array of the window and the query text.
|
24
doc/devdocs/modules/launcher/project_structure.md
Normal file
@ -0,0 +1,24 @@
|
||||
# Project Structure
|
||||
## Overview
|
||||
`PowerToys Run` is divided across several projects to keep a logical separation between plugins and core functionality. The following sections provide a brief overview of each project.
|
||||
|
||||
![Image of project dependency](/doc/images/launcher/launcher_dependency.PNG)
|
||||
Fig 1. Project along with their dependencies in `PowerToys Run` ecosystem.
|
||||
|
||||
## Project Description
|
||||
#### [`PowerLauncher`](/src/modules/launcher/PowerLauncher)
|
||||
This is the startup project for the `PowerToys Run.` It is a WPF desktop application and follows the `Model-View-ViewModel (MVVM)` design pattern. Plugins play the role of `Model` and provide data to `ViewModel.`
|
||||
|
||||
#### [`PowerLauncher.Telemetry`](/src/modules/launcher/PowerLauncher.Telemetry)
|
||||
[`PowerLauncher.Telemetry`](/src/modules/launcher/PowerLauncher.Telemetry) is a .net core project that contains telemetry events generated by `PowerLauncher.` These events have been discussed in detail [here](/doc/devdocs/modules/launcher/telemetry.md).
|
||||
|
||||
#### [`Wox.Core`](/src/modules/launcher/Wox.Core)
|
||||
[`Wox.Core`](/src/modules/launcher/Wox.Core) is a .net core project that contains helper classes required by the `PowerLauncher` project. Two major functionalities encapsulated in this project are [`PluginManager`](/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs) and [`Query Builder.`](/src/modules/launcher/Wox.Core/Plugin/QueryBuilder.cs) [`PluginManager`](/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs) provides an interface for managing C# plugins. [`Query Builder.`](/src/modules/launcher/Wox.Core/Plugin/QueryBuilder.cs) decimate user-typed query string and creates a [`Query`](/src/modules/launcher/Wox.Plugin/Query.cs) object. [`Query`](/src/modules/launcher/Wox.Plugin/Query.cs) object contains the action keyword and cleaned query, which is then sent to all plugins.
|
||||
|
||||
#### [`Wox.Infrastructure`](/src/modules/launcher/Wox.Infrastructure)
|
||||
[`Wox.Infrastructure`](/src/modules/launcher/Wox.Infrastructure) is a .net core project that contains helper classes required for logging, image manipulation, and storage by the `PowerLauncher` project and the plugins. [`ImageLoader.cs`](/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs) class is used to load icons for `Win32` program. It also provides caching functionality to speed up image loading for frequently queried programs. [`Log.cs`](/src/modules/launcher/Wox.Infrastructure/Logger/Log.cs) provides an abstraction for logging error, information, and output to text files. These files are stored at `%userprofile%/appdata/local/microsoft/powertoys/powertoys run/Logs.`
|
||||
|
||||
#### [`Wox.Plugin`](/src/modules/launcher/Wox.Plugin)
|
||||
[`Wox.Plugin`](/src/modules/launcher/Wox.Plugin) contains interfaces that facilitate communication between `PowerLauncher` and plugins. These interfaces have been discussed in detail [here](/doc/devdocs/modules/launcher/architecture.md#flow-of-data-between-viewmodels-and-pluginsmodel).
|
||||
|
||||
|
14
doc/devdocs/modules/launcher/readme.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Table of Contents
|
||||
1. [Architecture](/doc/devdocs/modules/launcher/architecture.md)
|
||||
2. [Debugging](/doc/devdocs/modules/launcher/debugging.md)
|
||||
3. [Project Structure](/doc/devdocs/modules/launcher/project_structure.md)
|
||||
4. [Telemetry](/doc/devdocs/modules/launcher/telemetry.md)
|
||||
5. Plugins
|
||||
- [Overview](/doc/devdocs/modules/launcher/plugins/overview.md)
|
||||
- [Calculator](/doc/devdocs/modules/launcher/plugins/calculator.md)
|
||||
- [Folder](/doc/devdocs/modules/launcher/plugins/folder.md)
|
||||
- [Indexer](/doc/devdocs/modules/launcher/plugins/indexer.md)
|
||||
- [Program](/doc/devdocs/modules/launcher/plugins/program.md)
|
||||
- [Shell](/doc/devdocs/modules/launcher/plugins/shell.md)
|
||||
- [Uri](/doc/devdocs/modules/launcher/plugins/uri.md)
|
||||
- [Window Walker](/doc/devdocs/modules/launcher/plugins/windowwalker.md)
|
14
doc/devdocs/modules/launcher/telemetry.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Telemetry
|
||||
## Overview
|
||||
`PowerLauncher.Telemetry` project contains telemetry events generated by `PowerToys Run.` These event classes are derived from the [`EventBase`](/src/common/ManagedTelemetry/Telemetry/Events/EventBase.cs) class and [`IEvent`](/src/common/ManagedTelemetry/Telemetry/Events/IEvent.cs) class. [`IEvent`](/src/common/ManagedTelemetry/Telemetry/Events/IEvent.cs) class provides the lowest level abstraction, containing attributes such as privacy tags needed for every telemetry data. [`EventBase`](/src/common/ManagedTelemetry/Telemetry/Events/EventBase.cs) class provides a higher-level abstraction, having attributes common to all `PowerToys` telemetry events.
|
||||
|
||||
## Events
|
||||
The following events are generated by `PowerLauncher`:
|
||||
1. [`LauncherBootEvent`](/src/modules/launcher/PowerLauncher.Telemetry/Events/LauncherBootEvent.cs): This event captures the time taken by `PowerLauncher` to load all plugins, perform cold start, and setup UI environment.
|
||||
2. [`LauncherHideEvent`](/src/modules/launcher/PowerLauncher.Telemetry/Events/LauncherHideEvent.cs): This event is generated when the `PowerLauncher` window is hidden.
|
||||
3. [`LauncherColdStateHotkeyEvent`](/src/modules/launcher/PowerLauncher.Telemetry/Events/LauncherColdStateHotkeyEvent.cs): This event logs time from the first Alt+Space press till the `PowerLauncher` window is visible.
|
||||
4. [`LauncherFirstDeleteEvent`](/src/modules/launcher/PowerLauncher.Telemetry/Events/LauncherFirstDeleteEvent.cs): This event is generated after the first delete is pressed after `PowerLauncher` is visible.
|
||||
5. [`LauncherQueryEvent`](/src/modules/launcher/PowerLauncher.Telemetry/Events/LauncherQueryEvent.cs): This event is generated for every query that is typed in the searchbox. It logs query time, number of results, and query length.
|
||||
6. [`LauncherResultActionEvent`](/src/modules/launcher/PowerLauncher.Telemetry/Events/LauncherResultActionEvent.cs): This event is generated when a context menu action is triggered.
|
||||
7. [`LauncherShowEvent`](/src/modules/launcher/PowerLauncher.Telemetry/Events/LauncherShowEvent.cs): This event is generated when the `PowerLauncher` window is shown.
|
||||
8. [`LauncherWarmStateHotkeyEvent`](/src/modules/launcher/PowerLauncher.Telemetry/Events/LauncherWarmStateHotkeyEvent.cs): This event logs time from the Alt+Space press until the PT Run window is visible.
|
BIN
doc/images/launcher/launcher_dependency.PNG
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
doc/images/launcher/plugins/calculator.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
doc/images/launcher/plugins/folder.png
Normal file
After Width: | Height: | Size: 122 KiB |
BIN
doc/images/launcher/plugins/indexer.png
Normal file
After Width: | Height: | Size: 122 KiB |
BIN
doc/images/launcher/plugins/program.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
doc/images/launcher/plugins/shell.png
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
doc/images/launcher/plugins/uri.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
doc/images/launcher/plugins/windowwalker.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
doc/images/launcher/pt_run_ui.png
Normal file
After Width: | Height: | Size: 455 KiB |
BIN
doc/images/launcher/ui_vm_interaction.PNG
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
doc/images/launcher/vm_plugin_interaction.PNG
Normal file
After Width: | Height: | Size: 45 KiB |