mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-24 09:07:59 +08:00
e4e1b5b43d
* code changes * spell fix * dev docs * update tests * Code improvement
3.4 KiB
3.4 KiB
Program Plugin
The program plugin as the name suggests is used to search for programs installed on the system.
There are broadly two different categories of applications:
- Packaged applications
- Win32 applications
UWP
- The logic for indexing Packaged applications is present within the
UWP.cs
file. - There can be multiple applications present within a package. The
UWPApplication.cs
file encapsulates the properties of a packaged application. - To index packaged applications, the
PackageManager
retrieves 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
- Win32 programs in the following locations are indexed by PT Run-
- Desktop
- Public Desktop (Applications present on the desktop of all the users)
- Registry (Some programs)
- Start Menu
- Common start menu (Applications which are common to all users)
- 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:
- Lnk Shortcuts
- Appref files
- Internet shortcut - steam and epic games
- PWAs
- 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). - The localization is done using the
Localization Helper
fromWox.Plugin.Common
hosted at runtime in a variable of plugin's main class. - The
Run commands
differ in two points from the normalWin32Programs
:- The result title contains the executable type.
- The file types
.cpl
and.msc
are supported too.