-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Run] Allow executables to be picked up from custom program sources #30328
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
8882613
to
0f902d9
Compare
@albertony Is it correct that there won't be any user interface to change the settings? |
Issue created:
Correct. Same as the other mentioned PR, which fixed that anything from ProgramSources are picked up at all. |
Pretty interesting... I think this actually will fix some interesting bugs too. |
At this moment, this is creating many duplicated entries for me, indeed. Wondering if we need to nuke existing Program extension from ProgramPluginSettings.json on the next version, since even if we do code changes, that's "default settings" and won't be visible. |
You mean your json still contains the previous default value of
Not sure exactly what you meant by this? I actually have never paid much attention to the distinction between run commands and programs when using the tool myself, and I don't really understand what the intention behind the separation is. I think in existing version run commands in reality are always executables found from PATH, right? Issue #30486 wants an easy way to exclude executables from results, that could be to set |
The settings clearing is something we're aiming to fix with #30187
I need to check the distinction too. But from what I saw the Applications in registry are almost all .exe . 🤔 Thinking this needs some more thought before we make big changes here. |
I see what you mean. I was kind of hoping this was a small enough fix that it could be taken as is, while considering more in depth changes. But that's your call, of course. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs:1011
- Add a null check for the 'program' object to prevent a potential NullReferenceException.
program.AppType = ApplicationType.RunCommand;
Summary of the Pull Request
Make it possible to configure that executables such as
bat
,cmd
andexe
should be picked up from customProgramSources
in%LocalAppData%\Microsoft\PowerToys\PowerToys Run\Settings\Plugins\Microsoft.Plugin.Program\ProgramPluginSettings.json
.PR Checklist
Detailed Description of the Pull Request / Additional comments
This is still just small improvements of a hidden feature, extending #19632. I, and I think many others judging from feature requests etc, see a lot of potential in PT Run as the launcher tool if it gets a few important improvements. But for me personally, I think this small change is enough for me to be able to stick with it as is until someone takes the time to do some bigger improvements (like exposing these customizations to UI).
In the existing implementation, the fact that
bat
andexe
are included in the default value ofProgramPluginSettings.ProgramSuffixes
has no effect, as these extensions are later excluded by hardcodedWin32Program.ExecutableApplicationExtensions
list. I don't see a reason why they should be included in the source search, only to exclude them later in the Linq expression? But also, this means regular executables with extensions such as.exe
and.bat
etc. will never be picked up from the Desktop and any customizedProgramPluginSettings.ProgramSources
, so one typically need to create shortcuts for every program to be picked up. E.g. adding a directory containing the SysInternals suite to ProgramSources, and for PowerToys Run to pick up all tools would be very convenient (without having to litter my PATH with all different such "tool" locations).With this PR I suggest:
Win32Program.ExecutableApplicationExtensions
for excluding results from program paths.ProgramPluginSettings.ProgramSuffixes
completely decides what should be picked up, and classified asApplication
in the UI.exe
andbat
now starting to be picked up for all/default sources, then remove these from the defaultProgramPluginSettings.ProgramSuffixes
list.cmd
in addition tobat
inProgramPluginSettings.RunCommandSuffixes
, since it is the "modern"cmd.exe
specific extension I find supportingbat
but notcmd
a bit too limiting.Some other alternatives / more improvements could be:
ProgramPluginSettings.RunCommandSuffixes
in all sources, not justPATH
.ProgramPluginSettings.RunCommandSources
to differentiate which locations should be searched forRunCommand
from those forProgram
.PATHEXT
(.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
) inProgramPluginSettings.RunCommandSuffixes
.Validation Steps Performed