Skip to content
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

Can't use browser search (Plugin Web Search) #36083

Open
mudnug opened this issue Nov 25, 2024 · 12 comments
Open

Can't use browser search (Plugin Web Search) #36083

mudnug opened this issue Nov 25, 2024 · 12 comments
Labels
Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-PowerToys Run Improved app launch PT Run (Win+R) Window Run-Plugin Things that relate with PowerToys Run's plugin interface

Comments

@mudnug
Copy link

mudnug commented Nov 25, 2024

Description of the new feature / enhancement

Allow customizing how browser exe is called

Scenario when this would be used?

When search fails
Image

Image

Supporting information

Plugins based on the web search feature also fail: Daydreamer-riri/PowerToys-Run-WebSearchShortcut#29

@mudnug mudnug added the Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams label Nov 25, 2024
@davidegiacometti
Copy link
Collaborator

Hi @mudnug, any change to do some tests? Can you please open a PowerShell, run this and paste the output here?

$progId = $(Get-ItemProperty -Path Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice -Name ProgId).ProgId
$command = $(Get-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\$progId\shell\open\command).'(default)'
Write-Host $progId
Write-Host $command

Can you also try to run Start-Process "https://github.com" in a PowerShell window?
Is BrowseRouter launched?

This would help determine if there is something wrong with the code used to find the systems default browser.

/needinfo

@davidegiacometti davidegiacometti added Product-PowerToys Run Improved app launch PT Run (Win+R) Window Run-Plugin Things that relate with PowerToys Run's plugin interface labels Nov 27, 2024
@mudnug
Copy link
Author

mudnug commented Nov 27, 2024

BrowseRouterURL
Z:\BrowseRouter\BrowseRouter.exe %1

@mudnug
Copy link
Author

mudnug commented Nov 27, 2024

"Search the web" fails with the messagebox and "Open in default browser" works (for URLs).

@mudnug
Copy link
Author

mudnug commented Nov 29, 2024

@davidegiacometti Would PowerToys be confused when the path to the browser has a space or unicode character?

[2024-11-29 14:38:19.4918] [ERROR] [D:\a\_work\1\s\src\modules\launcher\Plugins\Community.PowerToys.Run.Plugin.WebSearch\Main.cs::182]
Failed to open BrowseRouter.

[2024-11-29 14:38:51.8898] [INFO] [D:\a\_work\1\s\src\modules\launcher\PowerLauncher\ViewModel\MainViewModel.cs::975]
OnHotkey

[2024-11-29 14:38:54.8007] [INFO] [D:\a\_work\1\s\src\modules\launcher\PowerLauncher\ViewModel\MainViewModel.cs::975]
OnHotkey

[2024-11-29 14:38:56.5528] [ERROR] [D:\a\_work\1\s\src\modules\launcher\Wox.Infrastructure\Helper.cs::192]
-------------------------- Begin exception --------------------------
Message: Unable to open M:\3: An error occurred trying to start process 'M:\3' with working directory 'C:\Users\[user]\AppData\Local\PowerToys'. The system cannot find the file specified.

Exception full name  : System.ComponentModel.Win32Exception
Exception message    : An error occurred trying to start process 'M:\3' with working directory 'C:\Users\[user]\AppData\Local\PowerToys'. The system cannot find the file specified.
Exception stack trace:
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at Wox.Infrastructure.Helper.OpenInShell(String path, String arguments, String workingDir, ShellRunAsType runAs, Boolean runWithHiddenWindow)
Exception source     : System.Diagnostics.Process
Exception target site: Boolean StartWithShellExecuteEx(System.Diagnostics.ProcessStartInfo)
Exception HResult    : -2147467259
-------------------------- End exception --------------------------


[2024-11-29 14:38:56.5528] [ERROR] [D:\a\_work\1\s\src\modules\launcher\Plugins\Community.PowerToys.Run.Plugin.WebSearch\Main.cs::182]
Failed to open BrowseRouter.

The error in the log shows it is truncating the process foldername and using the wrong directory
An error occurred trying to start process 'M:\3' with working directory 'C:\Users\[user]\AppData\Local\PowerToys'. The system cannot find the file specified.

@mudnug
Copy link
Author

mudnug commented Nov 29, 2024

By the way, Start-Process "https://github.com" has no trouble nor does choosing to launch a URL in the browser with PowerToys.
Image

@davidegiacometti
Copy link
Collaborator

Hi @mudnug
Isn't Z:\BrowseRouter\BrowseRouter.exe the path of the browser?
Where does M:\3 came from?

@mudnug
Copy link
Author

mudnug commented Dec 3, 2024

Good question. I modified the path when I showed you the powershell results to hide some path info. It is closer to Z:\3 BrowseRouter\BrowseRouter.exe %1

There is a space after 3

@davidegiacometti
Copy link
Collaborator

Yeah, the space can certainly be an issue. I think the string should be escaped by ", like "Z:\BrowseRouter\BrowseRouter.exe %1".
Have you manually set it as default browser or from the Windows settings?

@mudnug
Copy link
Author

mudnug commented Dec 3, 2024

I used the windows settings app
Image

@mudnug
Copy link
Author

mudnug commented Dec 3, 2024

I just tried manually editing the (default) registry key at
Computer\HKEY_CLASSES_ROOT\BrowseRouterURL\shell\open\command
to "Z:\BrowseRouter\BrowseRouter.exe %1"
and restarting PowerToys
but got the same error

and then "Z:\BrowseRouter\BrowseRouter.exe" %1
and restarting PowerToys
Which launches the browser without an error but doesn't include the entire set of terms (only the last one)

and then "Z:\BrowseRouter\BrowseRouter.exe" "%1"
Which focuses the browser but doesn't execute a search

@mudnug
Copy link
Author

mudnug commented Dec 10, 2024

Part of this was fixed in nref/BrowseRouter#63 (which now uses the correct registry value). Still can't execute searches, but that might not be a PowerToy issue? (I'm not sure how it's calling the browser to execute the search.)

@RaSan147
Copy link

Image
same for Opera GX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-PowerToys Run Improved app launch PT Run (Win+R) Window Run-Plugin Things that relate with PowerToys Run's plugin interface
Projects
None yet
Development

No branches or pull requests

3 participants