@@ -12,7 +12,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
1212 public class Main : ISettingProvider , IPlugin , IReloadable , IPluginI18n , ISavable
1313 {
1414 private PluginInitContext context ;
15-
15+
1616 private List < Bookmark > cachedBookmarks = new List < Bookmark > ( ) ;
1717
1818 private readonly Settings _settings ;
@@ -37,36 +37,56 @@ public List<Result> Query(Query query)
3737
3838 // Should top results be returned? (true if no search parameters have been passed)
3939 var topResults = string . IsNullOrEmpty ( param ) ;
40-
41- var returnList = cachedBookmarks ;
40+
4241
4342 if ( ! topResults )
4443 {
4544 // Since we mixed chrome and firefox bookmarks, we should order them again
46- returnList = cachedBookmarks . Where ( o => Bookmarks . MatchProgram ( o , param ) ) . ToList ( ) ;
47- returnList = returnList . OrderByDescending ( o => o . Score ) . ToList ( ) ;
48- }
49-
50- return returnList . Select ( c => new Result ( )
51- {
52- Title = c . Name ,
53- SubTitle = c . Url ,
54- IcoPath = @"Images\bookmark.png" ,
55- Score = 5 ,
56- Action = ( e ) =>
45+ var returnList = cachedBookmarks . Select ( c => new Result ( )
5746 {
58- if ( _settings . OpenInNewBrowserWindow )
47+ Title = c . Name ,
48+ SubTitle = c . Url ,
49+ IcoPath = @"Images\bookmark.png" ,
50+ Score = Bookmarks . MatchProgram ( c , param ) . Score ,
51+ Action = _ =>
5952 {
60- c . Url . NewBrowserWindow ( _settings . BrowserPath ) ;
53+ if ( _settings . OpenInNewBrowserWindow )
54+ {
55+ c . Url . NewBrowserWindow ( _settings . BrowserPath ) ;
56+ }
57+ else
58+ {
59+ c . Url . NewTabInBrowser ( _settings . BrowserPath ) ;
60+ }
61+
62+ return true ;
6163 }
62- else
64+ } ) . Where ( r => r . Score > 0 ) ;
65+ return returnList . ToList ( ) ;
66+ }
67+ else
68+ {
69+ return cachedBookmarks . Select ( c => new Result ( )
70+ {
71+ Title = c . Name ,
72+ SubTitle = c . Url ,
73+ IcoPath = @"Images\bookmark.png" ,
74+ Score = 5 ,
75+ Action = _ =>
6376 {
64- c . Url . NewTabInBrowser ( _settings . BrowserPath ) ;
65- }
77+ if ( _settings . OpenInNewBrowserWindow )
78+ {
79+ c . Url . NewBrowserWindow ( _settings . BrowserPath ) ;
80+ }
81+ else
82+ {
83+ c . Url . NewTabInBrowser ( _settings . BrowserPath ) ;
84+ }
6685
67- return true ;
68- }
69- } ) . ToList ( ) ;
86+ return true ;
87+ }
88+ } ) . ToList ( ) ;
89+ }
7090 }
7191
7292 public void ReloadData ( )
0 commit comments