From 6931c8d86cfe4b6b2ab40103047db1cc6bcd6a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Mon, 24 May 2021 10:21:39 +0800 Subject: [PATCH 001/194] add cache for program plugin --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 48 ++++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index 5175970fd..b58422d2c 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -26,10 +27,12 @@ namespace Flow.Launcher.Plugin.Program private static BinaryStorage _win32Storage; private static BinaryStorage _uwpStorage; - public Main() - { - - } + private static readonly ConcurrentDictionary> cache = new(); + + private static readonly List emptyResults = new(); + + private int reg_count; + private int query_count; public void Save() { @@ -42,23 +45,27 @@ namespace Flow.Launcher.Plugin.Program if (IsStartupIndexProgramsRequired) _ = IndexPrograms(); - Win32[] win32; - UWP.Application[] uwps; + query_count++; - win32 = _win32s; - uwps = _uwps; - - var result = await Task.Run(delegate + if (!cache.TryGetValue(query.Search, out var result)) { - return win32.Cast() - .Concat(uwps) - .AsParallel() - .WithCancellation(token) - .Where(p => p.Enabled) - .Select(p => p.Result(query.Search, _context.API)) - .Where(r => r?.Score > 0) - .ToList(); - }, token).ConfigureAwait(false); + result = await Task.Run(delegate + { + return _win32s.Cast() + .Concat(_uwps) + .AsParallel() + .WithCancellation(token) + .Where(p => p.Enabled) + .Select(p => p.Result(query.Search, _context.API)) + .Where(r => r?.Score > 0) + .ToList(); + }, token).ConfigureAwait(false); + + if (result.Count == 0) + result = emptyResults; + + cache[query.Search] = result; + } token.ThrowIfCancellationRequested(); @@ -110,7 +117,7 @@ namespace Flow.Launcher.Plugin.Program if (indexedWinApps && indexedUWPApps) _settings.LastIndexTime = DateTime.Today; }); - + if (!(_win32s.Any() && _uwps.Any())) await indexTask; } @@ -134,6 +141,7 @@ namespace Flow.Launcher.Plugin.Program var t1 = Task.Run(IndexWin32Programs); var t2 = Task.Run(IndexUwpPrograms); await Task.WhenAll(t1, t2).ConfigureAwait(false); + cache.Clear(); _settings.LastIndexTime = DateTime.Today; } From 9b1180fc892914e62fb0f849c1f75fd8d2b7b2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Mon, 24 May 2021 11:14:20 +0800 Subject: [PATCH 002/194] remove testing code --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index b58422d2c..c954cab8e 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -31,8 +31,6 @@ namespace Flow.Launcher.Plugin.Program private static readonly List emptyResults = new(); - private int reg_count; - private int query_count; public void Save() { @@ -45,7 +43,6 @@ namespace Flow.Launcher.Plugin.Program if (IsStartupIndexProgramsRequired) _ = IndexPrograms(); - query_count++; if (!cache.TryGetValue(query.Search, out var result)) { From 8eecbfbed3fdba7fd531ff159fda392bb87b8cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Thu, 27 May 2021 19:28:17 +0800 Subject: [PATCH 003/194] Use MemoryCache to control size --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 55 ++++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index c954cab8e..b7fe1373f 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Collections.Specialized; using System.Diagnostics; using System.Linq; using System.Threading; @@ -10,6 +11,9 @@ using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Plugin.Program.Programs; using Flow.Launcher.Plugin.Program.Views; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Primitives; using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch; namespace Flow.Launcher.Plugin.Program @@ -27,10 +31,17 @@ namespace Flow.Launcher.Plugin.Program private static BinaryStorage _win32Storage; private static BinaryStorage _uwpStorage; - private static readonly ConcurrentDictionary> cache = new(); - private static readonly List emptyResults = new(); + private static readonly MemoryCacheOptions cacheOptions = new() + { + SizeLimit = 1560 + }; + private static MemoryCache cache = new(cacheOptions); + + static Main() + { + } public void Save() { @@ -40,31 +51,29 @@ namespace Flow.Launcher.Plugin.Program public async Task> QueryAsync(Query query, CancellationToken token) { + if (IsStartupIndexProgramsRequired) _ = IndexPrograms(); + var result = await cache.GetOrCreateAsync(query.Search, async entry => + { + var resultList = await Task.Run(() => + _win32s.Cast() + .Concat(_uwps) + .AsParallel() + .WithCancellation(token) + .Where(p => p.Enabled) + .Select(p => p.Result(query.Search, _context.API)) + .Where(r => r?.Score > 0) + .ToList()); - if (!cache.TryGetValue(query.Search, out var result)) - { - result = await Task.Run(delegate - { - return _win32s.Cast() - .Concat(_uwps) - .AsParallel() - .WithCancellation(token) - .Where(p => p.Enabled) - .Select(p => p.Result(query.Search, _context.API)) - .Where(r => r?.Score > 0) - .ToList(); - }, token).ConfigureAwait(false); + resultList = resultList.Any() ? resultList : emptyResults; - if (result.Count == 0) - result = emptyResults; + entry.SetSize(resultList.Count); + entry.SetSlidingExpiration(TimeSpan.FromHours(8)); - cache[query.Search] = result; - } - - token.ThrowIfCancellationRequested(); + return resultList; + }); return result; } @@ -138,7 +147,9 @@ namespace Flow.Launcher.Plugin.Program var t1 = Task.Run(IndexWin32Programs); var t2 = Task.Run(IndexUwpPrograms); await Task.WhenAll(t1, t2).ConfigureAwait(false); - cache.Clear(); + var oldCache = cache; + cache = new MemoryCache(cacheOptions); + oldCache.Dispose(); _settings.LastIndexTime = DateTime.Today; } From 6978b65d8eb99aca0f13669ed979f267936d65a3 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Fri, 30 Jul 2021 20:44:29 +1000 Subject: [PATCH 004/194] add Quick Access action keyword --- .../UserSettings/PluginSettings.cs | 23 ++++++++--- .../Languages/en.xaml | 2 + .../Search/SearchManager.cs | 38 +++++++++++-------- .../Flow.Launcher.Plugin.Explorer/Settings.cs | 14 ++++++- .../Views/ActionKeywordSetting.xaml.cs | 16 ++++++-- .../Views/ExplorerSettings.xaml.cs | 4 +- .../Flow.Launcher.Plugin.Explorer/plugin.json | 3 +- 7 files changed, 70 insertions(+), 30 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs b/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs index abce8b41e..bdf74517d 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Flow.Launcher.Plugin; namespace Flow.Launcher.Infrastructure.UserSettings @@ -15,13 +15,24 @@ namespace Flow.Launcher.Infrastructure.UserSettings if (Plugins.ContainsKey(metadata.ID)) { var settings = Plugins[metadata.ID]; - - // TODO: Remove. This is backwards compatibility for 1.8.0 release. - // Introduced two new action keywords in Explorer, so need to update plugin setting in the UserData folder. + if (metadata.ID == "572be03c74c642baae319fc283e561a8" && metadata.ActionKeywords.Count != settings.ActionKeywords.Count) { - settings.ActionKeywords.Add(Query.GlobalPluginWildcardSign); // for index search - settings.ActionKeywords.Add(Query.GlobalPluginWildcardSign); // for path search + // TODO: Remove. This is backwards compatibility for Explorer 1.8.0 release. + // Introduced two new action keywords in Explorer, so need to update plugin setting in the UserData folder. + if (settings.Version.CompareTo("1.8.0") < 0) + { + settings.ActionKeywords.Add(Query.GlobalPluginWildcardSign); // for index search + settings.ActionKeywords.Add(Query.GlobalPluginWildcardSign); // for path search + settings.ActionKeywords.Add(Query.GlobalPluginWildcardSign); // for quick access action keyword + } + + // TODO: Remove. This is backwards compatibility for Explorer 1.9.0 release. + // Introduced a new action keywords in Explorer since 1.8.0, so need to update plugin setting in the UserData folder. + if (settings.Version.CompareTo("1.8.0") > 0) + { + settings.ActionKeywords.Add(Query.GlobalPluginWildcardSign); // for quick access action keyword + } } if (string.IsNullOrEmpty(settings.Version)) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index b23931fcf..e2914d017 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -10,6 +10,7 @@ Deletion successful Successfully deleted the {0} Assigning the global action keyword could bring up too many results during search. Please choose a specific action keyword + Quick Access can not be set to the global action keyword when enabled. Please choose a specific action keyword The required service for Windows Index Search does not appear to be running To fix this, start the Windows Search service. Select here to remove this warning The warning message has been switched off. As an alternative for searching files and folders, would you like to install Everything plugin?{0}{0}Select 'Yes' to install Everything plugin, or 'No' to return @@ -27,6 +28,7 @@ Path Search: File Content Search: Index Search: + Quick Access: Current Action Keyword: Done Enabled diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 9995f45d3..05fd071f7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -42,15 +42,28 @@ namespace Flow.Launcher.Plugin.Explorer.Search { var querySearch = query.Search; + var results = new HashSet(PathEqualityComparator.Instance); + + // This allows the user to type the below action keywords and see/search the list of quick folder links + if (ActionKeywordMatch(query, Settings.ActionKeyword.SearchActionKeyword) + || ActionKeywordMatch(query, Settings.ActionKeyword.QuickAccessActionKeyword) + || ActionKeywordMatch(query, Settings.ActionKeyword.PathSearchActionKeyword)) + { + if (string.IsNullOrEmpty(query.Search)) + return QuickAccess.AccessLinkListAll(query, Settings.QuickAccessLinks); + + var quickaccessLinks = QuickAccess.AccessLinkListMatched(query, Settings.QuickAccessLinks); + + results.UnionWith(quickaccessLinks); + } + if (IsFileContentSearch(query.ActionKeyword)) return await WindowsIndexFileContentSearchAsync(query, querySearch, token).ConfigureAwait(false); - var result = new HashSet(PathEqualityComparator.Instance); - if (ActionKeywordMatch(query, Settings.ActionKeyword.PathSearchActionKeyword) || ActionKeywordMatch(query, Settings.ActionKeyword.SearchActionKeyword)) { - result.UnionWith(await PathSearchAsync(query, token).ConfigureAwait(false)); + results.UnionWith(await PathSearchAsync(query, token).ConfigureAwait(false)); } if ((ActionKeywordMatch(query, Settings.ActionKeyword.IndexSearchActionKeyword) || @@ -58,11 +71,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search querySearch.Length > 0 && !querySearch.IsLocationPathString()) { - result.UnionWith(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token) + results.UnionWith(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token) .ConfigureAwait(false)); } - return result.ToList(); + return results.ToList(); } private bool ActionKeywordMatch(Query query, Settings.ActionKeyword allowedActionKeyword) @@ -75,10 +88,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search keyword == Settings.SearchActionKeyword, Settings.ActionKeyword.PathSearchActionKeyword => Settings.PathSearchKeywordEnabled && keyword == Settings.PathSearchActionKeyword, - Settings.ActionKeyword.FileContentSearchActionKeyword => keyword == - Settings.FileContentSearchActionKeyword, + Settings.ActionKeyword.FileContentSearchActionKeyword => keyword == Settings.FileContentSearchActionKeyword, Settings.ActionKeyword.IndexSearchActionKeyword => Settings.IndexOnlySearchKeywordEnabled && - keyword == Settings.IndexSearchActionKeyword + keyword == Settings.IndexSearchActionKeyword, + Settings.ActionKeyword.QuickAccessActionKeyword => Settings.QuickAccessKeywordEnabled && + keyword == Settings.QuickAccessActionKeyword }; } @@ -86,16 +100,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search { var querySearch = query.Search; - // This allows the user to type the assigned action keyword and only see the list of quick folder links - if (string.IsNullOrEmpty(query.Search)) - return QuickAccess.AccessLinkListAll(query, Settings.QuickAccessLinks); - var results = new HashSet(PathEqualityComparator.Instance); - var quickaccessLinks = QuickAccess.AccessLinkListMatched(query, Settings.QuickAccessLinks); - - results.UnionWith(quickaccessLinks); - var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch); if (isEnvironmentVariable) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 88656a401..e75d07cb0 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -21,6 +21,7 @@ namespace Flow.Launcher.Plugin.Explorer public List IndexSearchExcludedSubdirectoryPaths { get; set; } = new List(); public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; + public bool SearchActionKeywordEnabled { get; set; } = true; public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword; @@ -33,6 +34,10 @@ namespace Flow.Launcher.Plugin.Explorer public bool IndexOnlySearchKeywordEnabled { get; set; } + public string QuickAccessActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; + + public bool QuickAccessKeywordEnabled { get; set; } + public bool WarnWindowsSearchServiceOff { get; set; } = true; internal enum ActionKeyword @@ -40,7 +45,8 @@ namespace Flow.Launcher.Plugin.Explorer SearchActionKeyword, PathSearchActionKeyword, FileContentSearchActionKeyword, - IndexSearchActionKeyword + IndexSearchActionKeyword, + QuickAccessActionKeyword } internal string GetActionKeyword(ActionKeyword actionKeyword) => actionKeyword switch @@ -48,7 +54,8 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeyword, ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword, - ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword + ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword, + ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword }; internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch @@ -57,6 +64,7 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword, ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword, + ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword = keyword, _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") }; @@ -65,6 +73,7 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled, ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled, + ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled, _ => null }; @@ -73,6 +82,7 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable, ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled = enable, + ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled = enable, _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") }; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs index 18703e5ea..14db6d473 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs @@ -63,11 +63,19 @@ namespace Flow.Launcher.Plugin.Explorer.Views } - if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.FileContentSearchActionKeyword - && ActionKeyword == Query.GlobalPluginWildcardSign) + if (ActionKeyword == Query.GlobalPluginWildcardSign + && (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.FileContentSearchActionKeyword + || CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.QuickAccessActionKeyword)) { - MessageBox.Show( - settingsViewModel.Context.API.GetTranslation("plugin_explorer_globalActionKeywordInvalid")); + switch (CurrentActionKeyword.KeywordProperty) + { + case Settings.ActionKeyword.FileContentSearchActionKeyword: + MessageBox.Show(settingsViewModel.Context.API.GetTranslation("plugin_explorer_globalActionKeywordInvalid")); + break; + case Settings.ActionKeyword.QuickAccessActionKeyword: + MessageBox.Show(settingsViewModel.Context.API.GetTranslation("plugin_explorer_quickaccess_globalActionKeywordInvalid")); + break; + } return; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index 0c3799cee..5758b84b8 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -42,7 +42,9 @@ namespace Flow.Launcher.Plugin.Explorer.Views new(Settings.ActionKeyword.PathSearchActionKeyword, viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_pathsearch")), new(Settings.ActionKeyword.IndexSearchActionKeyword, - viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_indexsearch")) + viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_indexsearch")), + new(Settings.ActionKeyword.QuickAccessActionKeyword, + viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_quickaccess")) }; lbxActionKeywords.ItemsSource = actionKeywordsListView; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index 59a31ec13..d47c68cd3 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -4,12 +4,13 @@ "*", "doc:", "*", + "*", "*" ], "Name": "Explorer", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Author": "Jeremy Wu", - "Version": "1.8.2", + "Version": "1.9.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", From fd39b60f7b5904dcee03c1772f87fd1e94f89aac Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 31 Jul 2021 15:44:41 +0800 Subject: [PATCH 005/194] Add Glyph Support --- Flow.Launcher.Plugin/Result.cs | 10 +++++++++- Flow.Launcher/ResultListBox.xaml | 5 ++++- Flow.Launcher/ViewModel/ResultViewModel.cs | 11 ++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index ac9c10df0..171b30c26 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -47,7 +47,15 @@ namespace Flow.Launcher.Plugin public delegate ImageSource IconDelegate(); - public IconDelegate Icon; + /// + /// Delegate to Get Image Source + /// + public IconDelegate Icon { get; set; } + + /// + /// Information for Glyph Icon + /// + public GlyphInfo Glyph { get; init; } /// diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 2f9d06d81..877b82a06 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -42,7 +42,10 @@ + Source="{Binding Image.Value}" Visibility="{Binding ShowImage}" /> + diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index c91bbb107..ce4b23d21 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -66,7 +66,9 @@ namespace Flow.Launcher.ViewModel { OnPropertyChanged(nameof(Image)); }); - } + + Glyph = Result.Glyph; + } Settings = settings; } @@ -74,7 +76,8 @@ namespace Flow.Launcher.ViewModel public Settings Settings { get; private set; } public Visibility ShowOpenResultHotkey => Settings.ShowOpenResultHotkey ? Visibility.Visible : Visibility.Hidden; - + public Visibility ShowIcon => Result.IcoPath != null || Result.Icon is not null || Glyph == null ? Visibility.Visible : Visibility.Hidden; + public Visibility ShowGlyph => Glyph is not null ? Visibility.Visible : Visibility.Hidden; public string OpenResultModifiers => Settings.OpenResultModifiers; public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip) @@ -87,6 +90,8 @@ namespace Flow.Launcher.ViewModel public LazyAsync Image { get; set; } + public GlyphInfo Glyph { get; set; } + private async ValueTask SetImage() { var imagePath = Result.IcoPath; @@ -106,7 +111,7 @@ namespace Flow.Launcher.ViewModel if (ImageLoader.CacheContainImage(imagePath)) // will get here either when icoPath has value\icon delegate is null\when had exception in delegate return ImageLoader.Load(imagePath); - + return await Task.Run(() => ImageLoader.Load(imagePath)); } From 2af29f83769915cc8273d900540f29c84dc23241 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 31 Jul 2021 16:07:14 +0800 Subject: [PATCH 006/194] Create GlyphInfo.cs Add GlyphInfo File --- Flow.Launcher.Plugin/GlyphInfo.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Flow.Launcher.Plugin/GlyphInfo.cs diff --git a/Flow.Launcher.Plugin/GlyphInfo.cs b/Flow.Launcher.Plugin/GlyphInfo.cs new file mode 100644 index 000000000..d24624d8f --- /dev/null +++ b/Flow.Launcher.Plugin/GlyphInfo.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; + +namespace Flow.Launcher.Plugin +{ + public record GlyphInfo(string FontFamily, string Glyph); +} From 53e305d76544ef07f65c5c0e254b98214a408e44 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Fri, 6 Aug 2021 18:52:09 +1000 Subject: [PATCH 007/194] update per review --- .../Views/ActionKeywordSetting.xaml.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs index 14db6d473..dfac163bc 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs @@ -63,23 +63,17 @@ namespace Flow.Launcher.Plugin.Explorer.Views } - if (ActionKeyword == Query.GlobalPluginWildcardSign - && (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.FileContentSearchActionKeyword - || CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.QuickAccessActionKeyword)) - { + if (ActionKeyword == Query.GlobalPluginWildcardSign) switch (CurrentActionKeyword.KeywordProperty) { case Settings.ActionKeyword.FileContentSearchActionKeyword: MessageBox.Show(settingsViewModel.Context.API.GetTranslation("plugin_explorer_globalActionKeywordInvalid")); - break; + return; case Settings.ActionKeyword.QuickAccessActionKeyword: MessageBox.Show(settingsViewModel.Context.API.GetTranslation("plugin_explorer_quickaccess_globalActionKeywordInvalid")); - break; + return; } - return; - } - var oldActionKeyword = CurrentActionKeyword.Keyword; // == because of nullable @@ -92,7 +86,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views switch (Enabled) { // reset to global so it does not take up an action keyword when disabled - // not for null Enable plugin + // not for null Enable plugin case false when oldActionKeyword != Query.GlobalPluginWildcardSign: settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty, Query.GlobalPluginWildcardSign, oldActionKeyword); From b86a2a8f5f42d7a23a7cb011ca58524f6b6646c9 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Fri, 6 Aug 2021 17:04:19 +0800 Subject: [PATCH 008/194] Handle Font file --- Flow.Launcher/ViewModel/ResultViewModel.cs | 36 ++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index ce4b23d21..c8664dc36 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -6,6 +6,7 @@ using Flow.Launcher.Infrastructure.Image; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; +using System.IO; namespace Flow.Launcher.ViewModel { @@ -60,14 +61,25 @@ namespace Flow.Launcher.ViewModel Result = result; Image = new LazyAsync( - SetImage, - ImageLoader.DefaultImage, - () => - { - OnPropertyChanged(nameof(Image)); - }); + SetImage, + ImageLoader.DefaultImage, + () => + { + OnPropertyChanged(nameof(Image)); + }); - Glyph = Result.Glyph; + if (Result.Glyph.FontFamily.Contains('/')) + { + var fontPath = Result.Glyph.FontFamily; + Glyph = Path.IsPathRooted(fontPath) ? Result.Glyph : Result.Glyph with + { + FontFamily = Path.Combine(Result.PluginDirectory, fontPath) + }; + } + else + { + Glyph = Result.Glyph; + } } Settings = settings; @@ -81,12 +93,12 @@ namespace Flow.Launcher.ViewModel public string OpenResultModifiers => Settings.OpenResultModifiers; public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip) - ? Result.Title - : Result.TitleToolTip; + ? Result.Title + : Result.TitleToolTip; public string ShowSubTitleToolTip => string.IsNullOrEmpty(Result.SubTitleToolTip) - ? Result.SubTitle - : Result.SubTitleToolTip; + ? Result.SubTitle + : Result.SubTitleToolTip; public LazyAsync Image { get; set; } @@ -140,4 +152,4 @@ namespace Flow.Launcher.ViewModel return Result.ToString(); } } -} +} \ No newline at end of file From 9eeb04ec1363ab103318b4df859c9f3a918d892d Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Fri, 6 Aug 2021 17:15:10 +0800 Subject: [PATCH 009/194] fix logic --- Flow.Launcher/ViewModel/ResultViewModel.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index c8664dc36..3eba63b22 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -68,17 +68,20 @@ namespace Flow.Launcher.ViewModel OnPropertyChanged(nameof(Image)); }); - if (Result.Glyph.FontFamily.Contains('/')) + if (Result.Glyph is { FontFamily: not null } glyph) { - var fontPath = Result.Glyph.FontFamily; - Glyph = Path.IsPathRooted(fontPath) ? Result.Glyph : Result.Glyph with + if (glyph.FontFamily.Contains('/')) { - FontFamily = Path.Combine(Result.PluginDirectory, fontPath) - }; - } - else - { - Glyph = Result.Glyph; + var fontPath = Result.Glyph.FontFamily; + Glyph = Path.IsPathRooted(fontPath) ? Result.Glyph : Result.Glyph with + { + FontFamily = Path.Combine(Result.PluginDirectory, fontPath) + }; + } + else + { + Glyph = glyph; + } } } From 0f66baf64dd7a5466aa66cc099387d30678b2137 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 9 Aug 2021 20:06:18 +1000 Subject: [PATCH 010/194] add comment for system font loading --- Flow.Launcher/ViewModel/ResultViewModel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 3eba63b22..a73e3847d 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -70,6 +70,7 @@ namespace Flow.Launcher.ViewModel if (Result.Glyph is { FontFamily: not null } glyph) { + // Checks if it's a system installed font, which does not require path to be provided. if (glyph.FontFamily.Contains('/')) { var fontPath = Result.Glyph.FontFamily; @@ -155,4 +156,4 @@ namespace Flow.Launcher.ViewModel return Result.ToString(); } } -} \ No newline at end of file +} From 317ce59ee769df71bbc7a6d6f87f62b04d56afb7 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Tue, 10 Aug 2021 20:24:27 +1000 Subject: [PATCH 011/194] add comment for system font loading --- Flow.Launcher/ViewModel/ResultViewModel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 176943e4c..328dbcba5 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -20,6 +20,7 @@ namespace Flow.Launcher.ViewModel if (Result.Glyph is { FontFamily: not null } glyph) { + // Checks if it's a system installed font, which does not require path to be provided. if (glyph.FontFamily.EndsWith(".ttf") || glyph.FontFamily.EndsWith(".otf")) { var fontPath = Result.Glyph.FontFamily; @@ -127,4 +128,4 @@ namespace Flow.Launcher.ViewModel return Result.ToString(); } } -} \ No newline at end of file +} From 2282f043329615c29f2c11bb54209e007e1e31c7 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 11 Aug 2021 19:47:25 +1000 Subject: [PATCH 012/194] fix WinGet publish due to change installer name fix WinGet publish due to change installer name in 1.8.2 release --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a764edbfd..8f0ceee5b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -79,5 +79,5 @@ on_success: if ($env:APPVEYOR_REPO_BRANCH -eq "master" -and $env:APPVEYOR_REPO_TAG -eq "true") { iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe - .\wingetcreate.exe update Flow-Launcher.Flow-Launcher -s true -u https://github.com/Flow-Launcher/Flow.Launcher/releases/download/v$env:flowVersion/Flow-Launcher-v$env:flowVersion.exe -v $env:flowVersion -t $env:winget_token + .\wingetcreate.exe update Flow-Launcher.Flow-Launcher -s true -u https://github.com/Flow-Launcher/Flow.Launcher/releases/download/v$env:flowVersion/Flow-Launcher-Setup.exe -v $env:flowVersion -t $env:winget_token } From fe45e3bdd27ba6f89d4e7046976713cbe2cff39c Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 12 Aug 2021 09:12:38 +1000 Subject: [PATCH 013/194] update python message from install to download --- Flow.Launcher.Core/Plugin/PluginsLoader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/PluginsLoader.cs b/Flow.Launcher.Core/Plugin/PluginsLoader.cs index 1b78c68ae..b3d56221a 100644 --- a/Flow.Launcher.Core/Plugin/PluginsLoader.cs +++ b/Flow.Launcher.Core/Plugin/PluginsLoader.cs @@ -120,8 +120,8 @@ namespace Flow.Launcher.Core.Plugin var pythonPath = string.Empty; - if (MessageBox.Show("Flow detected you have installed Python plugins, " + - "would you like to install Python to run them? " + + if (MessageBox.Show("Flow detected you have installed Python plugins, which " + + "will need Python to run. Would you like to download Python? " + Environment.NewLine + Environment.NewLine + "Click no if it's already installed, " + "and you will be prompted to select the folder that contains the Python executable", From fd794b8e779c4bea727ec4576151d79babd5da37 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 14 Aug 2021 07:12:22 +0800 Subject: [PATCH 014/194] Bump Dependency --- Flow.Launcher.Core/Flow.Launcher.Core.csproj | 4 ++-- .../Flow.Launcher.Infrastructure.csproj | 6 +++--- Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj | 2 +- Flow.Launcher.Test/Flow.Launcher.Test.csproj | 4 ++-- Flow.Launcher/Flow.Launcher.csproj | 10 +++++----- .../Flow.Launcher.Plugin.BrowserBookmark.csproj | 4 ++-- .../Flow.Launcher.Plugin.Calculator.csproj | 2 +- .../Flow.Launcher.Plugin.Explorer.csproj | 2 +- .../Flow.Launcher.Plugin.PluginsManager.csproj | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Flow.Launcher.Core/Flow.Launcher.Core.csproj b/Flow.Launcher.Core/Flow.Launcher.Core.csproj index 9e932a508..60c4ec3de 100644 --- a/Flow.Launcher.Core/Flow.Launcher.Core.csproj +++ b/Flow.Launcher.Core/Flow.Launcher.Core.csproj @@ -53,8 +53,8 @@ - - + + diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj index aea43506e..47c6c2ef3 100644 --- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj +++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj @@ -53,9 +53,9 @@ - - - + + + diff --git a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj index 664373434..67c76d006 100644 --- a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj +++ b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj @@ -61,7 +61,7 @@ - + diff --git a/Flow.Launcher.Test/Flow.Launcher.Test.csproj b/Flow.Launcher.Test/Flow.Launcher.Test.csproj index 84c9137b7..8de0681c8 100644 --- a/Flow.Launcher.Test/Flow.Launcher.Test.csproj +++ b/Flow.Launcher.Test/Flow.Launcher.Test.csproj @@ -48,13 +48,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + \ No newline at end of file diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index f3885ccfd..d360aca85 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -81,14 +81,14 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj index acfc79d7a..73f00a986 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj @@ -64,8 +64,8 @@ - - + + diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj b/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj index 159f6a728..d7dd507dc 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj @@ -62,7 +62,7 @@ - + \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj index 71c0463b5..8f9466794 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj @@ -38,7 +38,7 @@ - + diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Flow.Launcher.Plugin.PluginsManager.csproj b/Plugins/Flow.Launcher.Plugin.PluginsManager/Flow.Launcher.Plugin.PluginsManager.csproj index 93038ab85..62534ef98 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Flow.Launcher.Plugin.PluginsManager.csproj +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Flow.Launcher.Plugin.PluginsManager.csproj @@ -38,6 +38,6 @@ - + \ No newline at end of file From e14cbb2ef9157b69b17ad5d8a884861c62116483 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 19 Aug 2021 11:20:40 +0800 Subject: [PATCH 015/194] downgrade pinyin library until further discussion --- .../Flow.Launcher.Infrastructure.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj index 47c6c2ef3..2bec7c2c7 100644 --- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj +++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj @@ -55,7 +55,7 @@ - + From bd33914abc25ad6f1295347c1890a82f12170404 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 20 Aug 2021 07:53:18 +1000 Subject: [PATCH 016/194] change to fix major vesion ifor post_build script's nuget commandline --- Scripts/post_build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/post_build.ps1 b/Scripts/post_build.ps1 index 139880d27..49dc0849e 100644 --- a/Scripts/post_build.ps1 +++ b/Scripts/post_build.ps1 @@ -71,8 +71,8 @@ function Pack-Squirrel-Installer ($path, $version, $output) { Write-Host "Packing: $spec" Write-Host "Input path: $input" # making version static as multiple versions can exist in the nuget folder and in the case a breaking change is introduced. - New-Alias Nuget $env:USERPROFILE\.nuget\packages\NuGet.CommandLine\5.4.0\tools\NuGet.exe -Force - # TODO: can we use dotnet pack here? + New-Alias Nuget $env:USERPROFILE\.nuget\packages\NuGet.CommandLine\5.10.0\tools\NuGet.exe -Force + # dotnet pack is not used because ran into issues, need to test installation and starting up if to use it. nuget pack $spec -Version $version -BasePath $input -OutputDirectory $output -Properties Configuration=Release $nupkg = "$output\FlowLauncher.$version.nupkg" From ffd22d78c208992d4f6c632042491db7ee464d75 Mon Sep 17 00:00:00 2001 From: Michael Mouawad Date: Sun, 22 Aug 2021 13:36:01 +0300 Subject: [PATCH 017/194] add run as administration when holding ctrl and shift to Program and Explorer plugins --- Flow.Launcher/MainWindow.xaml | 1 + .../Search/ResultManager.cs | 23 ++++++++++++++++++- .../Programs/Win32.cs | 14 ++++++++--- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index fcc3af5c5..83cc016bb 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -46,6 +46,7 @@ + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 09315d9dd..7e12fea13 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -1,8 +1,10 @@ using Flow.Launcher.Infrastructure; using Flow.Launcher.Plugin.SharedCommands; using System; +using System.Diagnostics; using System.IO; using System.Linq; +using System.Threading.Tasks; using System.Windows; namespace Flow.Launcher.Plugin.Explorer.Search @@ -127,7 +129,26 @@ namespace Flow.Launcher.Plugin.Explorer.Search { try { - if (c.SpecialKeyState.CtrlPressed) + if (File.Exists(filePath) && c.SpecialKeyState.CtrlPressed && c.SpecialKeyState.ShiftPressed) + { + Task.Run(() => + { + try + { + Process.Start(new ProcessStartInfo + { + FileName = filePath, + UseShellExecute = true, + Verb = "runas", + }); + } + catch (Exception e) + { + MessageBox.Show(e.Message, "Could not start " + filePath); + } + }); + } + else if (c.SpecialKeyState.CtrlPressed) { FilesFolders.OpenContainingFolder(filePath); } diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 931cfacc1..9d7530856 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -102,16 +102,24 @@ namespace Flow.Launcher.Plugin.Program.Programs Score = matchResult.Score, TitleHighlightData = matchResult.MatchData, ContextData = this, - Action = _ => + Action = c => { + var runAsAdmin = ( + c.SpecialKeyState.CtrlPressed && + c.SpecialKeyState.ShiftPressed && + !c.SpecialKeyState.AltPressed && + !c.SpecialKeyState.WinPressed + ); + var info = new ProcessStartInfo { FileName = LnkResolvedPath ?? FullPath, WorkingDirectory = ParentDirectory, - UseShellExecute = true + UseShellExecute = true, + Verb = runAsAdmin ? "runas" : null }; - Main.StartProcess(Process.Start, info); + Task.Run(() => Main.StartProcess(Process.Start, info)); return true; } From 8fbf755155d4fd1c6803dd0345d7ac22ecd2f810 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 25 Aug 2021 09:03:20 +1000 Subject: [PATCH 018/194] fix build failure nuget pack 5.10.0 requires target platform version to be appended to nuspec --- Flow.Launcher/Flow.Launcher.csproj | 2 +- Scripts/post_build.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index d360aca85..529fc52a2 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -83,7 +83,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Scripts/post_build.ps1 b/Scripts/post_build.ps1 index 49dc0849e..30ab36e14 100644 --- a/Scripts/post_build.ps1 +++ b/Scripts/post_build.ps1 @@ -71,7 +71,7 @@ function Pack-Squirrel-Installer ($path, $version, $output) { Write-Host "Packing: $spec" Write-Host "Input path: $input" # making version static as multiple versions can exist in the nuget folder and in the case a breaking change is introduced. - New-Alias Nuget $env:USERPROFILE\.nuget\packages\NuGet.CommandLine\5.10.0\tools\NuGet.exe -Force + New-Alias Nuget $env:USERPROFILE\.nuget\packages\NuGet.CommandLine\5.4.0\tools\NuGet.exe -Force # dotnet pack is not used because ran into issues, need to test installation and starting up if to use it. nuget pack $spec -Version $version -BasePath $input -OutputDirectory $output -Properties Configuration=Release From 9d745945cd4dfbbd21acff4c2bf642c6ef571086 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 25 Aug 2021 09:16:48 +1000 Subject: [PATCH 019/194] add comment record ToolGood.Words.Pinyin package version bump issue --- .../Flow.Launcher.Infrastructure.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj index 2bec7c2c7..ef76fd617 100644 --- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj +++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj @@ -55,6 +55,8 @@ + + From 267fb6551b2f5d71107ed0efb7f51497d76b2c27 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 1 Sep 2021 21:10:52 +1000 Subject: [PATCH 020/194] add File Content Search Enabled status property --- .../Search/SearchManager.cs | 6 +++--- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 15 ++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index d367eddca..9256a3917 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -75,10 +75,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search keyword == Settings.SearchActionKeyword, Settings.ActionKeyword.PathSearchActionKeyword => Settings.PathSearchKeywordEnabled && keyword == Settings.PathSearchActionKeyword, - Settings.ActionKeyword.FileContentSearchActionKeyword => keyword == - Settings.FileContentSearchActionKeyword, + Settings.ActionKeyword.FileContentSearchActionKeyword => Settings.FileContentSearchKeywordEnabled && + keyword == Settings.FileContentSearchActionKeyword, Settings.ActionKeyword.IndexSearchActionKeyword => Settings.IndexOnlySearchKeywordEnabled && - keyword == Settings.IndexSearchActionKeyword + keyword == Settings.IndexSearchActionKeyword }; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 88656a401..e44980b23 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -25,6 +25,8 @@ namespace Flow.Launcher.Plugin.Explorer public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword; + public bool FileContentSearchKeywordEnabled { get; set; } = true; + public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public bool PathSearchKeywordEnabled { get; set; } @@ -48,7 +50,8 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeyword, ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword, - ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword + ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found") }; internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch @@ -57,15 +60,16 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword, ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword, - _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found") }; - internal bool? GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch + internal bool GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch { ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled, ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled, - _ => null + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined") }; internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch @@ -73,7 +77,8 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable, ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled = enable, - _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled = enable, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined") }; } } \ No newline at end of file From 91564e0933945bd297da679f8279080e41861d53 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 1 Sep 2021 21:17:20 +1000 Subject: [PATCH 021/194] remove null state from action keyword Enabled status --- .../Views/ActionKeywordSetting.xaml | 2 +- .../Views/ActionKeywordSetting.xaml.cs | 10 +++++----- .../Views/ExplorerSettings.xaml.cs | 7 +++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml index 19ff624b0..a497d2b26 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml @@ -31,7 +31,7 @@ Margin="10" Grid.Row="0" Grid.Column="2" Content="{DynamicResource plugin_explorer_actionkeyword_enabled}" Width="auto" VerticalAlignment="Center" IsChecked="{Binding Enabled}" - Visibility="{Binding Visible}"/> + Visibility="{Binding EnabledVisibility}"/> - public string RawQuery { get; internal set; } + public string RawQuery { get; internal init; } /// /// Search part of a query. @@ -31,45 +32,40 @@ namespace Flow.Launcher.Plugin /// Since we allow user to switch a exclusive plugin to generic plugin, /// so this property will always give you the "real" query part of the query /// - public string Search { get; internal set; } + public string Search { get; internal init; } /// /// The raw query splited into a string array. /// - public string[] Terms { get; set; } + public string[] Terms { get; init; } /// /// Query can be splited into multiple terms by whitespace /// - public const string TermSeperater = " "; + public const string TermSeparator = " "; /// /// User can set multiple action keywords seperated by ';' /// - public const string ActionKeywordSeperater = ";"; + public const string ActionKeywordSeparator = ";"; /// /// '*' is used for System Plugin /// public const string GlobalPluginWildcardSign = "*"; - public string ActionKeyword { get; set; } + public string ActionKeyword { get; init; } /// /// Return first search split by space if it has /// public string FirstSearch => SplitSearch(0); + private string _secondToEndSearch; + /// /// strings from second search (including) to last search /// - public string SecondToEndSearch - { - get - { - var index = string.IsNullOrEmpty(ActionKeyword) ? 1 : 2; - return string.Join(TermSeperater, Terms.Skip(index).ToArray()); - } - } + public string SecondToEndSearch => _secondToEndSearch ??= string.Join(' ', Terms.AsMemory(2)); /// /// Return second search split by space if it has @@ -83,16 +79,9 @@ namespace Flow.Launcher.Plugin private string SplitSearch(int index) { - try - { - return string.IsNullOrEmpty(ActionKeyword) ? Terms[index] : Terms[index + 1]; - } - catch (IndexOutOfRangeException) - { - return string.Empty; - } + return index < Terms.Length ? Terms[index] : string.Empty; } public override string ToString() => RawQuery; } -} +} \ No newline at end of file diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs index 4a2368347..281be6e52 100644 --- a/Flow.Launcher/ActionKeywords.xaml.cs +++ b/Flow.Launcher/ActionKeywords.xaml.cs @@ -30,7 +30,7 @@ namespace Flow.Launcher private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e) { - tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, plugin.Metadata.ActionKeywords.ToArray()); + tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeparator, plugin.Metadata.ActionKeywords.ToArray()); tbAction.Focus(); } diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 1ac320cf0..b0db8bca0 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -22,7 +22,7 @@ namespace Flow.Launcher.ViewModel public Visibility ActionKeywordsVisibility => PluginPair.Metadata.ActionKeywords.Count == 1 ? Visibility.Visible : Visibility.Collapsed; public string InitilizaTime => PluginPair.Metadata.InitTime.ToString() + "ms"; public string QueryTime => PluginPair.Metadata.AvgQueryTime + "ms"; - public string ActionKeywordsText => string.Join(Query.ActionKeywordSeperater, PluginPair.Metadata.ActionKeywords); + public string ActionKeywordsText => string.Join(Query.ActionKeywordSeparator, PluginPair.Metadata.ActionKeywords); public int Priority => PluginPair.Metadata.Priority; public void ChangeActionKeyword(string newActionKeyword, string oldActionKeyword) diff --git a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs index 190f40a03..a27986e75 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs @@ -27,7 +27,7 @@ namespace Flow.Launcher.Plugin.PluginIndicator IcoPath = metadata.IcoPath, Action = c => { - context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeperater}"); + context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}"); return false; } }; diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs index c3d9d1ab2..29d3511eb 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs @@ -25,7 +25,7 @@ namespace Flow.Launcher.Plugin.ProcessKiller { var termToSearch = query.Terms.Length <= 1 ? null - : string.Join(Plugin.Query.TermSeperater, query.Terms.Skip(1)).ToLower(); + : string.Join(Plugin.Query.TermSeparator, query.Terms.Skip(1)).ToLower(); var processlist = processHelper.GetMatchingProcesses(termToSearch); diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs index 58f8538f0..9ccb600e5 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs @@ -297,7 +297,7 @@ namespace Flow.Launcher.Plugin.Shell private void OnWinRPressed() { - context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeperater}"); + context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeparator}"); // show the main window and set focus to the query box Window mainWindow = Application.Current.MainWindow; From 812703766ab03693ea1366052f9acb1682f8de41 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Tue, 7 Sep 2021 17:07:21 -0500 Subject: [PATCH 030/194] Mark previous api as obsolete to preserve backward compatibility. --- Flow.Launcher.Core/Plugin/QueryBuilder.cs | 18 +++++++-------- Flow.Launcher.Plugin/Query.cs | 23 +++++++++++++++---- .../Main.cs | 4 ++-- .../Main.cs | 4 +--- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/QueryBuilder.cs b/Flow.Launcher.Core/Plugin/QueryBuilder.cs index 444335afd..ef387b693 100644 --- a/Flow.Launcher.Core/Plugin/QueryBuilder.cs +++ b/Flow.Launcher.Core/Plugin/QueryBuilder.cs @@ -10,31 +10,31 @@ namespace Flow.Launcher.Core.Plugin public static Query Build(string text, Dictionary nonGlobalPlugins) { // replace multiple white spaces with one white space - var textSplit = text.Split(Query.TermSeparator, StringSplitOptions.RemoveEmptyEntries); - if (textSplit.Length == 0) + var terms = text.Split(Query.TermSeparator, StringSplitOptions.RemoveEmptyEntries); + if (terms.Length == 0) { // nothing was typed return null; } - var rawQuery = string.Join(Query.TermSeparator, textSplit); + var rawQuery = string.Join(Query.TermSeparator, terms); string actionKeyword, search; - string possibleActionKeyword = textSplit[0]; - string[] terms; + string possibleActionKeyword = terms[0]; + string[] searchTerms; if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPair) && !pluginPair.Metadata.Disabled) { // use non global plugin for query actionKeyword = possibleActionKeyword; - search = textSplit.Length > 1 ? rawQuery[(actionKeyword.Length + 1)..] : string.Empty; - terms = textSplit[1..]; + search = terms.Length > 1 ? rawQuery[(actionKeyword.Length + 1)..] : string.Empty; + searchTerms = terms[1..]; } else { // non action keyword actionKeyword = string.Empty; search = rawQuery; - terms = textSplit; + searchTerms = terms; } - var query = new Query(rawQuery, search, terms, actionKeyword); + var query = new Query(rawQuery, search,terms, searchTerms, actionKeyword); return query; } diff --git a/Flow.Launcher.Plugin/Query.cs b/Flow.Launcher.Plugin/Query.cs index 05e34b9d9..12681388e 100644 --- a/Flow.Launcher.Plugin/Query.cs +++ b/Flow.Launcher.Plugin/Query.cs @@ -12,11 +12,11 @@ namespace Flow.Launcher.Plugin /// /// to allow unit tests for plug ins /// - public Query(string rawQuery, string search, string[] terms, string actionKeyword = "") + public Query(string rawQuery, string search, string[] terms, string[] searchTerms, string actionKeyword = "") { Search = search; RawQuery = rawQuery; - Terms = terms; + SearchTerms = searchTerms; ActionKeyword = actionKeyword; } @@ -35,18 +35,31 @@ namespace Flow.Launcher.Plugin public string Search { get; internal init; } /// - /// The raw query splited into a string array. + /// The search string split into a string array. /// + public string[] SearchTerms { get; init; } + + /// + /// The raw query split into a string array + /// + [Obsolete("It may or may not include action keyword, which can be confusing. Use SearchTerms instead")] public string[] Terms { get; init; } /// /// Query can be splited into multiple terms by whitespace /// public const string TermSeparator = " "; + + [Obsolete("Typo")] + public const string TermSeperater = TermSeparator; /// /// User can set multiple action keywords seperated by ';' /// public const string ActionKeywordSeparator = ";"; + + [Obsolete("Typo")] + public const string ActionKeywordSeperater = ActionKeywordSeparator; + /// /// '*' is used for System Plugin @@ -65,7 +78,7 @@ namespace Flow.Launcher.Plugin /// /// strings from second search (including) to last search /// - public string SecondToEndSearch => _secondToEndSearch ??= string.Join(' ', Terms.AsMemory(2)); + public string SecondToEndSearch => _secondToEndSearch ??= string.Join(' ', SearchTerms.AsMemory(2)); /// /// Return second search split by space if it has @@ -79,7 +92,7 @@ namespace Flow.Launcher.Plugin private string SplitSearch(int index) { - return index < Terms.Length ? Terms[index] : string.Empty; + return index < SearchTerms.Length ? SearchTerms[index] : string.Empty; } public override string ToString() => RawQuery; diff --git a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs index a27986e75..b046b2beb 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs @@ -12,11 +12,11 @@ namespace Flow.Launcher.Plugin.PluginIndicator { // if query contains more than one word, eg. github tips // user has decided to type something else rather than wanting to see the available action keywords - if (query.Terms.Length > 1) + if (query.SearchTerms.Length > 1) return new List(); var results = from keyword in PluginManager.NonGlobalPlugins.Keys - where keyword.StartsWith(query.Terms[0]) + where keyword.StartsWith(query.SearchTerms[0]) let metadata = PluginManager.NonGlobalPlugins[keyword].Metadata where !metadata.Disabled select new Result diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs index 29d3511eb..31b4a67ed 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs @@ -23,9 +23,7 @@ namespace Flow.Launcher.Plugin.ProcessKiller public List Query(Query query) { - var termToSearch = query.Terms.Length <= 1 - ? null - : string.Join(Plugin.Query.TermSeparator, query.Terms.Skip(1)).ToLower(); + var termToSearch = query.Search; var processlist = processHelper.GetMatchingProcesses(termToSearch); From 04882ad9f49e540d32028398eaa9b2afabfe7d14 Mon Sep 17 00:00:00 2001 From: Michael Mouawad Date: Sat, 11 Sep 2021 15:30:30 +0300 Subject: [PATCH 031/194] add run as administrator when holding ctrl and shift and to context menu for UWP applications --- .../Programs/UWP.cs | 77 ++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index 869172de7..5bb5d6a49 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -267,6 +267,7 @@ namespace Flow.Launcher.Plugin.Program.Programs public string Location => Package.Location; public bool Enabled { get; set; } + public bool CanRunElevated { get; set; } public string LogoUri { get; set; } public string LogoPath { get; set; } @@ -320,7 +321,27 @@ namespace Flow.Launcher.Plugin.Program.Programs ContextData = this, Action = e => { - Launch(api); + var elevated = ( + e.SpecialKeyState.CtrlPressed && + e.SpecialKeyState.ShiftPressed && + !e.SpecialKeyState.AltPressed && + !e.SpecialKeyState.WinPressed + ); + + if (elevated) + { + if (!CanRunElevated) + { + return false; + } + + LaunchElevated(); + } + else + { + Launch(api); + } + return true; } }; @@ -354,6 +375,21 @@ namespace Flow.Launcher.Plugin.Program.Programs IcoPath = "Images/folder.png" } }; + + if (CanRunElevated) + { + contextMenus.Add(new Result + { + Title = api.GetTranslation("flowlauncher_plugin_program_run_as_administrator"), + Action = _ => + { + LaunchElevated(); + return true; + }, + IcoPath = "Images/cmd.png" + }); + } + return contextMenus; } @@ -377,6 +413,20 @@ namespace Flow.Launcher.Plugin.Program.Programs }); } + private async void LaunchElevated() + { + string command = "shell:AppsFolder\\" + UniqueIdentifier; + command = Environment.ExpandEnvironmentVariables(command.Trim()); + + var info = new ProcessStartInfo(command) + { + UseShellExecute = true, + Verb = "runas", + }; + + Main.StartProcess(Process.Start, info); + } + public Application(AppxPackageHelper.IAppxManifestApplication manifestApp, UWP package) { // This is done because we cannot use the keyword 'out' along with a property @@ -403,6 +453,31 @@ namespace Flow.Launcher.Plugin.Program.Programs LogoPath = LogoPathFromUri(LogoUri); Enabled = true; + CanRunElevated = CanApplicationRunElevated(); + } + + private bool CanApplicationRunElevated() + { + if (EntryPoint == "Windows.FullTrustApplication") + { + return true; + } + else + { + var manifest = Package.Location + "\\AppxManifest.xml"; + if (File.Exists(manifest)) + { + var file = File.ReadAllText(manifest); + + // Using OrdinalIgnoreCase since this is used internally + if (file.Contains("TrustLevel=\"mediumIL\"", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + } + + return false; } internal string ResourceFromPri(string packageFullName, string packageName, string rawReferenceValue) From 9b84f6c559a1ac46fed6fd41c1dc3558dd63d289 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 11 Sep 2021 09:41:39 -0500 Subject: [PATCH 032/194] fix an issue of joining string --- Flow.Launcher.Plugin/Query.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Plugin/Query.cs b/Flow.Launcher.Plugin/Query.cs index 12681388e..84dbb3b36 100644 --- a/Flow.Launcher.Plugin/Query.cs +++ b/Flow.Launcher.Plugin/Query.cs @@ -78,7 +78,7 @@ namespace Flow.Launcher.Plugin /// /// strings from second search (including) to last search /// - public string SecondToEndSearch => _secondToEndSearch ??= string.Join(' ', SearchTerms.AsMemory(2)); + public string SecondToEndSearch => _secondToEndSearch ??= string.Join(' ', SearchTerms[1..]); /// /// Return second search split by space if it has From d3b4c5469b038401646c417aea9d879cd8a3bc2e Mon Sep 17 00:00:00 2001 From: Michael Mouawad Date: Sat, 11 Sep 2021 20:21:52 +0300 Subject: [PATCH 033/194] add run as administrator when holding ctrl and shift to Shell plugin --- Plugins/Flow.Launcher.Plugin.Shell/Main.cs | 36 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs index 58f8538f0..0a934ab32 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs @@ -73,7 +73,14 @@ namespace Flow.Launcher.Plugin.Shell IcoPath = Image, Action = c => { - Execute(Process.Start, PrepareProcessStartInfo(m, c.SpecialKeyState.CtrlPressed)); + var runAsAdministrator = ( + c.SpecialKeyState.CtrlPressed && + c.SpecialKeyState.ShiftPressed && + !c.SpecialKeyState.AltPressed && + !c.SpecialKeyState.WinPressed + ); + + Execute(Process.Start, PrepareProcessStartInfo(m, runAsAdministrator)); return true; } })); @@ -106,7 +113,14 @@ namespace Flow.Launcher.Plugin.Shell IcoPath = Image, Action = c => { - Execute(Process.Start, PrepareProcessStartInfo(m.Key)); + var runAsAdministrator = ( + c.SpecialKeyState.CtrlPressed && + c.SpecialKeyState.ShiftPressed && + !c.SpecialKeyState.AltPressed && + !c.SpecialKeyState.WinPressed + ); + + Execute(Process.Start, PrepareProcessStartInfo(m.Key, runAsAdministrator)); return true; } }; @@ -129,7 +143,14 @@ namespace Flow.Launcher.Plugin.Shell IcoPath = Image, Action = c => { - Execute(Process.Start, PrepareProcessStartInfo(cmd)); + var runAsAdministrator = ( + c.SpecialKeyState.CtrlPressed && + c.SpecialKeyState.ShiftPressed && + !c.SpecialKeyState.AltPressed && + !c.SpecialKeyState.WinPressed + ); + + Execute(Process.Start, PrepareProcessStartInfo(cmd, runAsAdministrator)); return true; } }; @@ -147,7 +168,14 @@ namespace Flow.Launcher.Plugin.Shell IcoPath = Image, Action = c => { - Execute(Process.Start, PrepareProcessStartInfo(m.Key)); + var runAsAdministrator = ( + c.SpecialKeyState.CtrlPressed && + c.SpecialKeyState.ShiftPressed && + !c.SpecialKeyState.AltPressed && + !c.SpecialKeyState.WinPressed + ); + + Execute(Process.Start, PrepareProcessStartInfo(m.Key, runAsAdministrator)); return true; } }); From 6c7eab9c50daf7a4e9d747723ddf8e7cc6bf7558 Mon Sep 17 00:00:00 2001 From: Michael Mouawad Date: Sat, 11 Sep 2021 21:00:05 +0300 Subject: [PATCH 034/194] code refactoring --- .../Programs/UWP.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index 5bb5d6a49..5b4db49be 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -462,18 +462,15 @@ namespace Flow.Launcher.Plugin.Program.Programs { return true; } - else - { - var manifest = Package.Location + "\\AppxManifest.xml"; - if (File.Exists(manifest)) - { - var file = File.ReadAllText(manifest); - // Using OrdinalIgnoreCase since this is used internally - if (file.Contains("TrustLevel=\"mediumIL\"", StringComparison.OrdinalIgnoreCase)) - { - return true; - } + var manifest = Package.Location + "\\AppxManifest.xml"; + if (File.Exists(manifest)) + { + var file = File.ReadAllText(manifest); + + if (file.Contains("TrustLevel=\"mediumIL\"", StringComparison.OrdinalIgnoreCase)) + { + return true; } } From 9764a99d26a82fb8472fc6fff42156afe7422bde Mon Sep 17 00:00:00 2001 From: Michael Mouawad Date: Sat, 11 Sep 2021 21:01:48 +0300 Subject: [PATCH 035/194] show notification message when attempting to run an unsupported UWP app as admin --- .../Flow.Launcher.Plugin.Program/Languages/de.xaml | 1 + .../Flow.Launcher.Plugin.Program/Languages/en.xaml | 1 + .../Flow.Launcher.Plugin.Program/Languages/ja.xaml | 1 + .../Flow.Launcher.Plugin.Program/Languages/pl.xaml | 1 + .../Flow.Launcher.Plugin.Program/Languages/sk.xaml | 1 + .../Flow.Launcher.Plugin.Program/Languages/tr.xaml | 1 + .../Languages/zh-cn.xaml | 1 + .../Languages/zh-tw.xaml | 2 ++ .../Flow.Launcher.Plugin.Program/Programs/UWP.cs | 14 ++++++++------ 9 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml index 18e8d9ff1..7f78fa78a 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml @@ -33,5 +33,6 @@ Programm Suche Programme mit Flow Launcher + This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml index e00534367..770bb69cc 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml @@ -53,5 +53,6 @@ Success Successfully disabled this program from displaying in your query + This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml index 3b2d8f20b..6c8f7da0d 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml @@ -34,5 +34,6 @@ Program Search programs in Flow Launcher + This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml index b6244ec12..8373572f0 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml @@ -33,5 +33,6 @@ Programy Szukaj i uruchamiaj programy z poziomu Flow Launchera + This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml index cb8a0f9e3..b44623aae 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml @@ -53,5 +53,6 @@ Úspešné Úspešne zakázané zobrazovanie tohto programu vo výsledkoch vyhľadávania + This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml index 05bd8a3d8..060cc61ab 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml @@ -35,5 +35,6 @@ Programları Flow Launcher'tan arayın Geçersiz Konum + This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml index 8632abb68..ee5511e20 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml @@ -50,5 +50,6 @@ 完成 成功禁用了该程序以使其无法显示在查询中 + This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml index 550630482..38aee66ff 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml @@ -33,4 +33,6 @@ 程式 在 Flow Launcher 中搜尋程式 + This app is not intended to be run as administrator + diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index 5b4db49be..917ebe7ad 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -328,18 +328,20 @@ namespace Flow.Launcher.Plugin.Program.Programs !e.SpecialKeyState.WinPressed ); - if (elevated) + if (elevated && CanRunElevated) { - if (!CanRunElevated) - { - return false; - } - LaunchElevated(); } else { Launch(api); + + if (elevated) + { + var title = "Plugin: Program"; + var message = api.GetTranslation("flowlauncher_plugin_program_run_as_administrator_not_supported_message"); + api.ShowMsg(title, message, string.Empty); + } } return true; From ae868671d15d148c91cca039389a784195248608 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 13 Sep 2021 08:05:06 +1000 Subject: [PATCH 036/194] version bump for Program and Explorer plugin --- Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +- Plugins/Flow.Launcher.Plugin.Program/plugin.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index 1881eff31..88bee905b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -9,7 +9,7 @@ "Name": "Explorer", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Author": "Jeremy Wu", - "Version": "1.8.4", + "Version": "1.9.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", diff --git a/Plugins/Flow.Launcher.Plugin.Program/plugin.json b/Plugins/Flow.Launcher.Plugin.Program/plugin.json index a37075b0c..424aa04f5 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Program/plugin.json @@ -4,7 +4,7 @@ "Name": "Program", "Description": "Search programs in Flow.Launcher", "Author": "qianlifeng", - "Version": "1.5.4", + "Version": "1.6.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Program.dll", From 4c75f8b8bb7bb891c70b3aeae9dbb2eb78ee732f Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 13 Sep 2021 08:20:34 +1000 Subject: [PATCH 037/194] version bump Shell plugin --- Plugins/Flow.Launcher.Plugin.Shell/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Shell/plugin.json b/Plugins/Flow.Launcher.Plugin.Shell/plugin.json index bccba4590..cb02f6607 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Shell/plugin.json @@ -4,7 +4,7 @@ "Name": "Shell", "Description": "Provide executing commands from Flow Launcher", "Author": "qianlifeng", - "Version": "1.4.3", + "Version": "1.4.4", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Shell.dll", From 3452ecf33bc53c93da3f697333dfe869d1ec2db3 Mon Sep 17 00:00:00 2001 From: Michael Mouawad Date: Mon, 13 Sep 2021 19:44:10 +0300 Subject: [PATCH 038/194] remove unnecessary strings from languages files --- Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml | 1 - Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml | 1 - Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml | 1 - Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml | 1 - Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml | 1 - Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml | 1 - Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml | 1 - 7 files changed, 7 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml index 7f78fa78a..18e8d9ff1 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml @@ -33,6 +33,5 @@ Programm Suche Programme mit Flow Launcher - This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml index 6c8f7da0d..3b2d8f20b 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml @@ -34,6 +34,5 @@ Program Search programs in Flow Launcher - This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml index 8373572f0..b6244ec12 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml @@ -33,6 +33,5 @@ Programy Szukaj i uruchamiaj programy z poziomu Flow Launchera - This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml index b44623aae..cb8a0f9e3 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml @@ -53,6 +53,5 @@ Úspešné Úspešne zakázané zobrazovanie tohto programu vo výsledkoch vyhľadávania - This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml index 060cc61ab..05bd8a3d8 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml @@ -35,6 +35,5 @@ Programları Flow Launcher'tan arayın Geçersiz Konum - This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml index ee5511e20..8632abb68 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml @@ -50,6 +50,5 @@ 完成 成功禁用了该程序以使其无法显示在查询中 - This app is not intended to be run as administrator \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml index 38aee66ff..eb339649f 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml @@ -33,6 +33,5 @@ 程式 在 Flow Launcher 中搜尋程式 - This app is not intended to be run as administrator From 6a0b190120a37309573e710bdcfb07b8fde1f744 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Mon, 20 Sep 2021 21:51:07 -0500 Subject: [PATCH 039/194] Fix Unassigned Terms --- Flow.Launcher.Plugin/Query.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Plugin/Query.cs b/Flow.Launcher.Plugin/Query.cs index 84dbb3b36..a4a806a62 100644 --- a/Flow.Launcher.Plugin/Query.cs +++ b/Flow.Launcher.Plugin/Query.cs @@ -16,6 +16,9 @@ namespace Flow.Launcher.Plugin { Search = search; RawQuery = rawQuery; +#pragma warning disable 618 Legacy Support + Terms = terms; +#pragma warning restore 618 SearchTerms = searchTerms; ActionKeyword = actionKeyword; } @@ -38,7 +41,7 @@ namespace Flow.Launcher.Plugin /// The search string split into a string array. /// public string[] SearchTerms { get; init; } - + /// /// The raw query split into a string array /// @@ -56,7 +59,7 @@ namespace Flow.Launcher.Plugin /// User can set multiple action keywords seperated by ';' /// public const string ActionKeywordSeparator = ";"; - + [Obsolete("Typo")] public const string ActionKeywordSeperater = ActionKeywordSeparator; From 7ff9b688c91af89a49b94ea1b67c09f9462241cd Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Tue, 21 Sep 2021 13:50:51 -0500 Subject: [PATCH 040/194] Refactor Bookmark plugin --- .../Bookmark.cs | 47 ++-------- .../ChromeBookmarkLoader.cs | 26 ++++++ .../ChromeBookmarks.cs | 87 ------------------- .../ChromiumBookmarkLoader.cs | 62 +++++++++++++ .../Commands/Bookmarks.cs | 6 +- .../EdgeBookmarkLoader.cs | 30 +++++++ .../EdgeBookmarks.cs | 87 ------------------- ...xBookmarks.cs => FirefoxBookmarkLoader.cs} | 33 +++---- .../IBookmarkLoader.cs | 9 ++ 9 files changed, 156 insertions(+), 231 deletions(-) create mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarkLoader.cs delete mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarks.cs create mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs create mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs delete mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarks.cs rename Plugins/Flow.Launcher.Plugin.BrowserBookmark/{FirefoxBookmarks.cs => FirefoxBookmarkLoader.cs} (85%) create mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/IBookmarkLoader.cs diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Bookmark.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Bookmark.cs index 790c03686..185cf1620 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Bookmark.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Bookmark.cs @@ -7,50 +7,19 @@ using System.Text; namespace Flow.Launcher.Plugin.BrowserBookmark { - public class Bookmark : IEquatable, IEqualityComparer + // Source may be important in the future + public record Bookmark(string Name, string Url, string Source = "") { - private string m_Name; - public string Name + public override int GetHashCode() { - get - { - return m_Name; - } - set - { - m_Name = value; - } - } - public string Url { get; set; } - public string Source { get; set; } - public int Score { get; set; } - - /* TODO: since Source maybe unimportant, we just need to compare Name and Url */ - public bool Equals(Bookmark other) - { - return Equals(this, other); - } - - public bool Equals(Bookmark x, Bookmark y) - { - if (Object.ReferenceEquals(x, y)) return true; - if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null)) - return false; - - return x.Name == y.Name && x.Url == y.Url; - } - - public int GetHashCode(Bookmark bookmark) - { - if (Object.ReferenceEquals(bookmark, null)) return 0; - int hashName = bookmark.Name == null ? 0 : bookmark.Name.GetHashCode(); - int hashUrl = bookmark.Url == null ? 0 : bookmark.Url.GetHashCode(); + var hashName = Name?.GetHashCode() ?? 0; + var hashUrl = Url?.GetHashCode() ?? 0; return hashName ^ hashUrl; } - public override int GetHashCode() + public virtual bool Equals(Bookmark other) { - return GetHashCode(this); + return other != null && Name == other.Name && Url == other.Url; } } -} +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarkLoader.cs new file mode 100644 index 000000000..7fdb86f31 --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarkLoader.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; + +namespace Flow.Launcher.Plugin.BrowserBookmark +{ + public class ChromeBookmarkLoader : ChromiumBookmarkLoader + { + public override List GetBookmarks() + { + return LoadChromeBookmarks(); + } + + private List LoadChromeBookmarks() + { + var bookmarks = new List(); + String platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Google\Chrome\User Data"), "Google Chrome")); + bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Google\Chrome SxS\User Data"), "Google Chrome Canary")); + bookmarks.AddRange(LoadBookmarks(Path.Combine(platformPath, @"Chromium\User Data"), "Chromium")); + return bookmarks; + } + } +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarks.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarks.cs deleted file mode 100644 index def7f3abe..000000000 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarks.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; - -namespace Flow.Launcher.Plugin.BrowserBookmark -{ - public class ChromeBookmarks - { - private List bookmarks = new List(); - - public List GetBookmarks() - { - bookmarks.Clear(); - LoadChromeBookmarks(); - - return bookmarks; - } - - private void ParseChromeBookmarks(String path, string source) - { - if (!File.Exists(path)) return; - - string all = File.ReadAllText(path); - Regex nameRegex = new Regex("\"name\": \"(?.*?)\""); - MatchCollection nameCollection = nameRegex.Matches(all); - Regex typeRegex = new Regex("\"type\": \"(?.*?)\""); - MatchCollection typeCollection = typeRegex.Matches(all); - Regex urlRegex = new Regex("\"url\": \"(?.*?)\""); - MatchCollection urlCollection = urlRegex.Matches(all); - - List names = (from Match match in nameCollection select match.Groups["name"].Value).ToList(); - List types = (from Match match in typeCollection select match.Groups["type"].Value).ToList(); - List urls = (from Match match in urlCollection select match.Groups["url"].Value).ToList(); - - int urlIndex = 0; - for (int i = 0; i < names.Count; i++) - { - string name = DecodeUnicode(names[i]); - string type = types[i]; - if (type == "url") - { - string url = urls[urlIndex]; - urlIndex++; - - if (url == null) continue; - if (url.StartsWith("javascript:", StringComparison.OrdinalIgnoreCase)) continue; - if (url.StartsWith("vbscript:", StringComparison.OrdinalIgnoreCase)) continue; - - bookmarks.Add(new Bookmark() - { - Name = name, - Url = url, - Source = source - }); - } - } - } - - private void LoadChromeBookmarks(string path, string name) - { - if (!Directory.Exists(path)) return; - var paths = Directory.GetDirectories(path); - - foreach (var profile in paths) - { - if (File.Exists(Path.Combine(profile, "Bookmarks"))) - ParseChromeBookmarks(Path.Combine(profile, "Bookmarks"), name + (Path.GetFileName(profile) == "Default" ? "" : (" (" + Path.GetFileName(profile) + ")"))); - } - } - - private void LoadChromeBookmarks() - { - String platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - LoadChromeBookmarks(Path.Combine(platformPath, @"Google\Chrome\User Data"), "Google Chrome"); - LoadChromeBookmarks(Path.Combine(platformPath, @"Google\Chrome SxS\User Data"), "Google Chrome Canary"); - LoadChromeBookmarks(Path.Combine(platformPath, @"Chromium\User Data"), "Chromium"); - } - - private String DecodeUnicode(String dataStr) - { - Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})"); - return reg.Replace(dataStr, m => ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString()); - } - } -} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs new file mode 100644 index 000000000..7be66eea5 --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs @@ -0,0 +1,62 @@ +using Microsoft.AspNetCore.Authentication; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; + +namespace Flow.Launcher.Plugin.BrowserBookmark +{ + public abstract class ChromiumBookmarkLoader : IBookmarkLoader + { + public abstract List GetBookmarks(); + protected List LoadBookmarks(string browserDataPath, string name) + { + var bookmarks = new List(); + if (!Directory.Exists(browserDataPath)) return bookmarks; + var paths = Directory.GetDirectories(browserDataPath); + + foreach (var profile in paths) + { + var bookmarkPath = Path.Combine(profile, "Bookmarks"); + if (!File.Exists(bookmarkPath)) + continue; + + var source = name + (Path.GetFileName(profile) == "Default" ? "" : $" ({Path.GetFileName(profile)})"); + bookmarks.AddRange(LoadBookmarksFromFile(bookmarkPath, source)); + } + return bookmarks; + } + + protected List LoadBookmarksFromFile(string path, string source) + { + var bookmarks = new List(); + using var jsonDocument = JsonDocument.Parse(File.ReadAllText(path)); + if (!jsonDocument.RootElement.TryGetProperty("roots", out var rootElement)) + return new(); + foreach (var folder in rootElement.EnumerateObject()) + { + EnumerateFolderBookmark(folder.Value, bookmarks, source); + } + return bookmarks; + } + + private void EnumerateFolderBookmark(JsonElement folderElement, List bookmarks, string source) + { + foreach (var subElement in folderElement.GetProperty("children").EnumerateArray()) + { + switch (subElement.GetProperty("type").GetString()) + { + case "folder": + EnumerateFolderBookmark(subElement, bookmarks, source); + break; + default: + bookmarks.Add(new Bookmark( + subElement.GetProperty("name").GetString(), + subElement.GetProperty("url").GetString(), + source)); + break; + } + } + + } + } +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/Bookmarks.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/Bookmarks.cs index 60c4a0ee6..c7cf4867d 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/Bookmarks.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/Bookmarks.cs @@ -20,9 +20,9 @@ namespace Flow.Launcher.Plugin.BrowserBookmark.Commands { var allbookmarks = new List(); - var chromeBookmarks = new ChromeBookmarks(); - var mozBookmarks = new FirefoxBookmarks(); - var edgeBookmarks = new EdgeBookmarks(); + var chromeBookmarks = new ChromeBookmarkLoader(); + var mozBookmarks = new FirefoxBookmarkLoader(); + var edgeBookmarks = new EdgeBookmarkLoader(); //TODO: Let the user select which browser's bookmarks are displayed // Add Firefox bookmarks diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs new file mode 100644 index 000000000..d3f109445 --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; +using System.Text.RegularExpressions; + +namespace Flow.Launcher.Plugin.BrowserBookmark +{ + public class EdgeBookmarkLoader : ChromiumBookmarkLoader + { + + private readonly List _bookmarks = new(); + + private void LoadEdgeBookmarks() + { + var platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge\User Data"), "Microsoft Edge"); + LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge Dev\User Data"), "Microsoft Edge Dev"); + LoadBookmarks(Path.Combine(platformPath, @"Microsoft\Edge SxS\User Data"), "Microsoft Edge Canary"); + } + + public override List GetBookmarks() + { + _bookmarks.Clear(); + LoadEdgeBookmarks(); + return _bookmarks; + } + } +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarks.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarks.cs deleted file mode 100644 index 376808549..000000000 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarks.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; - -namespace Flow.Launcher.Plugin.BrowserBookmark -{ - public class EdgeBookmarks - { - private List bookmarks = new List(); - - public List GetBookmarks() - { - bookmarks.Clear(); - LoadEdgeBookmarks(); - - return bookmarks; - } - - private void ParseEdgeBookmarks(string path, string source) - { - if (!File.Exists(path)) return; - - string all = File.ReadAllText(path); - Regex nameRegex = new Regex("\"name\": \"(?.*?)\""); - MatchCollection nameCollection = nameRegex.Matches(all); - Regex typeRegex = new Regex("\"type\": \"(?.*?)\""); - MatchCollection typeCollection = typeRegex.Matches(all); - Regex urlRegex = new Regex("\"url\": \"(?.*?)\""); - MatchCollection urlCollection = urlRegex.Matches(all); - - List names = (from Match match in nameCollection select match.Groups["name"].Value).ToList(); - List types = (from Match match in typeCollection select match.Groups["type"].Value).ToList(); - List urls = (from Match match in urlCollection select match.Groups["url"].Value).ToList(); - - int urlIndex = 0; - for (int i = 0; i < names.Count; i++) - { - string name = DecodeUnicode(names[i]); - string type = types[i]; - if (type == "url") - { - string url = urls[urlIndex]; - urlIndex++; - - if (url == null) continue; - if (url.StartsWith("javascript:", StringComparison.OrdinalIgnoreCase)) continue; - if (url.StartsWith("vbscript:", StringComparison.OrdinalIgnoreCase)) continue; - - bookmarks.Add(new Bookmark() - { - Name = name, - Url = url, - Source = source - }); - } - } - } - - private void LoadEdgeBookmarks(string path, string name) - { - if (!Directory.Exists(path)) return; - var paths = Directory.GetDirectories(path); - - foreach (var profile in paths) - { - if (File.Exists(Path.Combine(profile, "Bookmarks"))) - ParseEdgeBookmarks(Path.Combine(profile, "Bookmarks"), name + (Path.GetFileName(profile) == "Default" ? "" : (" (" + Path.GetFileName(profile) + ")"))); - } - } - - private void LoadEdgeBookmarks() - { - string platformPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - LoadEdgeBookmarks(Path.Combine(platformPath, @"Microsoft\Edge\User Data"), "Microsoft Edge"); - LoadEdgeBookmarks(Path.Combine(platformPath, @"Microsoft\Edge Dev\User Data"), "Microsoft Edge Dev"); - LoadEdgeBookmarks(Path.Combine(platformPath, @"Microsoft\Edge SxS\User Data"), "Microsoft Edge Canary"); - } - - private string DecodeUnicode(string dataStr) - { - Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})"); - return reg.Replace(dataStr, m => ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString()); - } - } -} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarks.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs similarity index 85% rename from Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarks.cs rename to Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs index b718da3cf..5d47c80e3 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarks.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs @@ -6,7 +6,7 @@ using System.Linq; namespace Flow.Launcher.Plugin.BrowserBookmark { - public class FirefoxBookmarks + public class FirefoxBookmarkLoader : IBookmarkLoader { private const string queryAllBookmarks = @"SELECT moz_places.url, moz_bookmarks.title FROM moz_places @@ -27,10 +27,10 @@ namespace Flow.Launcher.Plugin.BrowserBookmark if (string.IsNullOrEmpty(PlacesPath) || !File.Exists(PlacesPath)) return new List(); - var bookmarList = new List(); + var bookmarkList = new List(); // create the connection string and init the connection - string dbPath = string.Format(dbPathFormat, PlacesPath); + string dbPath = string.Format(dbPathFormat, PlacesPath); using (var dbConnection = new SQLiteConnection(dbPath)) { // Open connection to the database file and execute the query @@ -38,14 +38,13 @@ namespace Flow.Launcher.Plugin.BrowserBookmark var reader = new SQLiteCommand(queryAllBookmarks, dbConnection).ExecuteReader(); // return results in List format - bookmarList = reader.Select(x => new Bookmark() - { - Name = (x["title"] is DBNull) ? string.Empty : x["title"].ToString(), - Url = x["url"].ToString() - }).ToList(); + bookmarkList = reader.Select( + x => new Bookmark(x["title"] is DBNull ? string.Empty : x["title"].ToString(), + x["url"].ToString()) + ).ToList(); } - return bookmarList; + return bookmarkList; } /// @@ -63,7 +62,8 @@ namespace Flow.Launcher.Plugin.BrowserBookmark // get firefox default profile directory from profiles.ini string ini; - using (var sReader = new StreamReader(profileIni)) { + using (var sReader = new StreamReader(profileIni)) + { ini = sReader.ReadToEnd(); } @@ -95,7 +95,10 @@ namespace Flow.Launcher.Plugin.BrowserBookmark Version=2 */ - var lines = ini.Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList(); + var lines = ini.Split(new string[] + { + "\r\n" + }, StringSplitOptions.None).ToList(); var defaultProfileFolderNameRaw = lines.Where(x => x.Contains("Default=") && x != "Default=1").FirstOrDefault() ?? string.Empty; @@ -104,14 +107,14 @@ namespace Flow.Launcher.Plugin.BrowserBookmark var defaultProfileFolderName = defaultProfileFolderNameRaw.Split('=').Last(); - var indexOfDefaultProfileAtttributePath = lines.IndexOf("Path="+ defaultProfileFolderName); + var indexOfDefaultProfileAtttributePath = lines.IndexOf("Path=" + defaultProfileFolderName); // Seen in the example above, the IsRelative attribute is always above the Path attribute var relativeAttribute = lines[indexOfDefaultProfileAtttributePath - 1]; return relativeAttribute == "0" // See above, the profile is located in a custom location, path is not relative, so IsRelative=0 - ? defaultProfileFolderName + @"\places.sqlite" - : Path.Combine(profileFolderPath, defaultProfileFolderName) + @"\places.sqlite"; + ? defaultProfileFolderName + @"\places.sqlite" + : Path.Combine(profileFolderPath, defaultProfileFolderName) + @"\places.sqlite"; } } } @@ -126,4 +129,4 @@ namespace Flow.Launcher.Plugin.BrowserBookmark } } } -} +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/IBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/IBookmarkLoader.cs new file mode 100644 index 000000000..1dbd8b6bf --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/IBookmarkLoader.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Flow.Launcher.Plugin.BrowserBookmark +{ + public interface IBookmarkLoader + { + public List GetBookmarks(); + } +} \ No newline at end of file From d51579967bad180e9bc3da557674cfe1d40fa0c1 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 22 Sep 2021 18:09:30 -0500 Subject: [PATCH 041/194] Further Refactor & add CustomBrowsers UI --- .../ChromeBookmarkLoader.cs | 3 +- .../ChromiumBookmarkLoader.cs | 5 +- .../{Bookmarks.cs => BookmarkLoader.cs} | 16 ++++--- .../CustomChromiumBookmarkLoader.cs | 14 ++++++ .../EdgeBookmarkLoader.cs | 1 + .../FirefoxBookmarkLoader.cs | 1 + ...low.Launcher.Plugin.BrowserBookmark.csproj | 4 ++ .../IBookmarkLoader.cs | 3 +- .../Main.cs | 6 +-- .../{ => Models}/Bookmark.cs | 11 ++--- .../Models/CustomBrowser.cs | 8 ++++ .../Models/Settings.cs | 20 +++++++- .../Views/CustomBrowserSetting.xaml | 36 +++++++++++++++ .../Views/CustomBrowserSetting.xaml.cs | 45 ++++++++++++++++++ .../Views/SettingsControl.xaml | 46 +++++++++++++++---- .../Views/SettingsControl.xaml.cs | 40 +++++++++++----- 16 files changed, 218 insertions(+), 41 deletions(-) rename Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/{Bookmarks.cs => BookmarkLoader.cs} (71%) create mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/CustomChromiumBookmarkLoader.cs rename Plugins/Flow.Launcher.Plugin.BrowserBookmark/{ => Models}/Bookmark.cs (73%) create mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs create mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml create mode 100644 Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml.cs diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarkLoader.cs index 7fdb86f31..d7cfcaf6a 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromeBookmarkLoader.cs @@ -1,4 +1,5 @@ -using System; +using Flow.Launcher.Plugin.BrowserBookmark.Models; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs index 7be66eea5..a6edf3302 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authentication; +using Flow.Launcher.Plugin.BrowserBookmark.Models; +using Microsoft.AspNetCore.Authentication; using System.Collections.Generic; using System.IO; using System.Text.Json; @@ -28,6 +29,8 @@ namespace Flow.Launcher.Plugin.BrowserBookmark protected List LoadBookmarksFromFile(string path, string source) { + if (!File.Exists(path)) + return new(); var bookmarks = new List(); using var jsonDocument = JsonDocument.Parse(File.ReadAllText(path)); if (!jsonDocument.RootElement.TryGetProperty("roots", out var rootElement)) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/Bookmarks.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/BookmarkLoader.cs similarity index 71% rename from Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/Bookmarks.cs rename to Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/BookmarkLoader.cs index c7cf4867d..b4c6235e0 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/Bookmarks.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/BookmarkLoader.cs @@ -1,11 +1,12 @@ using System.Collections.Generic; using System.Linq; using Flow.Launcher.Infrastructure; +using Flow.Launcher.Plugin.BrowserBookmark.Models; using Flow.Launcher.Plugin.SharedModels; namespace Flow.Launcher.Plugin.BrowserBookmark.Commands { - internal static class Bookmarks + internal static class BookmarkLoader { internal static MatchResult MatchProgram(Bookmark bookmark, string queryString) { @@ -18,23 +19,24 @@ namespace Flow.Launcher.Plugin.BrowserBookmark.Commands internal static List LoadAllBookmarks() { - var allbookmarks = new List(); var chromeBookmarks = new ChromeBookmarkLoader(); var mozBookmarks = new FirefoxBookmarkLoader(); var edgeBookmarks = new EdgeBookmarkLoader(); + var allBookmarks = new List(); + //TODO: Let the user select which browser's bookmarks are displayed // Add Firefox bookmarks - mozBookmarks.GetBookmarks().ForEach(x => allbookmarks.Add(x)); + allBookmarks.AddRange(mozBookmarks.GetBookmarks()); // Add Chrome bookmarks - chromeBookmarks.GetBookmarks().ForEach(x => allbookmarks.Add(x)); + allBookmarks.AddRange(chromeBookmarks.GetBookmarks()); // Add Edge (Chromium) bookmarks - edgeBookmarks.GetBookmarks().ForEach(x => allbookmarks.Add(x)); + allBookmarks.AddRange(edgeBookmarks.GetBookmarks()); - return allbookmarks.Distinct().ToList(); + return allBookmarks.Distinct().ToList(); } } -} +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/CustomChromiumBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/CustomChromiumBookmarkLoader.cs new file mode 100644 index 000000000..91189ace7 --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/CustomChromiumBookmarkLoader.cs @@ -0,0 +1,14 @@ +using Flow.Launcher.Plugin.BrowserBookmark.Models; +using System.Collections.Generic; + +namespace Flow.Launcher.Plugin.BrowserBookmark +{ + public class CustomChromiumBookmarkLoader : ChromiumBookmarkLoader + { + public string BrowserDataPath { get; init; } + public string BookmarkFilePath { get; init; } + public string BrowserName { get; init; } + + public override List GetBookmarks() => BrowserDataPath != null ? LoadBookmarks(BrowserDataPath, BrowserName) : LoadBookmarksFromFile(BookmarkFilePath, BrowserName); + } +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs index d3f109445..d982ee99e 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/EdgeBookmarkLoader.cs @@ -1,3 +1,4 @@ +using Flow.Launcher.Plugin.BrowserBookmark.Models; using System; using System.Collections.Generic; using System.IO; diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs index 5d47c80e3..3df034781 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs @@ -1,3 +1,4 @@ +using Flow.Launcher.Plugin.BrowserBookmark.Models; using System; using System.Collections.Generic; using System.Data.SQLite; diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj index acfc79d7a..46313d38f 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj @@ -69,4 +69,8 @@ + + + + \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/IBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/IBookmarkLoader.cs index 1dbd8b6bf..2c48cfd55 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/IBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/IBookmarkLoader.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using Flow.Launcher.Plugin.BrowserBookmark.Models; +using System.Collections.Generic; namespace Flow.Launcher.Plugin.BrowserBookmark { diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs index a0b443e75..eaf14d5c2 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs @@ -26,7 +26,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark _settings = context.API.LoadSettingJsonStorage(); - cachedBookmarks = Bookmarks.LoadAllBookmarks(); + cachedBookmarks = BookmarkLoader.LoadAllBookmarks(); } public List Query(Query query) @@ -45,7 +45,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark Title = c.Name, SubTitle = c.Url, IcoPath = @"Images\bookmark.png", - Score = Bookmarks.MatchProgram(c, param).Score, + Score = BookmarkLoader.MatchProgram(c, param).Score, Action = _ => { if (_settings.OpenInNewBrowserWindow) @@ -93,7 +93,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark { cachedBookmarks.Clear(); - cachedBookmarks = Bookmarks.LoadAllBookmarks(); + cachedBookmarks = BookmarkLoader.LoadAllBookmarks(); } public string GetTranslatedPluginTitle() diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Bookmark.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Bookmark.cs similarity index 73% rename from Plugins/Flow.Launcher.Plugin.BrowserBookmark/Bookmark.cs rename to Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Bookmark.cs index 185cf1620..c2fa9d977 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Bookmark.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Bookmark.cs @@ -1,11 +1,6 @@ -using BinaryAnalysis.UnidecodeSharp; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; - -namespace Flow.Launcher.Plugin.BrowserBookmark +namespace Flow.Launcher.Plugin.BrowserBookmark.Models { // Source may be important in the future public record Bookmark(string Name, string Url, string Source = "") @@ -21,5 +16,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark { return other != null && Name == other.Name && Url == other.Url; } + + public List CustomBrowsers { get; set; }= new(); } } \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs new file mode 100644 index 000000000..1ddeab5df --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs @@ -0,0 +1,8 @@ +namespace Flow.Launcher.Plugin.BrowserBookmark.Models +{ + public class CustomBrowser : BaseModel + { + public string Name { get; set; } + public string Path { get; set; } + } +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Settings.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Settings.cs index dc444fd73..e63b90dbc 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Settings.cs @@ -1,9 +1,27 @@ -namespace Flow.Launcher.Plugin.BrowserBookmark.Models +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text.Json.Serialization; + +namespace Flow.Launcher.Plugin.BrowserBookmark.Models { public class Settings : BaseModel { public bool OpenInNewBrowserWindow { get; set; } = true; public string BrowserPath { get; set; } + + public ObservableCollection CustomBrowsers { get; set; } = new() + { + new CustomBrowser + { + Name="awefawef", + Path="awefawef" + }, + new CustomBrowser + { + Name = "awefawefawefawef", + Path = "aweawefawfawef" + } + }; } } \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml new file mode 100644 index 000000000..2370789f1 --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + /// - public void ChangeQueryText(string queryText) + public void ChangeQueryText(string queryText, bool reQuery) { - QueryText = queryText; + if (QueryText!=queryText) + { + QueryText = queryText; + } + else if (reQuery) + { + Query(); + } QueryTextCursorMovedToEnd = true; } From 54b5966e410a601f244e978b673a36a871dc5ff2 Mon Sep 17 00:00:00 2001 From: Kevin Zhang <45326534+taooceros@users.noreply.github.com> Date: Fri, 24 Sep 2021 20:07:01 -0500 Subject: [PATCH 049/194] add default Parameter --- Flow.Launcher/ViewModel/MainViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index b5eec4972..e012a2dfd 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -285,7 +285,7 @@ namespace Flow.Launcher.ViewModel /// but we don't want to move cursor to end when query is updated from TextBox /// /// - public void ChangeQueryText(string queryText, bool reQuery) + public void ChangeQueryText(string queryText, bool reQuery = false) { if (QueryText!=queryText) { From 9a488dc89628e10b2a7060dee64ede46b15fa884 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 27 Sep 2021 07:39:49 +1000 Subject: [PATCH 050/194] version bump PluginsManager --- Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json index 08dab6fbf..592025103 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json @@ -6,7 +6,7 @@ "Name": "Plugins Manager", "Description": "Management of installing, uninstalling or updating Flow Launcher plugins", "Author": "Jeremy Wu", - "Version": "1.8.5", + "Version": "1.9.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll", From 0123f5e930d9a1a7b6e6c73928ba110f76a34850 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 27 Sep 2021 14:01:14 +1000 Subject: [PATCH 051/194] add comment to clarify re-query --- Flow.Launcher/ViewModel/MainViewModel.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index e012a2dfd..04b5ffede 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -289,6 +289,7 @@ namespace Flow.Launcher.ViewModel { if (QueryText!=queryText) { + // re-query is done in QueryText's setter method QueryText = queryText; } else if (reQuery) From 3a0594f99b6167873b4b0e6dd3344780685153dc Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Mon, 27 Sep 2021 20:00:46 +0900 Subject: [PATCH 052/194] - Changing Result item and hotkey layout - Add Hightlight Styling - Add New Themes and adjust classic themes --- Flow.Launcher.Core/Resource/Theme.cs | 12 +- .../Converters/HighlightTextConverter.cs | 8 +- Flow.Launcher/Flow.Launcher.csproj | 4 + Flow.Launcher/MainWindow.xaml | 24 +- Flow.Launcher/ResultListBox.xaml | 51 +-- Flow.Launcher/Themes/Base.xaml | 43 +- Flow.Launcher/Themes/BlackAndWhite.xaml | 10 + Flow.Launcher/Themes/BlurBlack Darker.xaml | 8 + Flow.Launcher/Themes/BlurBlack.xaml | 8 + Flow.Launcher/Themes/BlurWhite.xaml | 4 + Flow.Launcher/Themes/Darker.xaml | 8 + Flow.Launcher/Themes/Gray.xaml | 13 + Flow.Launcher/Themes/League.Designer.xaml | 36 ++ Flow.Launcher/Themes/League.xaml | 58 +++ Flow.Launcher/Themes/Light.xaml | 13 + Flow.Launcher/Themes/Metro Server.xaml | 16 +- Flow.Launcher/Themes/Nord Darker.xaml | 8 + Flow.Launcher/Themes/Nord.xaml | 8 + Flow.Launcher/Themes/Pink.xaml | 28 +- Flow.Launcher/Themes/Win11Dark.Designer.xaml | 36 ++ Flow.Launcher/Themes/Win11Dark.xaml | 251 +++++++++++ Flow.Launcher/ViewModel/ResultViewModel.cs | 2 +- Flow.Launcher/ViewModel/ResultsViewModel.cs | 2 +- ...her.Plugin.Explorer_ovmyrfet_wpftmp.csproj | 403 ++++++++++++++++++ 24 files changed, 991 insertions(+), 63 deletions(-) create mode 100644 Flow.Launcher/Themes/League.Designer.xaml create mode 100644 Flow.Launcher/Themes/League.xaml create mode 100644 Flow.Launcher/Themes/Win11Dark.Designer.xaml create mode 100644 Flow.Launcher/Themes/Win11Dark.xaml create mode 100644 Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer_ovmyrfet_wpftmp.csproj diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index e70de673e..ac5363a2c 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -244,7 +244,7 @@ namespace Flow.Launcher.Core.Resource effectSetter.Property = Border.EffectProperty; effectSetter.Value = new DropShadowEffect { - Opacity = 0.9, + Opacity = 0.4, ShadowDepth = 2, BlurRadius = 15 }; @@ -261,7 +261,7 @@ namespace Flow.Launcher.Core.Resource } else { - var baseMargin = (Thickness) marginSetter.Value; + var baseMargin = (Thickness)marginSetter.Value; var newMargin = new Thickness( baseMargin.Left + ShadowExtraMargin, baseMargin.Top + ShadowExtraMargin, @@ -282,8 +282,8 @@ namespace Flow.Launcher.Core.Resource var effectSetter = windowBorderStyle.Setters.FirstOrDefault(setterBase => setterBase is Setter setter && setter.Property == Border.EffectProperty) as Setter; var marginSetter = windowBorderStyle.Setters.FirstOrDefault(setterBase => setterBase is Setter setter && setter.Property == Border.MarginProperty) as Setter; - - if(effectSetter != null) + + if (effectSetter != null) { windowBorderStyle.Setters.Remove(effectSetter); } @@ -371,11 +371,11 @@ namespace Flow.Launcher.Core.Resource private void SetWindowAccent(Window w, AccentState state) { var windowHelper = new WindowInteropHelper(w); - + // this determines the width of the main query window w.Width = mainWindowWidth; windowHelper.EnsureHandle(); - + var accent = new AccentPolicy { AccentState = state }; var accentStructSize = Marshal.SizeOf(accent); diff --git a/Flow.Launcher/Converters/HighlightTextConverter.cs b/Flow.Launcher/Converters/HighlightTextConverter.cs index 006e52320..6bea2092c 100644 --- a/Flow.Launcher/Converters/HighlightTextConverter.cs +++ b/Flow.Launcher/Converters/HighlightTextConverter.cs @@ -1,4 +1,4 @@ -using System; +using System.Windows;using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; +using System.Windows.Media; using System.Windows.Documents; namespace Flow.Launcher.Converters @@ -30,7 +31,10 @@ namespace Flow.Launcher.Converters var currentCharacter = text.Substring(i, 1); if (this.ShouldHighlight(highlightData, i)) { - textBlock.Inlines.Add(new Bold(new Run(currentCharacter))); + //textBlock.Inlines.Add(new Bold(new Run(currentCharacter))); + //textBlock.Inlines.Add(new Run(currentCharacter) { Foreground = Brushes.RoyalBlue }); + textBlock.Inlines.Add(new Run(currentCharacter) { Style = (Style)Application.Current.FindResource("HighlightStyle") }); + } else { diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 529fc52a2..bb3c84eec 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -47,7 +47,11 @@ + + + + diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 83cc016bb..80373e1f8 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -31,6 +31,7 @@ + @@ -62,13 +63,13 @@ - + + Margin="16,0,56,0"> @@ -83,24 +84,29 @@ AllowDrop="True" Visibility="Visible" Background="Transparent" - Margin="18,0,56,0"> + Margin="16,0,56,0"> - + - + - + + - + Y1="0" Y2="0" X2="100" Height="2" Width="Auto" StrokeThickness="1"> + + + diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index dfee89810..605d0ffa5 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -20,6 +20,7 @@ IsSynchronizedWithCurrentItem="True" PreviewMouseDown="ListBox_PreviewMouseDown"> + - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - + + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + - - - - - + + + + + + + + - + - - - - - - - - + Width="130" Margin="10 0 0 0"> + + + + + + + + + + + + + + +  + - - - - - - - + + + + + + - + - - - - - - - - + Width="130" Margin="10 -2 0 0"> + + + + + + + + + + + + + + +  + - - - + + + + + + + + + + + + +  + + + + - - - + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + Date: Sat, 9 Oct 2021 20:58:22 +0900 Subject: [PATCH 123/194] - Remove Expander Button's Circle and adjust arrow size --- Flow.Launcher/App.xaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher/App.xaml b/Flow.Launcher/App.xaml index 1311de968..13d88e1c6 100644 --- a/Flow.Launcher/App.xaml +++ b/Flow.Launcher/App.xaml @@ -71,8 +71,8 @@ - - + + @@ -82,11 +82,11 @@ - + - + @@ -160,8 +160,8 @@ - - + + @@ -170,11 +170,11 @@ - + - + From 762df7fdd380926eaced688b2d2bfef713602f85 Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sat, 9 Oct 2021 22:22:47 +0900 Subject: [PATCH 124/194] - Remove colon Action keyword String - Fix layout for init/query time/version/plugin store - change action keyword to button - add listbox bottom margin - add margin when select list item for easy to distinguish. --- Flow.Launcher/Languages/en.xaml | 2 +- Flow.Launcher/SettingWindow.xaml | 80 +++++++++++++++++------------ Flow.Launcher/SettingWindow.xaml.cs | 14 +++-- 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 60605df30..79b8ce669 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -46,7 +46,7 @@ Find more plugins On Off - Action keyword: + Action keyword Current action keyword: New action keyword: Current Priority: diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 02de47fe7..47df70561 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -229,7 +229,7 @@ - + @@ -241,7 +241,7 @@ - + @@ -257,13 +257,6 @@ - @@ -542,7 +535,7 @@ Margin="0, 0, 0, 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource PluginList}" ScrollViewer.IsDeferredScrollingEnabled="True" ScrollViewer.CanContentScroll="False" - Padding="0" Width="Auto" HorizontalAlignment="Stretch"> + Padding="0 0 0 18" Width="Auto" HorizontalAlignment="Stretch"> @@ -618,22 +611,36 @@ - - - + + + - + + + + @@ -652,29 +659,36 @@ - + Padding="0 12 0 0" > - - + + + - + - + - - + HorizontalAlignment="Right" FontSize="12" VerticalAlignment="Center"/> + + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 08d0eb88a..9b5c34c44 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -193,14 +193,13 @@ namespace Flow.Launcher } - private void OnPluginActionKeywordsClick(object sender, MouseButtonEventArgs e) + private void OnPluginActionKeywordsClick(object sender, RoutedEventArgs e) { - if (e.ChangedButton == MouseButton.Left) - { + var id = viewModel.SelectedPlugin.PluginPair.Metadata.ID; ActionKeywords changeKeywordsWindow = new ActionKeywords(id, settings, viewModel.SelectedPlugin); changeKeywordsWindow.ShowDialog(); - } + } private void OnPluginNameClick(object sender, MouseButtonEventArgs e) @@ -266,6 +265,13 @@ namespace Flow.Launcher FilesFolders.OpenPath(Path.Combine(DataLocation.DataDirectory(), Constant.Themes)); } + /* + private void OnPluginActionKeywordsClick(object sender, RoutedEventArgs e) + { + + } + */ + /*private void OnPluginPriorityClick(object sender, RoutedEventArgs e) { From 4a4f0bbefbd24a0e2209b742934c4736dd573dcf Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sat, 9 Oct 2021 22:27:09 +0900 Subject: [PATCH 125/194] - Add plugin page title - Adjust listbox Margin for fit other setting page list. --- Flow.Launcher/SettingWindow.xaml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 47df70561..38c739fb2 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -527,12 +527,20 @@ - - - + + + + + + + + + + + From 0d11b79ee31d21aacb6717e5b6a160e90ee5063d Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 10 Oct 2021 00:02:41 +0900 Subject: [PATCH 126/194] - Adjust Shell, Calc, WebSearch Setting Margin --- .../Views/CalculatorSettings.xaml | 2 +- Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml | 2 +- Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml b/Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml index 1330247b2..374bccf62 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml @@ -15,7 +15,7 @@ - + diff --git a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml index 4cd4d8fa3..d9b1942f1 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml @@ -6,7 +6,7 @@ mc:Ignorable="d" Loaded="CMDSetting_OnLoaded" d:DesignHeight="300" d:DesignWidth="300"> - + diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml index c2f64bc7e..cb0b50069 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml @@ -32,7 +32,7 @@ - + From 2dc8bb386e41dbfb1b7d41c7f28726084cebc8e1 Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 10 Oct 2021 00:33:11 +0900 Subject: [PATCH 127/194] - Add Automatically Hide Plugin Info Border by SettingControl Height --- Flow.Launcher/SettingWindow.xaml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 38c739fb2..769da568a 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -655,13 +655,23 @@ - - + + + From 2af186736a12f0d691c89475ec2e0a065cf3d431 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 9 Oct 2021 11:34:41 -0500 Subject: [PATCH 128/194] Rename with async suffix and add lock to prevent concurrent update check --- Flow.Launcher.Core/Updater.cs | 37 +++++++++++-------- Flow.Launcher/App.xaml.cs | 4 +- .../ViewModel/SettingWindowViewModel.cs | 2 +- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 76713ce2a..e09c6380c 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -16,6 +16,7 @@ using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using System.Text.Json.Serialization; +using System.Threading; namespace Flow.Launcher.Core { @@ -28,21 +29,21 @@ namespace Flow.Launcher.Core GitHubRepository = gitHubRepository; } - public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true) + private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1); + + public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true) { + await UpdateLock.WaitAsync(); try { - UpdateInfo newUpdateInfo; - if (!silentUpdate) api.ShowMsg(api.GetTranslation("pleaseWait"), - api.GetTranslation("update_flowlauncher_update_check")); + api.GetTranslation("update_flowlauncher_update_check")); using var updateManager = await GitHubUpdateManager(GitHubRepository).ConfigureAwait(false); - // UpdateApp CheckForUpdate will return value only if the app is squirrel installed - newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false); + var newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false); var newReleaseVersion = Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString()); var currentVersion = Version.Parse(Constant.Version); @@ -58,7 +59,7 @@ namespace Flow.Launcher.Core if (!silentUpdate) api.ShowMsg(api.GetTranslation("update_flowlauncher_update_found"), - api.GetTranslation("update_flowlauncher_updating")); + api.GetTranslation("update_flowlauncher_updating")); await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply).ConfigureAwait(false); @@ -70,8 +71,8 @@ namespace Flow.Launcher.Core FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination); if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination)) MessageBox.Show(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"), - DataLocation.PortableDataPath, - targetDestination)); + DataLocation.PortableDataPath, + targetDestination)); } else { @@ -87,12 +88,15 @@ namespace Flow.Launcher.Core UpdateManager.RestartApp(Constant.ApplicationFileName); } } - catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException || e.InnerException is TimeoutException) + catch (Exception e) when (e is HttpRequestException or WebException or SocketException || e.InnerException is TimeoutException) { Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e); api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"), - api.GetTranslation("update_flowlauncher_check_connection")); - return; + api.GetTranslation("update_flowlauncher_check_connection")); + } + finally + { + UpdateLock.Release(); } } @@ -115,13 +119,16 @@ namespace Flow.Launcher.Core var uri = new Uri(repository); var api = $"https://api.github.com/repos{uri.AbsolutePath}/releases"; - var jsonStream = await Http.GetStreamAsync(api).ConfigureAwait(false); + await using var jsonStream = await Http.GetStreamAsync(api).ConfigureAwait(false); var releases = await System.Text.Json.JsonSerializer.DeserializeAsync>(jsonStream).ConfigureAwait(false); var latest = releases.Where(r => !r.Prerelease).OrderByDescending(r => r.PublishedAt).First(); var latestUrl = latest.HtmlUrl.Replace("/tag/", "/download/"); - - var client = new WebClient { Proxy = Http.WebProxy }; + + var client = new WebClient + { + Proxy = Http.WebProxy + }; var downloader = new FileDownloader(client); var manager = new UpdateManager(latestUrl, urlDownloader: downloader); diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index c2a32100d..8c869e941 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -129,12 +129,12 @@ namespace Flow.Launcher var timer = new Timer(1000 * 60 * 60 * 5); timer.Elapsed += async (s, e) => { - await _updater.UpdateApp(API); + await _updater.UpdateAppAsync(API); }; timer.Start(); // check updates on startup - await _updater.UpdateApp(API); + await _updater.UpdateAppAsync(API); } }); } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index d3a4f9a83..e85d01b1b 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -46,7 +46,7 @@ namespace Flow.Launcher.ViewModel public async void UpdateApp() { - await _updater.UpdateApp(App.API, false); + await _updater.UpdateAppAsync(App.API, false); } public bool AutoUpdates From 234816df4ba28485565ebb3d1c47fe743c355b97 Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 10 Oct 2021 00:33:11 +0900 Subject: [PATCH 129/194] - Add Automatically Hide Plugin Info Border by SettingControl Height --- Flow.Launcher/SettingWindow.xaml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 38c739fb2..07882445c 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -636,7 +636,7 @@ ToolTip="Change Action Keywords" Margin="5 0 0 0" Cursor="Hand" FontWeight="Bold" Click="OnPluginActionKeywordsClick" HorizontalAlignment="Right" - Width="100" Height="32"> + Width="100" Height="40"> + + + + + From 2d98dcbfd8faa19706382febef4fda096a57c81c Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 10 Oct 2021 06:19:15 +0900 Subject: [PATCH 130/194] - Add Author name in plugin list --- Flow.Launcher/Languages/en.xaml | 2 +- Flow.Launcher/SettingWindow.xaml | 226 +++++++++++++++++++++++++++++++ 2 files changed, 227 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 79b8ce669..9d9e69785 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -53,7 +53,7 @@ New Priority: Priority Plugin Directory - Author + Author: Init time: Query time: diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index b0f596372..c875d652c 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -806,6 +806,232 @@ --> + + + + + + + + + +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 579f8c8b9eed6324b9924f6f35d1d9956e322658 Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 10 Oct 2021 06:19:15 +0900 Subject: [PATCH 131/194] - Add Author name in plugin list --- Flow.Launcher/Languages/en.xaml | 2 +- Flow.Launcher/SettingWindow.xaml | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 79b8ce669..9d9e69785 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -53,7 +53,7 @@ New Priority: Priority Plugin Directory - Author + Author: Init time: Query time: diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index b0f596372..7b45c7448 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -690,9 +690,16 @@ Padding="0 12 0 0" > - + + + + + From 8174d54de659ec4f1fb850c195114fbee1cdfba2 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 9 Oct 2021 17:58:40 -0500 Subject: [PATCH 132/194] Fix PriorityClick Logic Use sender to find actual pluginviewmodel instead of use selected --- Flow.Launcher/SettingWindow.xaml.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 9b5c34c44..4d36ec5da 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -13,6 +13,7 @@ using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.ViewModel; using Flow.Launcher.Helper; +using System.Windows.Controls; namespace Flow.Launcher { @@ -186,20 +187,18 @@ namespace Flow.Launcher private void OnPluginPriorityClick(object sender, RoutedEventArgs e) { - - - PriorityChangeWindow priorityChangeWindow = new PriorityChangeWindow(viewModel.SelectedPlugin.PluginPair.Metadata.ID, settings, viewModel.SelectedPlugin); + if (sender is Control { DataContext: PluginViewModel pluginViewModel }) + { + PriorityChangeWindow priorityChangeWindow = new PriorityChangeWindow(pluginViewModel.PluginPair.Metadata.ID, settings, pluginViewModel); priorityChangeWindow.ShowDialog(); - + } } private void OnPluginActionKeywordsClick(object sender, RoutedEventArgs e) { - - var id = viewModel.SelectedPlugin.PluginPair.Metadata.ID; - ActionKeywords changeKeywordsWindow = new ActionKeywords(id, settings, viewModel.SelectedPlugin); - changeKeywordsWindow.ShowDialog(); - + var id = viewModel.SelectedPlugin.PluginPair.Metadata.ID; + ActionKeywords changeKeywordsWindow = new ActionKeywords(id, settings, viewModel.SelectedPlugin); + changeKeywordsWindow.ShowDialog(); } private void OnPluginNameClick(object sender, MouseButtonEventArgs e) From 1e479edead18c1290327a908c49c34d5c326d852 Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 10 Oct 2021 12:39:58 +0900 Subject: [PATCH 133/194] - Add plugin store tab (WIP) --- Flow.Launcher/SettingWindow.xaml | 87 +++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index bedad7f91..f58b17963 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -229,7 +229,7 @@ - + @@ -241,7 +241,7 @@ - + @@ -257,6 +257,14 @@ + + @@ -741,6 +749,81 @@ + + + + + + + + + +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a3a436c58bf0d41629ad20992542d8a4b81c8a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Kubala?= <37414585+kubalav@users.noreply.github.com> Date: Sun, 10 Oct 2021 09:27:10 +0200 Subject: [PATCH 134/194] Update Slovak translation --- Flow.Launcher/Languages/sk.xaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index 5e63020a8..b766ccfa2 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -82,6 +82,8 @@ Ste si istý, že chcete odstrániť klávesovú skratku {0} pre plugin? Tieňový efekt v poli vyhľadávania Tieňový efekt významne využíva GPU. Neodporúča sa, ak je výkon počítača obmedzený. + Použiť ikony Segoe Fluent + Použiť ikony Segoe Fluent, ak sú podporované HTTP Proxy @@ -178,4 +180,4 @@ Aktualizovať súbory Aktualizovať popis - \ No newline at end of file + From 876d477f25cde4ee00c10ce56efd87e0aaa12df2 Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 10 Oct 2021 22:21:32 +0900 Subject: [PATCH 135/194] - Add install button with hover --- Flow.Launcher/SettingWindow.xaml | 154 +++++++++++++++++++++++++++---- 1 file changed, 134 insertions(+), 20 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index f58b17963..cb2146c53 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -260,10 +260,70 @@ @@ -785,34 +845,88 @@ Padding="0 0 0 0" Width="Auto" VerticalContentAlignment="Center" HorizontalAlignment="Stretch"> - + - - - - - - + + + + + + + - + + + - - + + + + - + - - + - + + + + + + + + + + + + + + + + + + From 4164b46f728cd413224f2811bf61996e88e14d29 Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Mon, 11 Oct 2021 02:22:39 +0900 Subject: [PATCH 136/194] Add author and version in hover menu. --- Flow.Launcher/SettingWindow.xaml | 37 ++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index cb2146c53..260ab4280 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -852,7 +852,7 @@ - + @@ -905,21 +905,30 @@ - + - + - From ccb565e70a39541d1032bef97d3e6fe235bab72e Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Mon, 11 Oct 2021 04:54:04 +0900 Subject: [PATCH 137/194] Responsive Width in Plugin Store List (WIP --- Flow.Launcher/SettingWindow.xaml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 260ab4280..c02c487a6 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -263,7 +263,9 @@ - + + + @@ -837,7 +839,7 @@ - - + + + + - + @@ -887,12 +892,12 @@ - + - - + + - - - - + + + + - - + + + - - - - + From 1317077dd8ab1102c97d93ad0477c255e4aa112b Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 17 Oct 2021 10:57:50 +0900 Subject: [PATCH 167/194] - Change the popup to windows notification --- Flow.Launcher/Msg.xaml.cs | 66 ++++++++++++--------------------------- 1 file changed, 20 insertions(+), 46 deletions(-) diff --git a/Flow.Launcher/Msg.xaml.cs b/Flow.Launcher/Msg.xaml.cs index 6bb2fc2dc..c6b26ccd5 100644 --- a/Flow.Launcher/Msg.xaml.cs +++ b/Flow.Launcher/Msg.xaml.cs @@ -5,59 +5,30 @@ using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; +using System.Windows.Media; using Flow.Launcher.Helper; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Image; +using Windows.UI; +using Windows.Data; +using Windows.Data.Xml.Dom; +using Windows.UI.Notifications; namespace Flow.Launcher { public partial class Msg : Window { - Storyboard fadeOutStoryboard = new Storyboard(); - private bool closing; public Msg() { InitializeComponent(); - var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); - var dipWorkingArea = WindowsInteropHelper.TransformPixelsToDIP(this, - screen.WorkingArea.Width, - screen.WorkingArea.Height); - Left = dipWorkingArea.X - Width; - Top = dipWorkingArea.Y; - showAnimation.From = dipWorkingArea.Y; - showAnimation.To = dipWorkingArea.Y - Height; - // Create the fade out storyboard - fadeOutStoryboard.Completed += fadeOutStoryboard_Completed; - DoubleAnimation fadeOutAnimation = new DoubleAnimation(dipWorkingArea.Y - Height, dipWorkingArea.Y, new Duration(TimeSpan.FromSeconds(5))) - { - AccelerationRatio = 0.2 - }; - Storyboard.SetTarget(fadeOutAnimation, this); - Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(TopProperty)); - fadeOutStoryboard.Children.Add(fadeOutAnimation); - - imgClose.Source = ImageLoader.Load(Path.Combine(Infrastructure.Constant.ProgramDirectory, "Images\\close.png")); - imgClose.MouseUp += imgClose_MouseUp; - } - - void imgClose_MouseUp(object sender, MouseButtonEventArgs e) - { - if (!closing) - { - closing = true; - fadeOutStoryboard.Begin(); - } - } - - private void fadeOutStoryboard_Completed(object sender, EventArgs e) - { - Close(); } public void Show(string title, string subTitle, string iconPath) { + + tbTitle.Text = title; tbSubTitle.Text = subTitle; if (string.IsNullOrEmpty(subTitle)) @@ -68,20 +39,23 @@ namespace Flow.Launcher { imgIco.Source = ImageLoader.Load(Path.Combine(Constant.ProgramDirectory, "Images\\app.png")); } - else { + else + { imgIco.Source = ImageLoader.Load(iconPath); } - Show(); + /* Using Windows Notification System */ + var ToastTitle = title; + var ToastsubTitle = subTitle; + var Icon = imgIco.Source; + var xml = $"\"meziantou\"/{ToastTitle}" + + $"{ToastsubTitle}"; + var toastXml = new XmlDocument(); + toastXml.LoadXml(xml); + var toast = new ToastNotification(toastXml); + ToastNotificationManager.CreateToastNotifier("Flow Launcher").Show(toast); - Dispatcher.InvokeAsync(async () => - { - if (!closing) - { - closing = true; - await Dispatcher.InvokeAsync(fadeOutStoryboard.Begin); - } - }); } + } } From 52b357952527ed9c1836b91ac2ac9cd53b229042 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 16 Oct 2021 21:28:55 -0500 Subject: [PATCH 168/194] Implement Install & Refresh Button - Add ShowMainWindow API for IPublicAPI --- Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 5 +++ Flow.Launcher/PublicAPIInstance.cs | 2 + Flow.Launcher/SettingWindow.xaml | 40 ++++++++++--------- Flow.Launcher/SettingWindow.xaml.cs | 17 ++++++++ .../ViewModel/SettingWindowViewModel.cs | 7 ++++ 5 files changed, 53 insertions(+), 18 deletions(-) diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index d9cdf5581..974eafa96 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -59,6 +59,11 @@ namespace Flow.Launcher.Plugin /// Optional message subtitle void ShowMsgError(string title, string subTitle = ""); + /// + /// Show the MainWindow when hiding + /// + void ShowMainWindow(); + /// /// Show message box /// diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 6f995671d..70d54619d 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -68,6 +68,8 @@ namespace Flow.Launcher public void RestarApp() => RestartApp(); + public void ShowMainWindow() => _mainVM.MainWindowVisibility = Visibility.Visible; + public void CheckForNewUpdate() => _settingsVM.UpdateApp(); public void SaveAppAllSettings() diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 8a5feb866..8aaef7054 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -37,7 +37,7 @@ - + - @@ -998,7 +999,10 @@ - @@ -1079,7 +1083,7 @@ + Visibility="Visible" /> @@ -1112,7 +1116,7 @@ - + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 4d36ec5da..4b58b9c6a 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -14,6 +14,7 @@ using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.ViewModel; using Flow.Launcher.Helper; using System.Windows.Controls; +using Flow.Launcher.Core.ExternalPlugins; namespace Flow.Launcher { @@ -264,6 +265,22 @@ namespace Flow.Launcher FilesFolders.OpenPath(Path.Combine(DataLocation.DataDirectory(), Constant.Themes)); } + private void OnPluginStoreRefreshClick(object sender, RoutedEventArgs e) + { + _ = viewModel.RefreshExternalPluginsAsync(); + } + + private void OnExternalPluginInstallClick(object sender, RoutedEventArgs e) + { + if(sender is Button { DataContext: UserPlugin plugin }) + { + var pluginsManagerPlugin = PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"); + var actionKeywrod = pluginsManagerPlugin.Metadata.ActionKeywords.Count == 0 ? "" : pluginsManagerPlugin.Metadata.ActionKeywords[0]; + API.ChangeQuery($"{actionKeywrod} install {plugin.Name}"); + API.ShowMainWindow(); + } + } + /* private void OnPluginActionKeywordsClick(object sender, RoutedEventArgs e) { diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 7f16da8ae..6bbf22c41 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; +using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -265,6 +266,12 @@ namespace Flow.Launcher.ViewModel } } + public async Task RefreshExternalPluginsAsync() + { + await PluginsManifest.UpdateManifestAsync(); + OnPropertyChanged(nameof(ExternalPlugins)); + } + #endregion From da12a0616f461567bce4429a986ac3b10753669e Mon Sep 17 00:00:00 2001 From: Dobin Park Date: Sun, 17 Oct 2021 11:44:25 +0900 Subject: [PATCH 169/194] Add style for toggle button --- Flow.Launcher/SettingWindow.xaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 8aaef7054..e6612e4dc 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -37,7 +37,6 @@ - + + - - - - - - - - - + + + + + + + + + + + - + - + - - - - + + + - - - + + - - - + + + + - - - + + + - + - - - - - - - - + + + + + + - + - + - - + - - + - - - - - - - - - - - - + - - + - - + + + - - - + + - - - + + + + @@ -912,125 +915,128 @@ BorderThickness="1 1 1 2"/> - + - - - - - - - - + Padding="0 0 0 0" Width="Auto" VerticalContentAlignment="Center" HorizontalAlignment="Stretch"> + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + - - - - - - + + + + + - + - + - - - - - + + + + + - - - - - - - + + + + + + + - - - + + - - - - + + + - + + - - - - - - - + + + + + - - - - + + + + + From 3bacb3fc0753ccb0c77814de465e120826df3063 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 21 Oct 2021 22:29:03 -0500 Subject: [PATCH 179/194] Revert "add scroll movement with drag" This reverts commit f6d4736f1ab8766822f1d394d7dc3b3f4418110a. --- Flow.Launcher/SettingWindow.xaml | 444 +++++++++++++++---------------- 1 file changed, 219 insertions(+), 225 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 7c09a8d0f..a28886094 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -658,105 +658,103 @@ - - - - - - - - - - + + + + + + + + - - + - - - - - - - - + + + + + + + - - - - + + - + - - - - + + + - - - - - + + + + + + + + + + + - + - + - - - - + + + - - - + + - - - + + + + - - - + + + - + - - - - - - - - + + + + + + - + - + - - + - - + - - - - - - - - - - - - + - - + - - + + - - - + + + - - - - + + + @@ -915,128 +912,125 @@ BorderThickness="1 1 1 2"/> - - - - - - - - - - + ScrollViewer.IsDeferredScrollingEnabled="True" ScrollViewer.CanContentScroll="False" + Padding="0 0 0 0" Width="Auto" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" ui:ScrollViewerHelper.AutoHideScrollBars="{Binding AutoHideScrollBar, Mode=OneWay}"> + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + - - - - - - + + + + + - + - + - - - - - + + + + + - - - - - - - + + + + + + + - - - + + - - - - + + + - - + - - - - - - + + + + + - - - - - + + + + From 82464b79c511030713f21af05b1f2a171282f36b Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 21 Oct 2021 22:31:33 -0500 Subject: [PATCH 180/194] Remove deferred scroll option to enable direct scrolling --- Flow.Launcher/SettingWindow.xaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index a28886094..2dcc2fa02 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -662,7 +662,6 @@ ItemsSource="{Binding PluginViewModels}" Margin="5, 0, 0, 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource PluginList}" - ScrollViewer.IsDeferredScrollingEnabled="True" ScrollViewer.CanContentScroll="False" Padding="0 0 7 0" Width="Auto" HorizontalAlignment="Stretch" SnapsToDevicePixels="True" ui:ScrollViewerHelper.AutoHideScrollBars="{Binding AutoHideScrollBar, Mode=OneWay}"> @@ -916,7 +915,6 @@ ItemsSource="{Binding ExternalPlugins}" Margin="6, 0, 0, 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource StoreList}" SelectionMode="Single" - ScrollViewer.IsDeferredScrollingEnabled="True" ScrollViewer.CanContentScroll="False" Padding="0 0 0 0" Width="Auto" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" ui:ScrollViewerHelper.AutoHideScrollBars="{Binding AutoHideScrollBar, Mode=OneWay}"> From 799ed81ef22106252a37462a3f9cea728c752eda Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sat, 23 Oct 2021 05:44:12 -0400 Subject: [PATCH 181/194] Update en.xaml --- Flow.Launcher/Languages/en.xaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 1dd6d3889..1e12c3d4e 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -19,29 +19,29 @@ Flow Launcher Settings General Portable Mode - All setting into single folder. You can use with USB drive or cloud. + Store all settings and user data in a central folder. Compatible with most removeable drives and cloud services. Start Flow Launcher on system startup Hide Flow Launcher when focus is lost Do not show new version notifications Remember last launch location Language Last Query Style - When you open Query box, decide what to do. + Show/Hide previous results when Flow Launcher is reactivated. Preserve Last Query Select last Query Empty last Query Maximum results shown Ignore hotkeys in fullscreen mode - If you're a gamer, We recommend turning it on. + Disable Flow Launcher activation when a Full screen application is active (Recommended for games). Python Directory Auto Update Auto Hide Scroll Bar in Setting - If you feel the scroll bar in the setting window is small, We recommend turning it off. + Hide the scroll bar when not in use. Select Hide Flow Launcher on startup Hide tray icon Query Search Precision - Search results become more accurate. + Changes minimum match score required for results. Should Use Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese Shadow effect is not allowed while current theme has blur effect enabled @@ -84,11 +84,11 @@ Hotkey Flow Launcher Hotkey - Enter the shortcut that open the Flow Launcher. + Enter shortcut to show/hide Flow Launcher. Open Result Modifiers - Shortcuts to select the result list. + Select a modifier to action results via keyboard. Show Hotkey - Display Shortcut in Result list . + Show result modifier with results. Custom Query Hotkey Query Delete @@ -197,4 +197,4 @@ Update files Update description - \ No newline at end of file + From e5a7c862b84790db7250ebaa8a8d7c122f847ab8 Mon Sep 17 00:00:00 2001 From: DB p Date: Sat, 23 Oct 2021 18:59:42 +0900 Subject: [PATCH 182/194] - remove AutoHideScrollbar tooltip --- Flow.Launcher/Languages/en.xaml | 1 - Flow.Launcher/Languages/ko.xaml | 1 - Flow.Launcher/SettingWindow.xaml | 2 -- 3 files changed, 4 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 1e12c3d4e..5c27fd74b 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -36,7 +36,6 @@ Python Directory Auto Update Auto Hide Scroll Bar in Setting - Hide the scroll bar when not in use. Select Hide Flow Launcher on startup Hide tray icon diff --git a/Flow.Launcher/Languages/ko.xaml b/Flow.Launcher/Languages/ko.xaml index 6a145d670..79c7c12f7 100644 --- a/Flow.Launcher/Languages/ko.xaml +++ b/Flow.Launcher/Languages/ko.xaml @@ -36,7 +36,6 @@ Python 디렉토리 자동 업데이트 설정 창 스크롤바 숨기기 - 설정 창 스크롤바가 작다면 끄는 것을 추천합니다. 선택 시작 시 Flow Launcher 숨김 트레이 아이콘 숨기기 diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 2dcc2fa02..980430b64 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -620,8 +620,6 @@ - Date: Sat, 23 Oct 2021 19:41:21 +0900 Subject: [PATCH 183/194] Remove Auto HIde Scrollbar section --- Flow.Launcher/SettingWindow.xaml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 980430b64..fe5339045 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -615,17 +615,6 @@ DisplayMemberPath="Display" SelectedValuePath="LanguageCode" Grid.Column="2" /> - - - - - - - - From 1a5116023e1484cdc978302b36688092f88ff466 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 26 Oct 2021 06:41:25 +1100 Subject: [PATCH 184/194] remove auto hiding of setting window's scrollbar related 925f6bc55bd4b674951c02de4ffb7d472b1d8228, a452feb4c678ab1d8e8f9bce3919e91ef08edc22 --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 2 -- Flow.Launcher/Languages/en.xaml | 1 - Flow.Launcher/Languages/ko.xaml | 1 - Flow.Launcher/Languages/sk.xaml | 2 -- Flow.Launcher/SettingWindow.xaml | 8 ++------ Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 6 ------ 6 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 907314ba8..102446158 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -99,8 +99,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool RememberLastLaunchLocation { get; set; } public bool IgnoreHotkeysOnFullscreen { get; set; } - public bool AutoHideScrollBar { get; set; } - public HttpProxy Proxy { get; set; } = new HttpProxy(); [JsonConverter(typeof(JsonStringEnumConverter))] diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 5c27fd74b..8baab8355 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -35,7 +35,6 @@ Disable Flow Launcher activation when a Full screen application is active (Recommended for games). Python Directory Auto Update - Auto Hide Scroll Bar in Setting Select Hide Flow Launcher on startup Hide tray icon diff --git a/Flow.Launcher/Languages/ko.xaml b/Flow.Launcher/Languages/ko.xaml index 79c7c12f7..649895cea 100644 --- a/Flow.Launcher/Languages/ko.xaml +++ b/Flow.Launcher/Languages/ko.xaml @@ -35,7 +35,6 @@ 게이머라면 켜는 것을 추천합니다. Python 디렉토리 자동 업데이트 - 설정 창 스크롤바 숨기기 선택 시작 시 Flow Launcher 숨김 트레이 아이콘 숨기기 diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index b766ccfa2..70a5d3b7c 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -31,8 +31,6 @@ Ignorovať klávesové skratky v režime na celú obrazovku Priečinok s Pythonom Automatická aktualizácia - Automaticky skryť posuvník - Automaticky skrývať posuvník v okne nastavení a zobraziť ho, keď naň prejdete myšou Vybrať Schovať Flow Launcher po spustení Schovať ikonu z oblasti oznámení diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index fe5339045..8fc214da7 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -401,7 +401,6 @@ + Padding="0 0 7 0" Width="Auto" HorizontalAlignment="Stretch" SnapsToDevicePixels="True"> @@ -902,7 +901,7 @@ ItemsSource="{Binding ExternalPlugins}" Margin="6, 0, 0, 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemContainerStyle="{StaticResource StoreList}" SelectionMode="Single" - Padding="0 0 0 0" Width="Auto" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" ui:ScrollViewerHelper.AutoHideScrollBars="{Binding AutoHideScrollBar, Mode=OneWay}"> + Padding="0 0 0 0" Width="Auto" VerticalContentAlignment="Center" HorizontalAlignment="Stretch"> @@ -1038,7 +1037,6 @@ @@ -1314,7 +1312,6 @@ @@ -1442,7 +1439,6 @@ diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 6bbf22c41..dde540b0c 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -63,12 +63,6 @@ namespace Flow.Launcher.ViewModel } } - public bool AutoHideScrollBar - { - get => Settings.AutoHideScrollBar; - set => Settings.AutoHideScrollBar = value; - } - // This is only required to set at startup. When portable mode enabled/disabled a restart is always required private bool _portableMode = DataLocation.PortableDataLocationInUse(); public bool PortableMode From 6e6db2c67b835e04621852b4eb458981e19cc475 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Mon, 25 Oct 2021 17:52:45 -0500 Subject: [PATCH 185/194] fix iconpath other than default icon --- Flow.Launcher/Notification.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Notification.cs b/Flow.Launcher/Notification.cs index 8933dc95e..b6aba7727 100644 --- a/Flow.Launcher/Notification.cs +++ b/Flow.Launcher/Notification.cs @@ -19,8 +19,8 @@ namespace Flow.Launcher { /* Using Windows Notification System */ var Icon = !File.Exists(iconPath) - ? ImageLoader.Load(Path.Combine(Constant.ProgramDirectory, "Images\\app.png")) - : ImageLoader.Load(iconPath); + ? Path.Combine(Constant.ProgramDirectory, "Images\\app.png") + : iconPath; var xml = $"\"meziantou\"/{title}" + $"{subTitle}"; From 8a59e87f997db2f4991de4786c5e2aa5bd7272d5 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Mon, 25 Oct 2021 18:51:34 -0500 Subject: [PATCH 186/194] Fix unselected issue for bookmark plugin by using binding (Don't understand Reason it doesn't work before) --- .../Views/SettingsControl.xaml | 12 ++++---- .../Views/SettingsControl.xaml.cs | 30 +++++++++++-------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml index 7b7ccbeea..abe1f0ad5 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml @@ -22,12 +22,12 @@ diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs index 2f67b999c..56fa58acf 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml.cs @@ -3,34 +3,38 @@ using System.Windows; using System.Windows.Controls; using Flow.Launcher.Plugin.BrowserBookmark.Models; using System.Windows.Input; +using System.ComponentModel; namespace Flow.Launcher.Plugin.BrowserBookmark.Views { /// /// Interaction logic for BrowserBookmark.xaml /// - public partial class SettingsControl + public partial class SettingsControl : INotifyPropertyChanged { public Settings Settings { get; } public CustomBrowser SelectedCustomBrowser { get; set; } + public bool OpenInNewBrowserWindow + { + get => Settings.OpenInNewBrowserWindow; + set + { + Settings.OpenInNewBrowserWindow = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OpenInNewBrowserWindow))); + } + } + public bool OpenInNewTab + { + get => !OpenInNewBrowserWindow; + } public SettingsControl(Settings settings) { Settings = settings; InitializeComponent(); - NewWindowBrowser.IsChecked = Settings.OpenInNewBrowserWindow; - NewTabInBrowser.IsChecked = !Settings.OpenInNewBrowserWindow; } - private void OnNewBrowserWindowClick(object sender, RoutedEventArgs e) - { - Settings.OpenInNewBrowserWindow = true; - } - - private void OnNewTabClick(object sender, RoutedEventArgs e) - { - Settings.OpenInNewBrowserWindow = false; - } + public event PropertyChangedEventHandler PropertyChanged; private void OnChooseClick(object sender, RoutedEventArgs e) { @@ -61,7 +65,7 @@ namespace Flow.Launcher.Plugin.BrowserBookmark.Views private void DeleteCustomBrowser(object sender, RoutedEventArgs e) { - if(CustomBrowsers.SelectedItem is CustomBrowser selectedCustomBrowser) + if (CustomBrowsers.SelectedItem is CustomBrowser selectedCustomBrowser) { Settings.CustomChromiumBrowsers.Remove(selectedCustomBrowser); } From 5487834ed02626cd4836b6e95488d8205b37ed47 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Mon, 25 Oct 2021 19:02:22 -0500 Subject: [PATCH 187/194] Add back field to avoid duplicate plugin control loading --- Flow.Launcher/SettingWindow.xaml | 4 ++-- Flow.Launcher/ViewModel/PluginViewModel.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 8fc214da7..ac6138644 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -774,7 +774,7 @@