@@ -11,6 +11,7 @@ pub struct Config {
11
11
max_entries : usize ,
12
12
terminal : Option < Terminal > ,
13
13
preprocess_exec_script : Option < PathBuf > ,
14
+ entry_priority : Option < EntryPriority > ,
14
15
}
15
16
16
17
#[ derive( Deserialize ) ]
@@ -19,13 +20,21 @@ pub struct Terminal {
19
20
args : String ,
20
21
}
21
22
23
+ #[ derive( Deserialize ) ]
24
+ pub enum EntryPriority {
25
+ ActionsFirst ,
26
+ ApplicationsFirst ,
27
+ NoPriority ,
28
+ }
29
+
22
30
impl Default for Config {
23
31
fn default ( ) -> Self {
24
32
Self {
25
33
desktop_actions : false ,
26
34
max_entries : 5 ,
27
35
preprocess_exec_script : None ,
28
36
terminal : None ,
37
+ entry_priority : None ,
29
38
}
30
39
}
31
40
}
@@ -177,6 +186,12 @@ pub fn init(config_dir: RString) -> State {
177
186
#[ get_matches]
178
187
pub fn get_matches ( input : RString , state : & State ) -> RVec < Match > {
179
188
let matcher = fuzzy_matcher:: skim:: SkimMatcherV2 :: default ( ) . ignore_case ( ) ;
189
+ let entry_priority = state
190
+ . config
191
+ . entry_priority
192
+ . as_ref ( )
193
+ . unwrap_or ( & EntryPriority :: ActionsFirst ) ;
194
+
180
195
let mut entries = state
181
196
. entries
182
197
. iter ( )
@@ -200,10 +215,12 @@ pub fn get_matches(input: RString, state: &State) -> RVec<Match> {
200
215
201
216
let mut score = ( name_score * 10 + desc_score + keyword_score) - entry. offset ;
202
217
203
- // prioritize actions
204
- if entry. is_action {
205
- score *= 2 ;
206
- }
218
+ // Apply priority
219
+ score *= match ( entry_priority, entry. is_action ) {
220
+ ( EntryPriority :: ActionsFirst , true ) => 2 ,
221
+ ( EntryPriority :: ApplicationsFirst , false ) => 2 ,
222
+ _ => 1 ,
223
+ } ;
207
224
208
225
// Score cutoff
209
226
if score > 0 {
0 commit comments