@@ -1198,21 +1198,31 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
11981198 _updateSource ? . Cancel ( ) ;
11991199
12001200 var query = await ConstructQueryAsync ( QueryText , Settings . CustomShortcuts , Settings . BuiltinShortcuts ) ;
1201+ var homeQuery = query == null ;
1202+ ICollection < PluginPair > plugins = Array . Empty < PluginPair > ( ) ;
12011203
12021204 if ( query == null ) // shortcut expanded
12031205 {
1204- // Hide and clear results again because running query may show and add some results
1205- Results . Visibility = Visibility . Collapsed ;
1206- Results . Clear ( ) ;
1206+ if ( Settings . ShowHomeQuery )
1207+ {
1208+ plugins = PluginManager . ValidPluginsForHomeQuery ( query ) ;
1209+ }
1210+
1211+ if ( plugins . Count == 0 )
1212+ {
1213+ // Hide and clear results again because running query may show and add some results
1214+ Results . Visibility = Visibility . Collapsed ;
1215+ Results . Clear ( ) ;
12071216
1208- // Reset plugin icon
1209- PluginIconPath = null ;
1210- PluginIconSource = null ;
1211- SearchIconVisibility = Visibility . Visible ;
1217+ // Reset plugin icon
1218+ PluginIconPath = null ;
1219+ PluginIconSource = null ;
1220+ SearchIconVisibility = Visibility . Visible ;
12121221
1213- // Hide progress bar again because running query may set this to visible
1214- ProgressBarVisibility = Visibility . Hidden ;
1215- return ;
1222+ // Hide progress bar again because running query may set this to visible
1223+ ProgressBarVisibility = Visibility . Hidden ;
1224+ return ;
1225+ }
12161226 }
12171227
12181228 _updateSource = new CancellationTokenSource ( ) ;
@@ -1226,27 +1236,37 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12261236 if ( _updateSource . Token . IsCancellationRequested ) return ;
12271237
12281238 // Update the query's IsReQuery property to true if this is a re-query
1229- query . IsReQuery = isReQuery ;
1239+ if ( ! homeQuery ) query . IsReQuery = isReQuery ;
12301240
12311241 // handle the exclusiveness of plugin using action keyword
12321242 RemoveOldQueryResults ( query ) ;
12331243
12341244 _lastQuery = query ;
12351245
1236- var plugins = PluginManager . ValidPluginsForQuery ( query ) ;
1237-
1238- if ( plugins . Count == 1 )
1239- {
1240- PluginIconPath = plugins . Single ( ) . Metadata . IcoPath ;
1241- PluginIconSource = await App . API . LoadImageAsync ( PluginIconPath ) ;
1242- SearchIconVisibility = Visibility . Hidden ;
1243- }
1244- else
1246+ if ( homeQuery )
12451247 {
1248+ // Do not show plugin icon if this is a home query
12461249 PluginIconPath = null ;
12471250 PluginIconSource = null ;
12481251 SearchIconVisibility = Visibility . Visible ;
12491252 }
1253+ else
1254+ {
1255+ plugins = PluginManager . ValidPluginsForQuery ( query ) ;
1256+
1257+ if ( plugins . Count == 1 )
1258+ {
1259+ PluginIconPath = plugins . Single ( ) . Metadata . IcoPath ;
1260+ PluginIconSource = await App . API . LoadImageAsync ( PluginIconPath ) ;
1261+ SearchIconVisibility = Visibility . Hidden ;
1262+ }
1263+ else
1264+ {
1265+ PluginIconPath = null ;
1266+ PluginIconSource = null ;
1267+ SearchIconVisibility = Visibility . Visible ;
1268+ }
1269+ }
12501270
12511271 // Do not wait for performance improvement
12521272 /*if (string.IsNullOrEmpty(query.ActionKeyword))
@@ -1303,7 +1323,7 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13031323 // Local function
13041324 async Task QueryTaskAsync ( PluginPair plugin , CancellationToken token )
13051325 {
1306- if ( searchDelay )
1326+ if ( searchDelay && ! homeQuery ) // Do not delay for home query
13071327 {
13081328 var searchDelayTime = plugin . Metadata . SearchDelayTime ?? Settings . SearchDelayTime ;
13091329
@@ -1316,7 +1336,9 @@ async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
13161336 // Task.Yield will force it to run in ThreadPool
13171337 await Task . Yield ( ) ;
13181338
1319- var results = await PluginManager . QueryForPluginAsync ( plugin , query , token ) ;
1339+ var results = homeQuery ?
1340+ await PluginManager . QueryHomeForPluginAsync ( plugin , token ) :
1341+ await PluginManager . QueryForPluginAsync ( plugin , query , token ) ;
13201342
13211343 if ( token . IsCancellationRequested ) return ;
13221344
@@ -1616,7 +1638,7 @@ public async void Hide()
16161638 break ;
16171639 case LastQueryMode . ActionKeywordPreserved :
16181640 case LastQueryMode . ActionKeywordSelected :
1619- var newQuery = _lastQuery . ActionKeyword ;
1641+ var newQuery = _lastQuery ? . ActionKeyword ;
16201642
16211643 if ( ! string . IsNullOrEmpty ( newQuery ) )
16221644 newQuery += " " ;
0 commit comments