這是一個簡單的 PowerToys Run 插件,用於快速選擇特定搜尋引擎以透過關鍵字前綴執行搜尋。
如果您配置了
Keyword
字段,則可以使用短關鍵字來指定搜尋引擎。
x64
(更常見)或ARM64
%LOCALAPPDATA%MicrosoftPowerToysPowerToys RunPlugins
重要的
目前,一些用戶在停用 WebSearch(PowerToys Run 的整合插件)後使用 WebSearchShortcut 時遇到應用程式崩潰的情況。建議保持 WebSearch 啟用狀態,直到問題解決。 #23
注意:設定檔位於
%LOCALAPPDATA%MicrosoftPowerToysPowerToys RunSettingsPluginsCommunity.PowerToys.Run.Plugin.WebSearchShortcutWebSearchShortcutStorage.json
中。
在設定檔中,您可以新增所需的搜尋引擎。鍵是搜尋引擎的顯示名稱, Url
屬性是用來執行搜尋的 URL 範本。
儲存檔案後,使用!reload
重新載入外掛程式:
{
"Google" : {
"Url" : " https://www.google.com/search?q=%s " ,
"SuggestionProvider" : " Google "
},
"Bing" : {
"Url" : " https://www.bing.com/search?q=%s " ,
"SuggestionProvider" : " Bing "
},
"GitHub" : {
"Url" : " https://www.github.com/search?q=%s "
},
"GitHubStars" : {
"Url" : " https://github.com/stars?q=%s " ,
"Keyword" : " gs "
},
"StackOverflow" : {
"Url" : " https://stackoverflow.com/search?q=%s " ,
"Keyword" : " st "
},
"npm" : {
"Url" : " https://www.npmjs.com/search?q=%s "
},
"YouTube" : {
"Url" : " https://www.youtube.com/results?search_query=%s " ,
"Keyword" : " yt "
},
"ChatGPT" : {
"Url" : " https://chat.openai.com/?q=%s " ,
"Keyword" : " gpt "
}
}
Url
用於執行搜尋的 URL 範本。使用%s
作為搜尋查詢的佔位符。如果 URL 不包含%s
,則按 Enter 鍵將直接開啟該 URL。
{
"Google" : {
"Url" : " https://www.google.com/search?q=%s "
}
}
注意:要使用多個 URL,可以用空格 (" ") 分隔它們。例如:
{ "GoogleAndBing" : { "Url" : " https://www.google.com/search?q=%s https://www.bing.com/search?q=%s " } }或者,您可以將 URL 陣列與
Urls
欄位一起使用。
Urls
Urls
是Url
的別名,支援以陣列格式設定多個 URL。
{
"GoogleAndBing" : {
"Urls" : [ " https://www.google.com/search?q=%s " , " https://www.bing.com/search?q=%s " ]
}
}
Keyword
用於使用短關鍵字快速選擇目標搜尋引擎。
{
"Google" : {
"Url" : " https://www.google.com/search?q=%s " ,
"Keyword" : " g "
}
}
IconUrl
您可以透過設定此欄位來自訂圖示。一般情況下不需要設置,外掛程式會自動下載Url
欄位對應網站的favicon。但是,有時您可能想要自訂圖標,這個字段會派上用場。
注意:此欄位只能設定為網路 URL,不能設定為本機檔案。
IsDefault
如果該選項為true
,則對應的搜尋引擎不需要輸入觸發詞。
ReplaceWhitespace
使用ReplaceWhitespace
,您可以指定在執行搜尋時用哪些字元取代空格。這對於某些不使用加號(“+”)來分隔 URL 中的單字的網站(例如維基百科)很有用。
價值 | 結果 |
---|---|
" " 或者"" | Example+search |
"-" | Example-search |
"_" | Example_search |
"+" | Example%2Bsearch |
注意:當字串轉換為 URL 時,字串中的任何空格(或
ReplaceWhitespace
)都會替換為加號。 URL 中不允許的任何其他字元都將使用百分比編碼進行編碼。
SuggestionProvider
用於設定搜尋建議提供者。
目前支援的搜尋建議提供程序有:
Google
Bing
npm
CanIUse
歡迎 PR!
您也可以將 Provider 設定為另一個搜尋引擎。例如:
{ "StackOverflow" : { "Url" : " https://stackoverflow.com/search?q=%s " , "SuggestionProvider" : " Google " } }
這個項目只有在本文的指導下才能完成。感謝@hlaueriksson 的出色工作。
本專案的搜尋建議功能是基於FlowLauncher的相關實現,感謝@Flow-Launcher!
感謝@thatgaypigeon 編寫了出色的文檔!
麻省理工學院許可證 © 2023 Riri