@@ -18,6 +18,7 @@ use pop_launcher::{
18
18
Request ,
19
19
} ;
20
20
use std:: borrow:: Cow ;
21
+ use std:: iter;
21
22
use tokio:: io:: { AsyncWrite , AsyncWriteExt } ;
22
23
23
24
use self :: toplevel_handler:: { toplevel_handler, ToplevelAction , ToplevelEvent } ;
@@ -169,20 +170,23 @@ impl<W: AsyncWrite + Unpin> App<W> {
169
170
fde:: matching:: MatchAppIdOptions :: default ( ) ,
170
171
)
171
172
} else {
173
+ let lowercase_title = info. title . to_lowercase ( ) ;
174
+ let window_words = lowercase_title
175
+ . split_whitespace ( )
176
+ . chain ( iter:: once ( info. app_id . as_str ( ) ) )
177
+ . chain ( iter:: once ( info. title . as_str ( ) ) )
178
+ . collect :: < Vec < _ > > ( ) ;
179
+
172
180
fde:: matching:: get_best_match (
173
- & [ & info . app_id , & info . title ] ,
181
+ & window_words ,
174
182
& self . desktop_entries ,
175
183
fde:: matching:: MatchAppIdOptions :: default ( ) ,
176
184
)
177
185
. and_then ( |de| {
178
- let score = fde:: matching:: get_entry_score (
179
- & query,
180
- de,
181
- & self . locales ,
182
- & [ & info. app_id , & info. title ] ,
183
- ) ;
184
-
185
- if score > 0.6 {
186
+ let score =
187
+ fde:: matching:: get_entry_score ( & query, de, & self . locales , & window_words) ;
188
+
189
+ if score > 0.8 {
186
190
Some ( de)
187
191
} else {
188
192
None
@@ -201,7 +205,6 @@ impl<W: AsyncWrite + Unpin> App<W> {
201
205
// XXX protocol id may be re-used later
202
206
id : handle. id ( ) . protocol_id ( ) ,
203
207
window : Some ( ( 0 , handle. id ( ) . clone ( ) . protocol_id ( ) ) ) ,
204
- // XXX: why this is inversed for this plugin ????
205
208
description : info. title . clone ( ) ,
206
209
name : get_description ( de, & self . locales ) ,
207
210
icon : Some ( IconSource :: Name ( icon_name) ) ,
0 commit comments