diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..6abd850ed --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,23 @@ +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v4 + with: + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + days-before-stale: 30 + days-before-close: 5 + days-before-pr-close: -1 + exempt-all-milestones: true + close-issue-message: 'This issue was closed because it has been stale for 5 days with no activity. If you feel this issue still needs attention please feel free to reopen.' \ No newline at end of file diff --git a/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs b/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs index a9585f6a4..fab1b3e8f 100644 --- a/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs +++ b/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs @@ -2,6 +2,8 @@ using Flow.Launcher.Infrastructure.Logger; using System; using System.Collections.Generic; +using System.Net; +using System.Net.Http; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -10,43 +12,43 @@ namespace Flow.Launcher.Core.ExternalPlugins { public static class PluginsManifest { - static PluginsManifest() - { - UpdateTask = UpdateManifestAsync(); - } - - public static List UserPlugins { get; private set; } = new List(); - - public static Task UpdateTask { get; private set; } + private const string manifestFileUrl = "https://cdn.jsdelivr.net/gh/Flow-Launcher/Flow.Launcher.PluginsManifest@plugin_api_v2/plugins.json"; private static readonly SemaphoreSlim manifestUpdateLock = new(1); - public static Task UpdateManifestAsync() - { - if (manifestUpdateLock.CurrentCount == 0) - { - return UpdateTask; - } + private static string latestEtag = ""; - return UpdateTask = DownloadManifestAsync(); - } + public static List UserPlugins { get; private set; } = new List(); - private static async Task DownloadManifestAsync() + public static async Task UpdateManifestAsync(CancellationToken token = default) { try { - await manifestUpdateLock.WaitAsync().ConfigureAwait(false); + await manifestUpdateLock.WaitAsync(token).ConfigureAwait(false); - await using var jsonStream = await Http.GetStreamAsync("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json") - .ConfigureAwait(false); + var request = new HttpRequestMessage(HttpMethod.Get, manifestFileUrl); + request.Headers.Add("If-None-Match", latestEtag); - UserPlugins = await JsonSerializer.DeserializeAsync>(jsonStream).ConfigureAwait(false); + var response = await Http.SendAsync(request, token).ConfigureAwait(false); + + if (response.StatusCode == HttpStatusCode.OK) + { + Log.Info($"|PluginsManifest.{nameof(UpdateManifestAsync)}|Fetched plugins from manifest repo"); + + var json = await response.Content.ReadAsStreamAsync(token).ConfigureAwait(false); + + UserPlugins = await JsonSerializer.DeserializeAsync>(json, cancellationToken: token).ConfigureAwait(false); + + latestEtag = response.Headers.ETag.Tag; + } + else if (response.StatusCode != HttpStatusCode.NotModified) + { + Log.Warn($"|PluginsManifest.{nameof(UpdateManifestAsync)}|Http response for manifest file was {response.StatusCode}"); + } } catch (Exception e) { - Log.Exception("|PluginManagement.GetManifest|Encountered error trying to download plugins manifest", e); - - UserPlugins = new List(); + Log.Exception($"|PluginsManifest.{nameof(UpdateManifestAsync)}|Http request failed", e); } finally { diff --git a/Flow.Launcher.Core/Flow.Launcher.Core.csproj b/Flow.Launcher.Core/Flow.Launcher.Core.csproj index 60c4ec3de..fdd23a0d2 100644 --- a/Flow.Launcher.Core/Flow.Launcher.Core.csproj +++ b/Flow.Launcher.Core/Flow.Launcher.Core.csproj @@ -1,7 +1,7 @@  - net5.0-windows + net6.0-windows true true Library @@ -53,7 +53,7 @@ - + diff --git a/Flow.Launcher.Core/Plugin/PluginAssemblyLoader.cs b/Flow.Launcher.Core/Plugin/PluginAssemblyLoader.cs index 515b0bedc..9d76b6be0 100644 --- a/Flow.Launcher.Core/Plugin/PluginAssemblyLoader.cs +++ b/Flow.Launcher.Core/Plugin/PluginAssemblyLoader.cs @@ -15,20 +15,6 @@ namespace Flow.Launcher.Core.Plugin private readonly AssemblyName assemblyName; - private static readonly ConcurrentDictionary loadedAssembly; - - static PluginAssemblyLoader() - { - var currentAssemblies = AppDomain.CurrentDomain.GetAssemblies(); - loadedAssembly = new ConcurrentDictionary( - currentAssemblies.Select(x => new KeyValuePair(x.FullName, default))); - - AppDomain.CurrentDomain.AssemblyLoad += (sender, args) => - { - loadedAssembly[args.LoadedAssembly.FullName] = default; - }; - } - internal PluginAssemblyLoader(string assemblyFilePath) { dependencyResolver = new AssemblyDependencyResolver(assemblyFilePath); @@ -47,10 +33,9 @@ namespace Flow.Launcher.Core.Plugin // When resolving dependencies, ignore assembly depenedencies that already exits with Flow.Launcher // Otherwise duplicate assembly will be loaded and some weird behavior will occur, such as WinRT.Runtime.dll // will fail due to loading multiple versions in process, each with their own static instance of registration state - if (assemblyPath == null || ExistsInReferencedPackage(assemblyName)) - return null; + var existAssembly = Default.Assemblies.FirstOrDefault(x => x.FullName == assemblyName.FullName); - return LoadFromAssemblyPath(assemblyPath); + return existAssembly ?? (assemblyPath == null ? null : LoadFromAssemblyPath(assemblyPath)); } internal Type FromAssemblyGetTypeOfInterface(Assembly assembly, Type type) @@ -58,10 +43,5 @@ namespace Flow.Launcher.Core.Plugin var allTypes = assembly.ExportedTypes; return allTypes.First(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Any(t => t == type)); } - - internal bool ExistsInReferencedPackage(AssemblyName assemblyName) - { - return loadedAssembly.ContainsKey(assemblyName.FullName); - } } } \ No newline at end of file diff --git a/Flow.Launcher.Core/Resource/AvailableLanguages.cs b/Flow.Launcher.Core/Resource/AvailableLanguages.cs index 0ad7ede1e..f541d3f35 100644 --- a/Flow.Launcher.Core/Resource/AvailableLanguages.cs +++ b/Flow.Launcher.Core/Resource/AvailableLanguages.cs @@ -19,6 +19,8 @@ namespace Flow.Launcher.Core.Resource public static Language Serbian = new Language("sr", "Srpski"); public static Language Portuguese_Portugal = new Language("pt-pt", "Português"); public static Language Portuguese_Brazil = new Language("pt-br", "Português (Brasil)"); + public static Language Spanish = new Language("es", "Spanish"); + public static Language Spanish_LatinAmerica = new Language("es-419", "Spanish (Latin America)"); public static Language Italian = new Language("it", "Italiano"); public static Language Norwegian_Bokmal = new Language("nb-NO", "Norsk Bokmål"); public static Language Slovak = new Language("sk", "Slovenský"); @@ -43,6 +45,8 @@ namespace Flow.Launcher.Core.Resource Serbian, Portuguese_Portugal, Portuguese_Brazil, + Spanish, + Spanish_LatinAmerica, Italian, Norwegian_Bokmal, Slovak, diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj index 40c2cb956..930cf0b91 100644 --- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj +++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj @@ -1,7 +1,7 @@  - net5.0-windows + net6.0-windows {4FD29318-A8AB-4D8F-AA47-60BC241B8DA3} Library true diff --git a/Flow.Launcher.Infrastructure/Http/Http.cs b/Flow.Launcher.Infrastructure/Http/Http.cs index b45b6adcd..9f4146b7b 100644 --- a/Flow.Launcher.Infrastructure/Http/Http.cs +++ b/Flow.Launcher.Infrastructure/Http/Http.cs @@ -153,5 +153,13 @@ namespace Flow.Launcher.Infrastructure.Http var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token); return await response.Content.ReadAsStreamAsync(); } + + /// + /// Asynchrously send an HTTP request. + /// + public static async Task SendAsync(HttpRequestMessage request, CancellationToken token = default) + { + return await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, token); + } } } diff --git a/Flow.Launcher.Infrastructure/Image/ImageCache.cs b/Flow.Launcher.Infrastructure/Image/ImageCache.cs index 13277c7d9..04e11bf1a 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageCache.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageCache.cs @@ -74,7 +74,7 @@ namespace Flow.Launcher.Infrastructure.Image // To delete the images from the data dictionary based on the resizing of the Usage Dictionary // Double Check to avoid concurrent remove if (Data.Count > permissibleFactor * MaxCached) - foreach (var key in Data.OrderBy(x => x.Value.usage).Take(Data.Count - MaxCached).Select(x => x.Key).ToArray()) + foreach (var key in Data.OrderBy(x => x.Value.usage).Take(Data.Count - MaxCached).Select(x => x.Key)) Data.TryRemove(key, out _); semaphore.Release(); } diff --git a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj index 6bab0583d..41072993c 100644 --- a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj +++ b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj @@ -1,7 +1,7 @@ - net5.0-windows + net6.0-windows {8451ECDD-2EA4-4966-BB0A-7BBC40138E80} true Library @@ -14,10 +14,10 @@ - 2.1.1 - 2.1.1 - 2.1.1 - 2.1.1 + 3.0.0 + 3.0.0 + 3.0.0 + 3.0.0 Flow.Launcher.Plugin Flow-Launcher MIT diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index 133ad25a5..69057820e 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -228,8 +228,27 @@ namespace Flow.Launcher.Plugin public void OpenDirectory(string DirectoryPath, string FileName = null); /// - /// Opens the url. The browser and mode used is based on what's configured in Flow's default browser settings. + /// Opens the URL with the given Uri object. + /// The browser and mode used is based on what's configured in Flow's default browser settings. + /// + public void OpenUrl(Uri url, bool? inPrivate = null); + + /// + /// Opens the URL with the given string. + /// The browser and mode used is based on what's configured in Flow's default browser settings. + /// Non-C# plugins should use this method. /// public void OpenUrl(string url, bool? inPrivate = null); + + /// + /// Opens the application URI with the given Uri object, e.g. obsidian://search-query-example + /// + public void OpenAppUri(Uri appUri); + + /// + /// Opens the application URI with the given string, e.g. obsidian://search-query-example + /// Non-C# plugins should use this method + /// + public void OpenAppUri(string appUri); } } diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index fe80292be..4a5eb39af 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -29,6 +29,13 @@ namespace Flow.Launcher.Plugin /// public string ActionKeywordAssigned { get; set; } + /// + /// This holds the text which can be provided by plugin to be copied to the + /// user's clipboard when Ctrl + C is pressed on a result. If the text is a file/directory path + /// flow will copy the actual file/folder instead of just the path text. + /// + public string CopyText { get; set; } = string.Empty; + /// /// This holds the text which can be provided by plugin to help Flow autocomplete text /// for user on the plugin result. If autocomplete action for example is tab, pressing tab will have diff --git a/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs b/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs index 6c4ac8ebf..6588132b9 100644 --- a/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs +++ b/Flow.Launcher.Plugin/SharedCommands/SearchWeb.cs @@ -60,7 +60,7 @@ namespace Flow.Launcher.Plugin.SharedCommands try { - Process.Start(psi); + Process.Start(psi)?.Dispose(); } catch (System.ComponentModel.Win32Exception) { @@ -100,7 +100,7 @@ namespace Flow.Launcher.Plugin.SharedCommands psi.FileName = url; } - Process.Start(psi); + Process.Start(psi)?.Dispose(); } // This error may be thrown if browser path is incorrect catch (System.ComponentModel.Win32Exception) diff --git a/Flow.Launcher.Test/Flow.Launcher.Test.csproj b/Flow.Launcher.Test/Flow.Launcher.Test.csproj index 8de0681c8..f429586ce 100644 --- a/Flow.Launcher.Test/Flow.Launcher.Test.csproj +++ b/Flow.Launcher.Test/Flow.Launcher.Test.csproj @@ -1,7 +1,7 @@  - net5.0-windows10.0.19041.0 + net6.0-windows10.0.19041.0 {FF742965-9A80-41A5-B042-D6C7D3A21708} Library Properties diff --git a/Flow.Launcher.Test/Plugins/JsonRPCPluginTest.cs b/Flow.Launcher.Test/Plugins/JsonRPCPluginTest.cs index 383650619..7231dfbe0 100644 --- a/Flow.Launcher.Test/Plugins/JsonRPCPluginTest.cs +++ b/Flow.Launcher.Test/Plugins/JsonRPCPluginTest.cs @@ -76,7 +76,7 @@ namespace Flow.Launcher.Test.Plugins [TestCaseSource(typeof(JsonRPCPluginTest), nameof(ResponseModelsSource))] public async Task GivenModel_WhenSerializeWithDifferentNamingPolicy_ThenExpectSameResult_Async(JsonRPCQueryResponseModel reference) { - var camelText = JsonSerializer.Serialize(reference, new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }); + var camelText = JsonSerializer.Serialize(reference, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }); var pascalText = JsonSerializer.Serialize(reference); diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index ea4b25f5e..4ebff16a9 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -153,7 +153,6 @@ namespace Flow.Launcher DispatcherUnhandledException += ErrorReporting.DispatcherUnhandledException; } - /// /// let exception throw as normal is better for Debug /// @@ -179,4 +178,4 @@ namespace Flow.Launcher Current.MainWindow.Show(); } } -} \ No newline at end of file +} diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index f431504c2..148179a7c 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -2,7 +2,7 @@ WinExe - net5.0-windows10.0.19041.0 + net6.0-windows10.0.19041.0 true true Flow.Launcher.App @@ -88,6 +88,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index 98327d8da..a3ad20f77 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -25,7 +25,7 @@ namespace Flow.Launcher.Helper internal static void OnToggleHotkey(object sender, HotkeyEventArgs args) { - if (!mainViewModel.GameModeStatus) + if (!mainViewModel.ShouldIgnoreHotkeys() && !mainViewModel.GameModeStatus) mainViewModel.ToggleFlowLauncher(); } diff --git a/Flow.Launcher/Images/Browser.png b/Flow.Launcher/Images/Browser.png index 619d1ad6a..5d475f82e 100644 Binary files a/Flow.Launcher/Images/Browser.png and b/Flow.Launcher/Images/Browser.png differ diff --git a/Flow.Launcher/Images/EXE.png b/Flow.Launcher/Images/EXE.png index e4c789689..ecc91bdb3 100644 Binary files a/Flow.Launcher/Images/EXE.png and b/Flow.Launcher/Images/EXE.png differ diff --git a/Flow.Launcher/Images/Link.png b/Flow.Launcher/Images/Link.png index c0c3607bd..3218c94c9 100644 Binary files a/Flow.Launcher/Images/Link.png and b/Flow.Launcher/Images/Link.png differ diff --git a/Flow.Launcher/Images/New Message.png b/Flow.Launcher/Images/New Message.png index 2dd2c45f2..fec9a7182 100644 Binary files a/Flow.Launcher/Images/New Message.png and b/Flow.Launcher/Images/New Message.png differ diff --git a/Flow.Launcher/Images/app_missing_img.png b/Flow.Launcher/Images/app_missing_img.png index 11d5466f0..b86c29ac9 100644 Binary files a/Flow.Launcher/Images/app_missing_img.png and b/Flow.Launcher/Images/app_missing_img.png differ diff --git a/Flow.Launcher/Images/calculator.png b/Flow.Launcher/Images/calculator.png index 102a86bde..4bdade8b7 100644 Binary files a/Flow.Launcher/Images/calculator.png and b/Flow.Launcher/Images/calculator.png differ diff --git a/Flow.Launcher/Images/cancel.png b/Flow.Launcher/Images/cancel.png index 022fbc197..69ec5a969 100644 Binary files a/Flow.Launcher/Images/cancel.png and b/Flow.Launcher/Images/cancel.png differ diff --git a/Flow.Launcher/Images/close.png b/Flow.Launcher/Images/close.png index 17c4363ad..2fb501a40 100644 Binary files a/Flow.Launcher/Images/close.png and b/Flow.Launcher/Images/close.png differ diff --git a/Flow.Launcher/Images/cmd.png b/Flow.Launcher/Images/cmd.png index 686583653..0ec0122d4 100644 Binary files a/Flow.Launcher/Images/cmd.png and b/Flow.Launcher/Images/cmd.png differ diff --git a/Flow.Launcher/Images/color.png b/Flow.Launcher/Images/color.png index da28583b1..a4301c9af 100644 Binary files a/Flow.Launcher/Images/color.png and b/Flow.Launcher/Images/color.png differ diff --git a/Flow.Launcher/Images/copy.png b/Flow.Launcher/Images/copy.png index 8f1fca752..bf12c186e 100644 Binary files a/Flow.Launcher/Images/copy.png and b/Flow.Launcher/Images/copy.png differ diff --git a/Flow.Launcher/Images/down.png b/Flow.Launcher/Images/down.png index 2349d8917..59d8ac7f3 100644 Binary files a/Flow.Launcher/Images/down.png and b/Flow.Launcher/Images/down.png differ diff --git a/Flow.Launcher/Images/file.png b/Flow.Launcher/Images/file.png index 36156767a..63058fd8e 100644 Binary files a/Flow.Launcher/Images/file.png and b/Flow.Launcher/Images/file.png differ diff --git a/Flow.Launcher/Images/find.png b/Flow.Launcher/Images/find.png index a3f0be1f5..017ebf5f2 100644 Binary files a/Flow.Launcher/Images/find.png and b/Flow.Launcher/Images/find.png differ diff --git a/Flow.Launcher/Images/folder.png b/Flow.Launcher/Images/folder.png index 569fa7049..2ae7250a2 100644 Binary files a/Flow.Launcher/Images/folder.png and b/Flow.Launcher/Images/folder.png differ diff --git a/Flow.Launcher/Images/history.png b/Flow.Launcher/Images/history.png index 2a3b72dc4..b298f8c82 100644 Binary files a/Flow.Launcher/Images/history.png and b/Flow.Launcher/Images/history.png differ diff --git a/Flow.Launcher/Images/image.png b/Flow.Launcher/Images/image.png index 7fc14c38e..9f26517e8 100644 Binary files a/Flow.Launcher/Images/image.png and b/Flow.Launcher/Images/image.png differ diff --git a/Flow.Launcher/Images/lock.png b/Flow.Launcher/Images/lock.png index 4aef7007b..daefde98e 100644 Binary files a/Flow.Launcher/Images/lock.png and b/Flow.Launcher/Images/lock.png differ diff --git a/Flow.Launcher/Images/logoff.png b/Flow.Launcher/Images/logoff.png index 0d1378830..4973b66d8 100644 Binary files a/Flow.Launcher/Images/logoff.png and b/Flow.Launcher/Images/logoff.png differ diff --git a/Flow.Launcher/Images/ok.png b/Flow.Launcher/Images/ok.png index f2dde98ef..945cceed3 100644 Binary files a/Flow.Launcher/Images/ok.png and b/Flow.Launcher/Images/ok.png differ diff --git a/Flow.Launcher/Images/open.png b/Flow.Launcher/Images/open.png index b5c7a0e19..817eb9269 100644 Binary files a/Flow.Launcher/Images/open.png and b/Flow.Launcher/Images/open.png differ diff --git a/Flow.Launcher/Images/plugin.png b/Flow.Launcher/Images/plugin.png index 6ff9b8b15..b213f0b04 100644 Binary files a/Flow.Launcher/Images/plugin.png and b/Flow.Launcher/Images/plugin.png differ diff --git a/Flow.Launcher/Images/recyclebin.png b/Flow.Launcher/Images/recyclebin.png index 2cc3b0116..878a02189 100644 Binary files a/Flow.Launcher/Images/recyclebin.png and b/Flow.Launcher/Images/recyclebin.png differ diff --git a/Flow.Launcher/Images/restart.png b/Flow.Launcher/Images/restart.png index aaa2ee711..ffdb6745e 100644 Binary files a/Flow.Launcher/Images/restart.png and b/Flow.Launcher/Images/restart.png differ diff --git a/Flow.Launcher/Images/search.png b/Flow.Launcher/Images/search.png index a3f0be1f5..017ebf5f2 100644 Binary files a/Flow.Launcher/Images/search.png and b/Flow.Launcher/Images/search.png differ diff --git a/Flow.Launcher/Images/settings.png b/Flow.Launcher/Images/settings.png index c61729fe0..79691ed95 100644 Binary files a/Flow.Launcher/Images/settings.png and b/Flow.Launcher/Images/settings.png differ diff --git a/Flow.Launcher/Images/shutdown.png b/Flow.Launcher/Images/shutdown.png index 7da7a528d..50d157efd 100644 Binary files a/Flow.Launcher/Images/shutdown.png and b/Flow.Launcher/Images/shutdown.png differ diff --git a/Flow.Launcher/Images/sleep.png b/Flow.Launcher/Images/sleep.png index 42426286d..3ca80f9fa 100644 Binary files a/Flow.Launcher/Images/sleep.png and b/Flow.Launcher/Images/sleep.png differ diff --git a/Flow.Launcher/Images/up.png b/Flow.Launcher/Images/up.png index e68def0b5..6940d80ad 100644 Binary files a/Flow.Launcher/Images/up.png and b/Flow.Launcher/Images/up.png differ diff --git a/Flow.Launcher/Images/update.png b/Flow.Launcher/Images/update.png index 6fe579091..3f0b6aa9b 100644 Binary files a/Flow.Launcher/Images/update.png and b/Flow.Launcher/Images/update.png differ diff --git a/Flow.Launcher/Languages/da.xaml b/Flow.Launcher/Languages/da.xaml index 19e1951d8..9a6e6ebf4 100644 --- a/Flow.Launcher/Languages/da.xaml +++ b/Flow.Launcher/Languages/da.xaml @@ -126,8 +126,8 @@ Opdater Annuler Denne opdatering vil genstarte Flow Launcher - Følgende filer bliver opdateret + Følgende filer bliver opdateret Opdatereringsfiler - Opdateringsbeskrivelse + Opdateringsbeskrivelse diff --git a/Flow.Launcher/Languages/de.xaml b/Flow.Launcher/Languages/de.xaml index 39dc9b377..9572db8cb 100644 --- a/Flow.Launcher/Languages/de.xaml +++ b/Flow.Launcher/Languages/de.xaml @@ -126,8 +126,8 @@ Aktualisieren Abbrechen Diese Aktualisierung wird Flow Launcher neu starten - Folgende Dateien werden aktualisiert + Folgende Dateien werden aktualisiert Aktualisiere Dateien - Aktualisierungbeschreibung + Aktualisierungbeschreibung \ No newline at end of file diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 06e765777..6ec3bb4ef 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -18,6 +18,9 @@ Copy Cut Paste + File + Folder + Text Game Mode Suspend the use of Hotkeys. @@ -55,7 +58,7 @@ Shadow effect is not allowed while current theme has blur effect enabled - Plugins + Plugin Find more plugins On Off @@ -244,9 +247,9 @@ Update Failed Check your connection and try updating proxy settings to github-cloud.s3.amazonaws.com. This upgrade will restart Flow Launcher - Following files will be updated + Following files will be updated Update files - Update description + Update description Skip @@ -281,7 +284,7 @@ > ping 8.8.8.8 Shell Command Bluetooth - Bluetooth in Windows Setting + Bluetooth in Windows Settings sn Sticky Notes diff --git a/Flow.Launcher/Languages/fr.xaml b/Flow.Launcher/Languages/fr.xaml index a8f280bd1..d9c46e6b9 100644 --- a/Flow.Launcher/Languages/fr.xaml +++ b/Flow.Launcher/Languages/fr.xaml @@ -132,8 +132,8 @@ Mettre à jour Annuler Flow Launcher doit redémarrer pour installer cette mise à jour - Les fichiers suivants seront mis à jour + Les fichiers suivants seront mis à jour Fichiers mis à jour - Description de la mise à jour + Description de la mise à jour diff --git a/Flow.Launcher/Languages/it.xaml b/Flow.Launcher/Languages/it.xaml index e85e49933..0302a1531 100644 --- a/Flow.Launcher/Languages/it.xaml +++ b/Flow.Launcher/Languages/it.xaml @@ -135,8 +135,8 @@ Aggiorna Annulla Questo aggiornamento riavvierà Flow Launcher - I seguenti file saranno aggiornati + I seguenti file saranno aggiornati File aggiornati - Descrizione aggiornamento + Descrizione aggiornamento \ No newline at end of file diff --git a/Flow.Launcher/Languages/ja.xaml b/Flow.Launcher/Languages/ja.xaml index 937a1e504..3fc6296c1 100644 --- a/Flow.Launcher/Languages/ja.xaml +++ b/Flow.Launcher/Languages/ja.xaml @@ -138,8 +138,8 @@ アップデート キャンセル このアップデートでは、Flow Launcherの再起動が必要です - 次のファイルがアップデートされます + 次のファイルがアップデートされます 更新ファイル一覧 - アップデートの詳細 + アップデートの詳細 \ No newline at end of file diff --git a/Flow.Launcher/Languages/ko.xaml b/Flow.Launcher/Languages/ko.xaml index c5bd082f5..7184bef34 100644 --- a/Flow.Launcher/Languages/ko.xaml +++ b/Flow.Launcher/Languages/ko.xaml @@ -241,9 +241,9 @@ 업데이트 실패 Check your connection and try updating proxy settings to github-cloud.s3.amazonaws.com. 업데이트를 위해 Flow Launcher를 재시작합니다. - 아래 파일들이 업데이트됩니다. + 아래 파일들이 업데이트됩니다. 업데이트 파일 - 업데이트 설명 + 업데이트 설명 diff --git a/Flow.Launcher/Languages/nb-NO.xaml b/Flow.Launcher/Languages/nb-NO.xaml index 19f6cc36b..859ec20a0 100644 --- a/Flow.Launcher/Languages/nb-NO.xaml +++ b/Flow.Launcher/Languages/nb-NO.xaml @@ -135,8 +135,8 @@ Oppdater Avbryt Denne opgraderingen vil starte Flow Launcher på nytt - Følgende filer vil bli oppdatert + Følgende filer vil bli oppdatert Oppdateringsfiler - Oppdateringsbeskrivelse + Oppdateringsbeskrivelse diff --git a/Flow.Launcher/Languages/nl.xaml b/Flow.Launcher/Languages/nl.xaml index ca7fed180..822af21bf 100644 --- a/Flow.Launcher/Languages/nl.xaml +++ b/Flow.Launcher/Languages/nl.xaml @@ -126,8 +126,8 @@ Update Annuleer Deze upgrade zal Flow Launcher opnieuw opstarten - Volgende bestanden zullen worden geüpdatet + Volgende bestanden zullen worden geüpdatet Update bestanden - Update beschrijving + Update beschrijving diff --git a/Flow.Launcher/Languages/pl.xaml b/Flow.Launcher/Languages/pl.xaml index 4f3042be3..a8c423de1 100644 --- a/Flow.Launcher/Languages/pl.xaml +++ b/Flow.Launcher/Languages/pl.xaml @@ -126,8 +126,8 @@ Aktualizuj Anuluj Aby dokończyć proces aktualizacji Flow Launcher musi zostać zresetowany - Następujące pliki zostaną zaktualizowane + Następujące pliki zostaną zaktualizowane Aktualizuj pliki - Opis aktualizacji + Opis aktualizacji \ No newline at end of file diff --git a/Flow.Launcher/Languages/pt-br.xaml b/Flow.Launcher/Languages/pt-br.xaml index dce921ff7..a4dfe446c 100644 --- a/Flow.Launcher/Languages/pt-br.xaml +++ b/Flow.Launcher/Languages/pt-br.xaml @@ -135,8 +135,8 @@ Atualizar Cancelar Essa atualização reiniciará o Flow Launcher - Os seguintes arquivos serão atualizados + Os seguintes arquivos serão atualizados Atualizar arquivos - Atualizar descrição + Atualizar descrição \ No newline at end of file diff --git a/Flow.Launcher/Languages/pt-pt.xaml b/Flow.Launcher/Languages/pt-pt.xaml index 6f6f1b03e..764ba542b 100644 --- a/Flow.Launcher/Languages/pt-pt.xaml +++ b/Flow.Launcher/Languages/pt-pt.xaml @@ -244,9 +244,9 @@ Falha ao atualizar Verifique a sua ligação e as definições do proxy estabelecidas para github-cloud.s3.amazonaws.com Esta atualização irá reiniciar o Flow Launcher - Os seguintes ficheiros serão atualizados + Os seguintes ficheiros serão atualizados Atualizar ficheiros - Atualizar descrição + Atualizar descrição Ignorar diff --git a/Flow.Launcher/Languages/ru.xaml b/Flow.Launcher/Languages/ru.xaml index d0d6ff0e5..63c8d46ee 100644 --- a/Flow.Launcher/Languages/ru.xaml +++ b/Flow.Launcher/Languages/ru.xaml @@ -126,8 +126,8 @@ Обновить Отмена Это обновление перезапустит Flow Launcher - Следующие файлы будут обновлены + Следующие файлы будут обновлены Обновить файлы - Описание обновления + Описание обновления \ No newline at end of file diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index 9fbf240bd..dac746d0f 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -242,9 +242,9 @@ Aktualizácia zlyhala Skontrolujte pripojenie a skúste aktualizovať nastavenia servera proxy k github-cloud.s3.amazonaws.com. Tento upgrade reštartuje Flow Launcher - Nasledujúce súbory budú aktualizované + Nasledujúce súbory budú aktualizované Aktualizovať súbory - Aktualizovať popis + Aktualizovať popis Preskočiť diff --git a/Flow.Launcher/Languages/sr.xaml b/Flow.Launcher/Languages/sr.xaml index 0394b398d..3efe27a47 100644 --- a/Flow.Launcher/Languages/sr.xaml +++ b/Flow.Launcher/Languages/sr.xaml @@ -135,8 +135,8 @@ Ažuriraj Otkaži Ova nadogradnja će ponovo pokrenuti Flow Launcher - Sledeće datoteke će biti ažurirane + Sledeće datoteke će biti ažurirane Ažuriraj datoteke - Opis ažuriranja + Opis ažuriranja \ No newline at end of file diff --git a/Flow.Launcher/Languages/tr.xaml b/Flow.Launcher/Languages/tr.xaml index 421375df9..a39b55b23 100644 --- a/Flow.Launcher/Languages/tr.xaml +++ b/Flow.Launcher/Languages/tr.xaml @@ -139,8 +139,8 @@ Güncelle İptal Bu güncelleme Flow Launcher'u yeniden başlatacaktır - Aşağıdaki dosyalar güncelleştirilecektir + Aşağıdaki dosyalar güncelleştirilecektir Güncellenecek dosyalar - Güncelleme açıklaması + Güncelleme açıklaması \ No newline at end of file diff --git a/Flow.Launcher/Languages/uk-UA.xaml b/Flow.Launcher/Languages/uk-UA.xaml index b57676f8d..790314d0f 100644 --- a/Flow.Launcher/Languages/uk-UA.xaml +++ b/Flow.Launcher/Languages/uk-UA.xaml @@ -126,8 +126,8 @@ Оновити Скасувати Це оновлення перезавантажить Flow Launcher - Ці файли будуть оновлені + Ці файли будуть оновлені Оновити файли - Опис оновлення + Опис оновлення \ No newline at end of file diff --git a/Flow.Launcher/Languages/zh-cn.xaml b/Flow.Launcher/Languages/zh-cn.xaml index 01cd97467..e404c4deb 100644 --- a/Flow.Launcher/Languages/zh-cn.xaml +++ b/Flow.Launcher/Languages/zh-cn.xaml @@ -226,9 +226,9 @@ 更新失败 检查网络是否可以连接至github-cloud.s3.amazonaws.com. 此次更新需要重启Flow Launcher - 下列文件会被更新 + 下列文件会被更新 更新文件 - 更新日志 + 更新日志 跳过 diff --git a/Flow.Launcher/Languages/zh-tw.xaml b/Flow.Launcher/Languages/zh-tw.xaml index 294add207..cba62ead4 100644 --- a/Flow.Launcher/Languages/zh-tw.xaml +++ b/Flow.Launcher/Languages/zh-tw.xaml @@ -126,8 +126,8 @@ 更新 取消 此更新需要重新啟動 Flow Launcher - 下列檔案會被更新 + 下列檔案會被更新 更新檔案 - 更新日誌 + 更新日誌 diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 5d26433b5..714fcc53f 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -175,6 +175,9 @@ Style="{DynamicResource QueryBoxStyle}" Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="Visible"> + + + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index c1d170f9a..366407182 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -18,6 +18,8 @@ using KeyEventArgs = System.Windows.Input.KeyEventArgs; using NotifyIcon = System.Windows.Forms.NotifyIcon; using Flow.Launcher.Infrastructure; using System.Windows.Media; +using Flow.Launcher.Infrastructure.Hotkey; +using Flow.Launcher.Plugin.SharedCommands; namespace Flow.Launcher { @@ -50,7 +52,18 @@ namespace Flow.Launcher { InitializeComponent(); } + private void OnCopy(object sender, ExecutedRoutedEventArgs e) + { + if (QueryTextBox.SelectionLength == 0) + { + _viewModel.ResultCopy(string.Empty); + } + else if (!string.IsNullOrEmpty(QueryTextBox.Text)) + { + _viewModel.ResultCopy(QueryTextBox.SelectedText); + } + } private async void OnClosing(object sender, CancelEventArgs e) { _settings.WindowTop = Top; @@ -59,6 +72,7 @@ namespace Flow.Launcher _viewModel.Save(); e.Cancel = true; await PluginManager.DisposePluginsAsync(); + Notification.Uninstall(); Environment.Exit(0); } @@ -498,6 +512,24 @@ namespace Flow.Launcher e.Handled = true; } break; + case Key.Back: + var specialKeyState = GlobalHotkey.CheckModifiers(); + if (specialKeyState.CtrlPressed) + { + if (_viewModel.SelectedIsFromQueryResults() + && QueryTextBox.CaretIndex == QueryTextBox.Text.Length) + { + var queryWithoutActionKeyword = + QueryBuilder.Build(QueryTextBox.Text.Trim(), PluginManager.NonGlobalPlugins).Search; + + if (FilesFolders.IsLocationPathString(queryWithoutActionKeyword)) + { + _viewModel.BackspaceCommand.Execute(null); + e.Handled = true; + } + } + } + break; default: break; diff --git a/Flow.Launcher/Notification.cs b/Flow.Launcher/Notification.cs index d8f9fd45e..3f5565eeb 100644 --- a/Flow.Launcher/Notification.cs +++ b/Flow.Launcher/Notification.cs @@ -1,4 +1,5 @@ using Flow.Launcher.Infrastructure; +using Microsoft.Toolkit.Uwp.Notifications; using System; using System.IO; using Windows.Data.Xml.Dom; @@ -8,10 +9,17 @@ namespace Flow.Launcher { internal static class Notification { + internal static bool legacy = Environment.OSVersion.Version.Build < 19041; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "")] + internal static void Uninstall() + { + if (!legacy) + ToastNotificationManagerCompat.Uninstall(); + } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "")] public static void Show(string title, string subTitle, string iconPath) { - var legacy = Environment.OSVersion.Version.Build < 19041; // Handle notification for win7/8/early win10 if (legacy) { @@ -24,13 +32,11 @@ namespace Flow.Launcher ? Path.Combine(Constant.ProgramDirectory, "Images\\app.png") : iconPath; - var xml = $"\"meziantou\"/{title}" + - $"{subTitle}"; - var toastXml = new XmlDocument(); - toastXml.LoadXml(xml); - var toast = new ToastNotification(toastXml); - ToastNotificationManager.CreateToastNotifier("Flow Launcher").Show(toast); - + new ToastContentBuilder() + .AddText(title, hintMaxLines: 1) + .AddText(subTitle) + .AddAppLogoOverride(new Uri(Icon)) + .Show(); } private static void LegacyShow(string title, string subTitle, string iconPath) diff --git a/Flow.Launcher/Properties/PublishProfiles/Net5.0-SelfContained.pubxml b/Flow.Launcher/Properties/PublishProfiles/Net6.0-SelfContained.pubxml similarity index 76% rename from Flow.Launcher/Properties/PublishProfiles/Net5.0-SelfContained.pubxml rename to Flow.Launcher/Properties/PublishProfiles/Net6.0-SelfContained.pubxml index 124792e3e..23867d894 100644 --- a/Flow.Launcher/Properties/PublishProfiles/Net5.0-SelfContained.pubxml +++ b/Flow.Launcher/Properties/PublishProfiles/Net6.0-SelfContained.pubxml @@ -1,13 +1,13 @@ - + FileSystem Release Any CPU - net5.0-windows10.0.19041.0 + net6.0-windows10.0.19041.0 ..\Output\Release\ win-x64 true @@ -15,4 +15,4 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False False - \ No newline at end of file + diff --git a/Flow.Launcher/Properties/PublishProfiles/NetCore3.1-SelfContained.pubxml.user b/Flow.Launcher/Properties/PublishProfiles/NetCore3.1-SelfContained.pubxml.user deleted file mode 100644 index 312c6e3b8..000000000 --- a/Flow.Launcher/Properties/PublishProfiles/NetCore3.1-SelfContained.pubxml.user +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 5b490bede..81f7a2389 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -209,21 +209,53 @@ namespace Flow.Launcher explorer.Start(); } - public void OpenUrl(string url, bool? inPrivate = null) + private void OpenUri(Uri uri, bool? inPrivate = null) { - var browserInfo = _settingsVM.Settings.CustomBrowser; - - var path = browserInfo.Path == "*" ? "" : browserInfo.Path; - - if (browserInfo.OpenInTab) + if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps) { - url.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg); + var browserInfo = _settingsVM.Settings.CustomBrowser; + + var path = browserInfo.Path == "*" ? "" : browserInfo.Path; + + if (browserInfo.OpenInTab) + { + uri.AbsoluteUri.OpenInBrowserTab(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg); + } + else + { + uri.AbsoluteUri.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg); + } } else { - url.OpenInBrowserWindow(path, inPrivate ?? browserInfo.EnablePrivate, browserInfo.PrivateArg); - } + Process.Start(new ProcessStartInfo() + { + FileName = uri.AbsoluteUri, + UseShellExecute = true + })?.Dispose(); + return; + } + } + + public void OpenUrl(string url, bool? inPrivate = null) + { + OpenUri(new Uri(url), inPrivate); + } + + public void OpenUrl(Uri url, bool? inPrivate = null) + { + OpenUri(url, inPrivate); + } + + public void OpenAppUri(string appUri) + { + OpenUri(new Uri(appUri)); + } + + public void OpenAppUri(Uri appUri) + { + OpenUri(appUri); } public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent; @@ -254,4 +286,4 @@ namespace Flow.Launcher #endregion } -} +} \ No newline at end of file diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 214c410be..967e4d52b 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2514,6 +2514,18 @@ Margin="14,14,0,0" HorizontalAlignment="Center" VerticalAlignment="Bottom" + FontSize="12" + Foreground="{DynamicResource Color15B}" + TextWrapping="WrapWithOverflow"> + + + + + + + - + - - - + - - + + - - - - + @@ -152,7 +158,7 @@ - + @@ -160,44 +166,50 @@ - - + + - - + + - + - + @@ -249,12 +263,12 @@ - - + + - - - \ No newline at end of file diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 8da0416a2..0fe3bdf80 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -13,12 +13,14 @@ using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; +using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.Storage; using Flow.Launcher.Infrastructure.Logger; using Microsoft.VisualStudio.Threading; using System.Threading.Channels; using ISavable = Flow.Launcher.Plugin.ISavable; - +using System.IO; +using System.Collections.Specialized; namespace Flow.Launcher.ViewModel { @@ -229,7 +231,7 @@ namespace Flow.Launcher.ViewModel AutocompleteQueryCommand = new RelayCommand(_ => { var result = SelectedResults.SelectedItem?.Result; - if (result != null) // SelectedItem returns null if selection is empty. + if (result != null && SelectedIsFromQueryResults()) // SelectedItem returns null if selection is empty. { var autoCompleteText = result.Title; @@ -252,6 +254,18 @@ namespace Flow.Launcher.ViewModel } }); + BackspaceCommand = new RelayCommand(index => + { + var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins); + + // GetPreviousExistingDirectory does not require trailing '\', otherwise will return empty string + var path = FilesFolders.GetPreviousExistingDirectory((_) => true, query.Search.TrimEnd('\\')); + + var actionKeyword = string.IsNullOrEmpty(query.ActionKeyword) ? string.Empty : $"{query.ActionKeyword} "; + + ChangeQueryText($"{actionKeyword}{path}"); + }); + LoadContextMenuCommand = new RelayCommand(_ => { if (SelectedIsFromQueryResults()) @@ -398,6 +412,7 @@ namespace Flow.Launcher.ViewModel public string PluginIconPath { get; set; } = null; public ICommand EscCommand { get; set; } + public ICommand BackspaceCommand { get; set; } public ICommand SelectNextItemCommand { get; set; } public ICommand SelectPrevItemCommand { get; set; } public ICommand SelectNextPageCommand { get; set; } @@ -410,6 +425,9 @@ namespace Flow.Launcher.ViewModel public ICommand OpenSettingCommand { get; set; } public ICommand ReloadPluginDataCommand { get; set; } public ICommand ClearQueryCommand { get; private set; } + + public ICommand CopyToClipboard { get; set; } + public ICommand AutocompleteQueryCommand { get; set; } public string OpenResultCommandModifiers { get; private set; } @@ -662,7 +680,7 @@ namespace Flow.Launcher.ViewModel Action = _ => { _topMostRecord.Remove(result); - App.API.ShowMsg("Success"); + App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success")); return false; } }; @@ -706,7 +724,11 @@ namespace Flow.Launcher.ViewModel IcoPath = icon, SubTitle = subtitle, PluginDirectory = metadata.PluginDirectory, - Action = _ => false + Action = _ => + { + App.API.OpenUrl(metadata.Website); + return true; + } }; return menu; } @@ -853,6 +875,52 @@ namespace Flow.Launcher.ViewModel Results.AddResults(resultsForUpdates, token); } + /// + /// This is the global copy method for an individual result. If no text is passed, + /// the method will work out what is to be copied based on the result, so plugin can offer the text + /// to be copied via the result model. If the text is a directory/file path, + /// then actual file/folder will be copied instead. + /// The result's subtitle text is the default text to be copied + /// + public void ResultCopy(string stringToCopy) + { + if (string.IsNullOrEmpty(stringToCopy)) + { + var result = Results.SelectedItem?.Result; + if (result != null) + { + string copyText = string.IsNullOrEmpty(result.CopyText) ? result.SubTitle : result.CopyText; + var isFile = File.Exists(copyText); + var isFolder = Directory.Exists(copyText); + if (isFile || isFolder) + { + var paths = new StringCollection(); + paths.Add(copyText); + + Clipboard.SetFileDropList(paths); + App.API.ShowMsg( + App.API.GetTranslation("copy") + +" " + + (isFile? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), + App.API.GetTranslation("completedSuccessfully")); + } + else + { + Clipboard.SetDataObject(copyText.ToString()); + App.API.ShowMsg( + App.API.GetTranslation("copy") + + " " + + App.API.GetTranslation("textTitle"), + App.API.GetTranslation("completedSuccessfully")); + } + } + + return; + } + + Clipboard.SetDataObject(stringToCopy); + } + #endregion } } \ No newline at end of file diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 908de0c09..4d32d792d 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -7,11 +7,16 @@ using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using System.IO; +using System.Drawing.Text; +using System.Collections.Generic; namespace Flow.Launcher.ViewModel { public class ResultViewModel : BaseModel { + private static PrivateFontCollection fontCollection = new(); + private static Dictionary fonts = new(); + public ResultViewModel(Result result, Settings settings) { if (result != null) @@ -23,13 +28,29 @@ namespace Flow.Launcher.ViewModel // 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; - Glyph = Path.IsPathRooted(fontPath) - ? Result.Glyph - : Result.Glyph with + string fontFamilyPath = glyph.FontFamily; + + if (!Path.IsPathRooted(fontFamilyPath)) + { + fontFamilyPath = Path.Combine(Result.PluginDirectory, fontFamilyPath); + } + + if (fonts.ContainsKey(fontFamilyPath)) + { + Glyph = glyph with { - FontFamily = Path.Combine(Result.PluginDirectory, fontPath) + FontFamily = fonts[fontFamilyPath] }; + } + else + { + fontCollection.AddFontFile(fontFamilyPath); + fonts[fontFamilyPath] = $"{Path.GetDirectoryName(fontFamilyPath)}/#{fontCollection.Families[^1].Name}"; + Glyph = glyph with + { + FontFamily = fonts[fontFamilyPath] + }; + } } else { diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs index 01a19d871..db24825d0 100644 --- a/Flow.Launcher/ViewModel/ResultsViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs @@ -310,4 +310,4 @@ namespace Flow.Launcher.ViewModel } } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs index d7b412392..735530520 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs @@ -37,7 +37,8 @@ namespace Flow.Launcher.Plugin.BrowserBookmark return new(); foreach (var folder in rootElement.EnumerateObject()) { - EnumerateFolderBookmark(folder.Value, bookmarks, source); + if (folder.Value.ValueKind == JsonValueKind.Object) + EnumerateFolderBookmark(folder.Value, bookmarks, source); } return bookmarks; } @@ -64,4 +65,4 @@ namespace Flow.Launcher.Plugin.BrowserBookmark } } -} \ No newline at end of file +} 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 2a586818c..8454b11e6 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows + net6.0-windows true {9B130CC5-14FB-41FF-B310-0A95B6894C37} Properties diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Images/bookmark.png b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Images/bookmark.png index b8aee3564..d68cecea1 100644 Binary files a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Images/bookmark.png and b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Images/bookmark.png differ diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Images/copylink.png b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Images/copylink.png index 0dee870b6..3218c94c9 100644 Binary files a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Images/copylink.png and b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Images/copylink.png differ diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/plugin.json b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/plugin.json index 3dfa418c7..afc4f9855 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/plugin.json @@ -4,7 +4,7 @@ "Name": "Browser Bookmarks", "Description": "Search your browser bookmarks", "Author": "qianlifeng, Ioannis G.", - "Version": "1.6.2", + "Version": "1.6.3", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.BrowserBookmark.dll", 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 d7dd507dc..0fe809926 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows + net6.0-windows {59BD9891-3837-438A-958D-ADC7F91F6F7E} Properties Flow.Launcher.Plugin.Caculator diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Images/calculator.png b/Plugins/Flow.Launcher.Plugin.Calculator/Images/calculator.png index 102a86bde..4bdade8b7 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Calculator/Images/calculator.png and b/Plugins/Flow.Launcher.Plugin.Calculator/Images/calculator.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs index 7de4d30fe..ea278b49b 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs @@ -6,7 +6,6 @@ using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using Mages.Core; -using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Plugin.Caculator.ViewModels; using Flow.Launcher.Plugin.Caculator.Views; @@ -25,6 +24,9 @@ namespace Flow.Launcher.Plugin.Caculator @")+$", RegexOptions.Compiled); private static readonly Regex RegBrackets = new Regex(@"[\(\)\[\]]", RegexOptions.Compiled); private static Engine MagesEngine; + private const string comma = ","; + private const string dot = "."; + private PluginInitContext Context { get; set; } private static Settings _settings; @@ -35,7 +37,7 @@ namespace Flow.Launcher.Plugin.Caculator Context = context; _settings = context.API.LoadSettingJsonStorage(); _viewModel = new SettingsViewModel(_settings); - + MagesEngine = new Engine(new Configuration { Scope = new Dictionary @@ -54,7 +56,19 @@ namespace Flow.Launcher.Plugin.Caculator try { - var expression = query.Search.Replace(",", "."); + string expression; + + switch (_settings.DecimalSeparator) + { + case DecimalSeparator.Comma: + case DecimalSeparator.UseSystemLocale when CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ",": + expression = query.Search.Replace(",", "."); + break; + default: + expression = query.Search; + break; + } + var result = MagesEngine.Interpret(expression); if (result?.ToString() == "NaN") @@ -76,6 +90,7 @@ namespace Flow.Launcher.Plugin.Caculator IcoPath = "Images/calculator.png", Score = 300, SubTitle = Context.API.GetTranslation("flowlauncher_plugin_calculator_copy_number_to_clipboard"), + CopyText = newResult, Action = c => { try @@ -119,6 +134,10 @@ namespace Flow.Launcher.Plugin.Caculator return false; } + if ((query.Search.Contains(dot) && GetDecimalSeparator() != dot) || + (query.Search.Contains(comma) && GetDecimalSeparator() != comma)) + return false; + return true; } @@ -142,8 +161,8 @@ namespace Flow.Launcher.Plugin.Caculator switch (_settings.DecimalSeparator) { case DecimalSeparator.UseSystemLocale: return systemDecimalSeperator; - case DecimalSeparator.Dot: return "."; - case DecimalSeparator.Comma: return ","; + case DecimalSeparator.Dot: return dot; + case DecimalSeparator.Comma: return comma; default: return systemDecimalSeperator; } } diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Settings.cs b/Plugins/Flow.Launcher.Plugin.Calculator/Settings.cs index 10cee364b..615514873 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Settings.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - + namespace Flow.Launcher.Plugin.Caculator { public class Settings diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/plugin.json b/Plugins/Flow.Launcher.Plugin.Calculator/plugin.json index 0b0921868..771babb90 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Calculator/plugin.json @@ -4,7 +4,7 @@ "Name": "Calculator", "Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)", "Author": "cxfksword", - "Version": "1.1.9", + "Version": "1.1.10", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Caculator.dll", diff --git a/Plugins/Flow.Launcher.Plugin.ControlPanel/Languages/ko.xaml b/Plugins/Flow.Launcher.Plugin.ControlPanel/Languages/ko.xaml deleted file mode 100644 index bcfdd3fc9..000000000 --- a/Plugins/Flow.Launcher.Plugin.ControlPanel/Languages/ko.xaml +++ /dev/null @@ -1,7 +0,0 @@ - - - - 제어판 - 제어판 항목을 검색합니다. - - 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 8f9466794..b4ab89a36 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows + net6.0-windows true true true diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/copy.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/copy.png index 8f1fca752..26786b11e 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/copy.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/copy.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/deletefilefolder.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/deletefilefolder.png index 024cc9291..a8e27d342 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/deletefilefolder.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/deletefilefolder.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/excludeindexpath.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/excludeindexpath.png index 8578ac7fb..19b7025a5 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/excludeindexpath.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/excludeindexpath.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/file.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/file.png index 36156767a..bf12c186e 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/file.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/file.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/folder.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/folder.png index 569fa7049..2ae7250a2 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/folder.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/folder.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/index.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/index.png index c63fc8069..a671dac21 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/index.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/index.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/quickaccess.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/quickaccess.png index 470a6782f..e3fdeb4f7 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/quickaccess.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/quickaccess.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/removequickaccess.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/removequickaccess.png index fbfb0b960..0ca287ea3 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/removequickaccess.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/removequickaccess.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/user.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/user.png index 2d45c1ee9..03402d8e8 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Explorer/Images/user.png and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/user.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index bbaacc18c..a7fa58643 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -89,6 +89,7 @@ Library - net5.0-windows + net6.0-windows {FDED22C8-B637-42E8-824A-63B5B6E05A3A} Properties Flow.Launcher.Plugin.PluginIndicator diff --git a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Images/work.png b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Images/work.png index 6ff9b8b15..b213f0b04 100644 Binary files a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Images/work.png and b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Images/work.png differ diff --git a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs index b046b2beb..ec33a64e7 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs @@ -25,6 +25,7 @@ namespace Flow.Launcher.Plugin.PluginIndicator SubTitle = $"Activate {metadata.Name} plugin", Score = 100, IcoPath = metadata.IcoPath, + AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}", Action = c => { context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}"); diff --git a/Plugins/Flow.Launcher.Plugin.PluginIndicator/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginIndicator/plugin.json index d2197d700..b19e3c99c 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginIndicator/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.PluginIndicator/plugin.json @@ -4,7 +4,7 @@ "Name": "Plugin Indicator", "Description": "Provide plugin actionword suggestion", "Author": "qianlifeng", - "Version": "1.1.3", + "Version": "1.1.4", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.PluginIndicator.dll", diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs index a20e5a267..37f0a126e 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs @@ -2,7 +2,7 @@ using Flow.Launcher.Infrastructure.UserSettings; using System; using System.Collections.Generic; -using System.Text; +using System.Text.RegularExpressions; namespace Flow.Launcher.Plugin.PluginsManager { @@ -53,8 +53,8 @@ namespace Flow.Launcher.Plugin.PluginsManager { // standard UrlSourceCode format in PluginsManifest's plugins.json file: https://github.com/jjw24/Flow.Launcher.Plugin.Putty/tree/master var link = pluginManifestInfo.UrlSourceCode.StartsWith("https://github.com") - ? pluginManifestInfo.UrlSourceCode.Replace("/tree/master", "/issues/new/choose") - : pluginManifestInfo.UrlSourceCode; + ? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues/new/choose" + : pluginManifestInfo.UrlSourceCode; Context.API.OpenUrl(link); return true; 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 62534ef98..2b773bee4 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Flow.Launcher.Plugin.PluginsManager.csproj +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Flow.Launcher.Plugin.PluginsManager.csproj @@ -1,7 +1,7 @@  Library - net5.0-windows + net6.0-windows true true true @@ -38,6 +38,6 @@ - + \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/manifestsite.png b/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/manifestsite.png index f96ba15b2..54f3f62fc 100644 Binary files a/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/manifestsite.png and b/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/manifestsite.png differ diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/pluginsmanager.png b/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/pluginsmanager.png index 65f0e41dc..91b3148c5 100644 Binary files a/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/pluginsmanager.png and b/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/pluginsmanager.png differ diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/request.png b/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/request.png index a9126cb9b..a43b87d85 100644 Binary files a/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/request.png and b/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/request.png differ diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/sourcecode.png b/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/sourcecode.png index 8efbdaa48..77afc44f9 100644 Binary files a/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/sourcecode.png and b/Plugins/Flow.Launcher.Plugin.PluginsManager/Images/sourcecode.png differ diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs index 8aaae95d6..57c857403 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs @@ -12,7 +12,7 @@ using System.Windows; namespace Flow.Launcher.Plugin.PluginsManager { - public class Main : ISettingProvider, IAsyncPlugin, IContextMenu, IPluginI18n, IAsyncReloadable + public class Main : ISettingProvider, IAsyncPlugin, IContextMenu, IPluginI18n { internal PluginInitContext Context { get; set; } @@ -24,28 +24,20 @@ namespace Flow.Launcher.Plugin.PluginsManager internal PluginsManager pluginManager; - private DateTime lastUpdateTime = DateTime.MinValue; - public Control CreateSettingPanel() { return new PluginsManagerSettings(viewModel); } - public Task InitAsync(PluginInitContext context) + public async Task InitAsync(PluginInitContext context) { Context = context; Settings = context.API.LoadSettingJsonStorage(); viewModel = new SettingsViewModel(context, Settings); contextMenu = new ContextMenu(Context); pluginManager = new PluginsManager(Context, Settings); - _manifestUpdateTask = pluginManager - .UpdateManifestAsync(true) - .ContinueWith(_ => - { - lastUpdateTime = DateTime.Now; - }, TaskContinuationOptions.OnlyOnRanToCompletion); - return Task.CompletedTask; + await pluginManager.UpdateManifestAsync(); } public List LoadContextMenus(Result selectedResult) @@ -53,35 +45,20 @@ namespace Flow.Launcher.Plugin.PluginsManager return contextMenu.LoadContextMenus(selectedResult); } - private Task _manifestUpdateTask = Task.CompletedTask; - public async Task> QueryAsync(Query query, CancellationToken token) { - var search = query.Search; - - if (string.IsNullOrWhiteSpace(search)) + if (string.IsNullOrWhiteSpace(query.Search)) return pluginManager.GetDefaultHotKeys(); - if ((DateTime.Now - lastUpdateTime).TotalHours > 12 && _manifestUpdateTask.IsCompleted) // 12 hours - { - _manifestUpdateTask = pluginManager.UpdateManifestAsync().ContinueWith(t => - { - lastUpdateTime = DateTime.Now; - }, TaskContinuationOptions.OnlyOnRanToCompletion); - } - - return search switch + return query.FirstSearch.ToLower() switch { //search could be url, no need ToLower() when passed in - var s when s.StartsWith(Settings.HotKeyInstall, StringComparison.OrdinalIgnoreCase) - => await pluginManager.RequestInstallOrUpdate(search, token), - var s when s.StartsWith(Settings.HotkeyUninstall, StringComparison.OrdinalIgnoreCase) - => pluginManager.RequestUninstall(search), - var s when s.StartsWith(Settings.HotkeyUpdate, StringComparison.OrdinalIgnoreCase) - => await pluginManager.RequestUpdate(search, token), + Settings.InstallCommand => await pluginManager.RequestInstallOrUpdate(query.SecondToEndSearch, token), + Settings.UninstallCommand => pluginManager.RequestUninstall(query.SecondToEndSearch), + Settings.UpdateCommand => await pluginManager.RequestUpdate(query.SecondToEndSearch, token), _ => pluginManager.GetDefaultHotKeys().Where(hotkey => { - hotkey.Score = StringMatcher.FuzzySearch(search, hotkey.Title).Score; + hotkey.Score = StringMatcher.FuzzySearch(query.Search, hotkey.Title).Score; return hotkey.Score > 0; }).ToList() }; @@ -96,11 +73,5 @@ namespace Flow.Launcher.Plugin.PluginsManager { return Context.API.GetTranslation("plugin_pluginsmanager_plugin_description"); } - - public async Task ReloadDataAsync() - { - await pluginManager.UpdateManifestAsync(); - lastUpdateTime = DateTime.Now; - } } } \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs index 53e994d34..bbf155e23 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs @@ -51,7 +51,7 @@ namespace Flow.Launcher.Plugin.PluginsManager private Task _downloadManifestTask = Task.CompletedTask; - internal Task UpdateManifestAsync(bool silent = false) + internal Task UpdateManifestAsync(CancellationToken token = default, bool silent = false) { if (_downloadManifestTask.Status == TaskStatus.Running) { @@ -59,7 +59,7 @@ namespace Flow.Launcher.Plugin.PluginsManager } else { - _downloadManifestTask = PluginsManifest.UpdateTask; + _downloadManifestTask = PluginsManifest.UpdateManifestAsync(token); if (!silent) _downloadManifestTask.ContinueWith(_ => Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_failed_title"), @@ -75,31 +75,34 @@ namespace Flow.Launcher.Plugin.PluginsManager { new Result() { - Title = Settings.HotKeyInstall, + Title = Settings.InstallCommand, IcoPath = icoPath, + AutoCompleteText = $"{Context.CurrentPluginMetadata.ActionKeyword} {Settings.InstallCommand} ", Action = _ => { - Context.API.ChangeQuery("pm install "); + Context.API.ChangeQuery($"{Context.CurrentPluginMetadata.ActionKeyword} {Settings.InstallCommand} "); return false; } }, new Result() { - Title = Settings.HotkeyUninstall, + Title = Settings.UninstallCommand, IcoPath = icoPath, + AutoCompleteText = $"{Context.CurrentPluginMetadata.ActionKeyword} {Settings.UninstallCommand} ", Action = _ => { - Context.API.ChangeQuery("pm uninstall "); + Context.API.ChangeQuery($"{Context.CurrentPluginMetadata.ActionKeyword} {Settings.UninstallCommand} "); return false; } }, new Result() { - Title = Settings.HotkeyUpdate, + Title = Settings.UpdateCommand, IcoPath = icoPath, + AutoCompleteText = $"{Context.CurrentPluginMetadata.ActionKeyword} {Settings.UpdateCommand} ", Action = _ => { - Context.API.ChangeQuery("pm update "); + Context.API.ChangeQuery($"{Context.CurrentPluginMetadata.ActionKeyword} {Settings.UpdateCommand} "); return false; } } @@ -119,7 +122,7 @@ namespace Flow.Launcher.Plugin.PluginsManager Context .API .ChangeQuery( - $"{Context.CurrentPluginMetadata.ActionKeywords.FirstOrDefault()} {Settings.HotkeyUpdate} {plugin.Name}"); + $"{Context.CurrentPluginMetadata.ActionKeywords.FirstOrDefault()} {Settings.UpdateCommand} {plugin.Name}"); var mainWindow = Application.Current.MainWindow; mainWindow.Show(); @@ -181,22 +184,7 @@ namespace Flow.Launcher.Plugin.PluginsManager internal async ValueTask> RequestUpdate(string search, CancellationToken token) { - if (!PluginsManifest.UserPlugins.Any()) - { - await UpdateManifestAsync(); - } - - token.ThrowIfCancellationRequested(); - - var autocompletedResults = AutoCompleteReturnAllResults(search, - Settings.HotkeyUpdate, - "Update", - "Select a plugin to update"); - - if (autocompletedResults.Any()) - return autocompletedResults; - - var uninstallSearch = search.Replace(Settings.HotkeyUpdate, string.Empty, StringComparison.OrdinalIgnoreCase).TrimStart(); + await UpdateManifestAsync(token); var resultsForUpdate = from existingPlugin in Context.API.GetAllPlugins() @@ -285,7 +273,7 @@ namespace Flow.Launcher.Plugin.PluginsManager } }); - return Search(results, uninstallSearch); + return Search(results, search); } internal bool PluginExists(string id) @@ -369,20 +357,13 @@ namespace Flow.Launcher.Plugin.PluginsManager return url.StartsWith(acceptedSource) && Context.API.GetAllPlugins().Any(x => x.Metadata.Website.StartsWith(contructedUrlPart)); } - internal async ValueTask> RequestInstallOrUpdate(string searchName, CancellationToken token) + internal async ValueTask> RequestInstallOrUpdate(string search, CancellationToken token) { - if (!PluginsManifest.UserPlugins.Any()) - { - await UpdateManifestAsync(); - } + await UpdateManifestAsync(token); - token.ThrowIfCancellationRequested(); - - var searchNameWithoutKeyword = searchName.Replace(Settings.HotKeyInstall, string.Empty, StringComparison.OrdinalIgnoreCase).Trim(); - - if (Uri.IsWellFormedUriString(searchNameWithoutKeyword, UriKind.Absolute) - && searchNameWithoutKeyword.Split('.').Last() == zip) - return InstallFromWeb(searchNameWithoutKeyword); + if (Uri.IsWellFormedUriString(search, UriKind.Absolute) + && search.Split('.').Last() == zip) + return InstallFromWeb(search); var results = PluginsManifest @@ -408,7 +389,7 @@ namespace Flow.Launcher.Plugin.PluginsManager ContextData = x }); - return Search(results, searchNameWithoutKeyword); + return Search(results, search); } private void Install(UserPlugin plugin, string downloadedFilePath) @@ -468,16 +449,6 @@ namespace Flow.Launcher.Plugin.PluginsManager internal List RequestUninstall(string search) { - var autocompletedResults = AutoCompleteReturnAllResults(search, - Settings.HotkeyUninstall, - "Uninstall", - "Select a plugin to uninstall"); - - if (autocompletedResults.Any()) - return autocompletedResults; - - var uninstallSearch = search.Replace(Settings.HotkeyUninstall, string.Empty, StringComparison.OrdinalIgnoreCase).TrimStart(); - var results = Context.API .GetAllPlugins() .Select(x => @@ -508,7 +479,7 @@ namespace Flow.Launcher.Plugin.PluginsManager } }); - return Search(results, uninstallSearch); + return Search(results, search); } private void Uninstall(PluginMetadata plugin, bool removedSetting = true) @@ -523,36 +494,6 @@ namespace Flow.Launcher.Plugin.PluginsManager using var _ = File.CreateText(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")); } - private List AutoCompleteReturnAllResults(string search, string hotkey, string title, string subtitle) - { - if (!string.IsNullOrEmpty(search) - && hotkey.StartsWith(search) - && (hotkey != search || !search.StartsWith(hotkey))) - { - return - new List - { - new Result - { - Title = title, - IcoPath = icoPath, - SubTitle = subtitle, - Action = e => - { - Context - .API - .ChangeQuery( - $"{Context.CurrentPluginMetadata.ActionKeywords.FirstOrDefault()} {hotkey} "); - - return false; - } - } - }; - } - - return new List(); - } - private bool SameOrLesserPluginVersionExists(string metadataPath) { var newMetadata = JsonSerializer.Deserialize(File.ReadAllText(metadataPath)); diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Settings.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/Settings.cs index a951010c0..6fd4e51ac 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Settings.cs @@ -6,11 +6,11 @@ namespace Flow.Launcher.Plugin.PluginsManager { internal class Settings { - internal string HotKeyInstall { get; set; } = "install"; + internal const string InstallCommand = "install"; - internal string HotkeyUninstall { get; set; } = "uninstall"; + internal const string UninstallCommand = "uninstall"; - internal string HotkeyUpdate { get; set; } = "update"; + internal const string UpdateCommand = "update"; public bool WarnFromUnknownSource { get; set; } = true; } diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json index 0900ddb6c..0bee472d9 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.11.2", + "Version": "1.12.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll", diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj index 799230b10..80642c8a3 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Flow.Launcher.Plugin.ProcessKiller.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows + net6.0-windows Flow.Launcher.Plugin.ProcessKiller Flow.Launcher.Plugin.ProcessKiller Flow-Launcher diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Images/app.png b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Images/app.png index fa76a5d29..418086275 100644 Binary files a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Images/app.png and b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Images/app.png differ diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs index 31b4a67ed..19f96aea1 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs @@ -88,6 +88,7 @@ namespace Flow.Launcher.Plugin.ProcessKiller TitleHighlightData = StringMatcher.FuzzySearch(termToSearch, p.ProcessName).MatchData, Score = pr.Score, ContextData = p.ProcessName, + AutoCompleteText = $"{_context.CurrentPluginMetadata.ActionKeyword}{Plugin.Query.TermSeparator}{p.ProcessName}", Action = (c) => { processHelper.TryKill(p); diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/plugin.json b/Plugins/Flow.Launcher.Plugin.ProcessKiller/plugin.json index 96565e14c..8e3eb87fe 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/plugin.json @@ -4,7 +4,7 @@ "Name":"Process Killer", "Description":"Kill running processes from Flow", "Author":"Flow-Launcher", - "Version":"1.2.4", + "Version":"1.2.6", "Language":"csharp", "Website":"https://github.com/Flow-Launcher/Flow.Launcher.Plugin.ProcessKiller", "IcoPath":"Images\\app.png", diff --git a/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj b/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj index 2eb04b5a9..2809e0b5c 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj +++ b/Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows10.0.19041.0 + net6.0-windows10.0.19041.0 {FDB3555B-58EF-4AE6-B5F1-904719637AB4} Properties Flow.Launcher.Plugin.Program diff --git a/Plugins/Flow.Launcher.Plugin.Program/Images/cmd.png b/Plugins/Flow.Launcher.Plugin.Program/Images/cmd.png index 686583653..284e1d371 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Program/Images/cmd.png and b/Plugins/Flow.Launcher.Plugin.Program/Images/cmd.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Program/Images/disable.png b/Plugins/Flow.Launcher.Plugin.Program/Images/disable.png index e9d4976bc..61bcc97fb 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Program/Images/disable.png and b/Plugins/Flow.Launcher.Plugin.Program/Images/disable.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Program/Images/folder.png b/Plugins/Flow.Launcher.Plugin.Program/Images/folder.png index 569fa7049..2ae7250a2 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Program/Images/folder.png and b/Plugins/Flow.Launcher.Plugin.Program/Images/folder.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Program/Images/program.png b/Plugins/Flow.Launcher.Plugin.Program/Images/program.png index e4c789689..ecc91bdb3 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Program/Images/program.png and b/Plugins/Flow.Launcher.Plugin.Program/Images/program.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Program/Images/user.png b/Plugins/Flow.Launcher.Plugin.Program/Images/user.png index 2d45c1ee9..03402d8e8 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Program/Images/user.png and b/Plugins/Flow.Launcher.Plugin.Program/Images/user.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Program/plugin.json b/Plugins/Flow.Launcher.Plugin.Program/plugin.json index 29bdcd90d..993b2adba 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.8.1", + "Version": "1.8.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Program.dll", diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj b/Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj index 03b2d5a40..5ebfd6d54 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj +++ b/Plugins/Flow.Launcher.Plugin.Shell/Flow.Launcher.Plugin.Shell.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows + net6.0-windows {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} Properties Flow.Launcher.Plugin.Shell diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Images/admin.png b/Plugins/Flow.Launcher.Plugin.Shell/Images/admin.png index bc3fe8778..284e1d371 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Shell/Images/admin.png and b/Plugins/Flow.Launcher.Plugin.Shell/Images/admin.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Images/copy.png b/Plugins/Flow.Launcher.Plugin.Shell/Images/copy.png index cc3bf4ea8..bf12c186e 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Shell/Images/copy.png and b/Plugins/Flow.Launcher.Plugin.Shell/Images/copy.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Images/shell.png b/Plugins/Flow.Launcher.Plugin.Shell/Images/shell.png index 686583653..0ec0122d4 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Shell/Images/shell.png and b/Plugins/Flow.Launcher.Plugin.Shell/Images/shell.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Images/user.png b/Plugins/Flow.Launcher.Plugin.Shell/Images/user.png index 2d45c1ee9..03402d8e8 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Shell/Images/user.png and b/Plugins/Flow.Launcher.Plugin.Shell/Images/user.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs index 0c539015e..bed46425d 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs @@ -317,7 +317,7 @@ namespace Flow.Launcher.Plugin.Shell bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state) { - if (_settings.ReplaceWinR) + if (!context.CurrentPluginMetadata.Disabled && _settings.ReplaceWinR) { if (keyevent == (int)KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed) { diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs b/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs index 042fd0dd3..a3cac1cb8 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Shell/Settings.cs @@ -6,7 +6,7 @@ namespace Flow.Launcher.Plugin.Shell { public Shell Shell { get; set; } = Shell.Cmd; - public bool ReplaceWinR { get; set; } = true; + public bool ReplaceWinR { get; set; } = false; public bool LeaveShellOpen { get; set; } diff --git a/Plugins/Flow.Launcher.Plugin.Shell/plugin.json b/Plugins/Flow.Launcher.Plugin.Shell/plugin.json index d04a919e4..357e73f8c 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Shell/plugin.json @@ -4,9 +4,9 @@ "Name": "Shell", "Description": "Provide executing commands from Flow Launcher", "Author": "qianlifeng", - "Version": "1.4.8", + "Version": "1.4.10", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Shell.dll", "IcoPath": "Images\\shell.png" -} +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj b/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj index 01827370a..55ab2780e 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj +++ b/Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows + net6.0-windows {0B9DE348-9361-4940-ADB6-F5953BFFCCEC} Properties Flow.Launcher.Plugin.Sys diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/checkupdate.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/checkupdate.png index 955f6fdbb..0eb06af18 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/checkupdate.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/checkupdate.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/close.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/close.png index 17c4363ad..2fb501a40 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/close.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/close.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/hibernate.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/hibernate.png index 703204fa7..668048e19 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/hibernate.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/hibernate.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/lock.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/lock.png index 4aef7007b..daefde98e 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/lock.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/lock.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/logoff.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/logoff.png index 0d1378830..4973b66d8 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/logoff.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/logoff.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/recyclebin.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/recyclebin.png index 2cc3b0116..878a02189 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/recyclebin.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/recyclebin.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/restart.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/restart.png index aaa2ee711..ffdb6745e 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/restart.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/restart.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/restart_advanced.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/restart_advanced.png index feabbefa1..09257d2c0 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/restart_advanced.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/restart_advanced.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/shutdown.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/shutdown.png index 7da7a528d..50d157efd 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/shutdown.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/shutdown.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Images/sleep.png b/Plugins/Flow.Launcher.Plugin.Sys/Images/sleep.png index 42426286d..3ca80f9fa 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Sys/Images/sleep.png and b/Plugins/Flow.Launcher.Plugin.Sys/Images/sleep.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Sys/plugin.json b/Plugins/Flow.Launcher.Plugin.Sys/plugin.json index 9c2dcbfff..c9e9c1272 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Sys/plugin.json @@ -4,7 +4,7 @@ "Name": "System Commands", "Description": "Provide System related commands. e.g. shutdown,lock, setting etc.", "Author": "qianlifeng", - "Version": "1.6.1", + "Version": "1.6.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Sys.dll", diff --git a/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj b/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj index ea0b4b7d2..8d50a80e2 100644 --- a/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj +++ b/Plugins/Flow.Launcher.Plugin.Url/Flow.Launcher.Plugin.Url.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows + net6.0-windows {A3DCCBCA-ACC1-421D-B16E-210896234C26} true Properties diff --git a/Plugins/Flow.Launcher.Plugin.Url/Images/url.png b/Plugins/Flow.Launcher.Plugin.Url/Images/url.png index 619d1ad6a..5d475f82e 100644 Binary files a/Plugins/Flow.Launcher.Plugin.Url/Images/url.png and b/Plugins/Flow.Launcher.Plugin.Url/Images/url.png differ diff --git a/Plugins/Flow.Launcher.Plugin.Url/plugin.json b/Plugins/Flow.Launcher.Plugin.Url/plugin.json index e128ceafb..0d71232d8e 100644 --- a/Plugins/Flow.Launcher.Plugin.Url/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Url/plugin.json @@ -4,7 +4,7 @@ "Name": "URL", "Description": "Open the typed URL from Flow Launcher", "Author": "qianlifeng", - "Version": "1.2.1", + "Version": "1.2.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Url.dll", diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj b/Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj index cd0bbdee3..f238c4e93 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj @@ -2,7 +2,7 @@ Library - net5.0-windows + net6.0-windows {403B57F2-1856-4FC7-8A24-36AB346B763E} Properties true diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Images/web_search.png b/Plugins/Flow.Launcher.Plugin.WebSearch/Images/web_search.png index a3f0be1f5..017ebf5f2 100644 Binary files a/Plugins/Flow.Launcher.Plugin.WebSearch/Images/web_search.png and b/Plugins/Flow.Launcher.Plugin.WebSearch/Images/web_search.png differ diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs index 31d56c108..b136e3b8b 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs @@ -41,17 +41,18 @@ namespace Flow.Launcher.Plugin.WebSearch var results = new List(); foreach (SearchSource searchSource in _settings.SearchSources.Where(o => (o.ActionKeyword == query.ActionKeyword || - o.ActionKeyword == SearchSourceGlobalPluginWildCardSign) - && o.Enabled)) + o.ActionKeyword == SearchSourceGlobalPluginWildCardSign) + && o.Enabled)) { string keyword = string.Empty; keyword = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? query.ToString() : query.Search; var title = keyword; string subtitle = _context.API.GetTranslation("flowlauncher_plugin_websearch_search") + " " + searchSource.Title; - //Action Keyword match apear on top + // Action Keyword match apear on top var score = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? scoreStandard : scoreStandard + 1; + // This populates the associated action keyword search entry if (string.IsNullOrEmpty(keyword)) { var result = new Result @@ -61,6 +62,7 @@ namespace Flow.Launcher.Plugin.WebSearch IcoPath = searchSource.IconPath, Score = score }; + results.Add(result); } else @@ -93,7 +95,6 @@ namespace Flow.Launcher.Plugin.WebSearch if (token.IsCancellationRequested) return null; - } return results; @@ -105,11 +106,11 @@ namespace Flow.Launcher.Plugin.WebSearch if (_settings.EnableSuggestion) { var suggestions = await SuggestionsAsync(keyword, subtitle, searchSource, token).ConfigureAwait(false); - if (token.IsCancellationRequested || !suggestions.Any()) + var enumerable = suggestions?.ToList(); + if (token.IsCancellationRequested || enumerable is not { Count: > 0 }) return; - - - results.AddRange(suggestions); + + results.AddRange(enumerable); token.ThrowIfCancellationRequested(); } @@ -118,32 +119,32 @@ namespace Flow.Launcher.Plugin.WebSearch private async Task> SuggestionsAsync(string keyword, string subtitle, SearchSource searchSource, CancellationToken token) { var source = _settings.SelectedSuggestion; - if (source != null) + if (source == null) { - //Suggestions appear below actual result, and appear above global action keyword match if non-global; - var score = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? scoreSuggestions : scoreSuggestions + 1; - - var suggestions = await source.Suggestions(keyword, token).ConfigureAwait(false); - - token.ThrowIfCancellationRequested(); - - var resultsFromSuggestion = suggestions?.Select(o => new Result - { - Title = o, - SubTitle = subtitle, - Score = score, - IcoPath = searchSource.IconPath, - ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword, - Action = c => - { - _context.API.OpenUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o))); - - return true; - } - }); - return resultsFromSuggestion; + return new List(); } - return new List(); + //Suggestions appear below actual result, and appear above global action keyword match if non-global; + var score = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? scoreSuggestions : scoreSuggestions + 1; + + var suggestions = await source.SuggestionsAsync(keyword, token).ConfigureAwait(false); + + token.ThrowIfCancellationRequested(); + + var resultsFromSuggestion = suggestions?.Select(o => new Result + { + Title = o, + SubTitle = subtitle, + Score = score, + IcoPath = searchSource.IconPath, + ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword, + Action = c => + { + _context.API.OpenUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o))); + + return true; + } + }); + return resultsFromSuggestion; } public Task InitAsync(PluginInitContext context) @@ -191,4 +192,4 @@ namespace Flow.Launcher.Plugin.WebSearch public event ResultUpdatedEventHandler ResultsUpdated; } -} +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs index f54dbc13c..2495abe66 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceViewModel.cs @@ -62,4 +62,4 @@ namespace Flow.Launcher.Plugin.WebSearch return ImageLoader.Load(pathToPreviewIconImage); } } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs index 33c304375..6cf1446af 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs @@ -84,7 +84,7 @@ namespace Flow.Launcher.Plugin.WebSearch }, new SearchSource { - Title = "Duckduckgo", + Title = "DuckDuckGo", ActionKeyword = "duckduckgo", Icon = "duckduckgo.png", Url = "https://duckduckgo.com/?q={q}", @@ -92,7 +92,7 @@ namespace Flow.Launcher.Plugin.WebSearch }, new SearchSource { - Title = "Github", + Title = "GitHub", ActionKeyword = "github", Icon = "github.png", Url = "https://github.com/search?q={q}", @@ -100,7 +100,7 @@ namespace Flow.Launcher.Plugin.WebSearch }, new SearchSource { - Title = "Github Gist", + Title = "GitHub Gist", ActionKeyword = "gist", Icon = "gist.png", Url = "https://gist.github.com/search?q={q}", @@ -124,7 +124,7 @@ namespace Flow.Launcher.Plugin.WebSearch }, new SearchSource { - Title = "Wolframalpha", + Title = "WolframAlpha", ActionKeyword = "wolframalpha", Icon = "wolframalpha.png", Url = "https://www.wolframalpha.com/input/?i={q}", @@ -132,7 +132,7 @@ namespace Flow.Launcher.Plugin.WebSearch }, new SearchSource { - Title = "Stackoverflow", + Title = "Stack Overflow", ActionKeyword = "stackoverflow", Icon = "stackoverflow.png", Url = "https://stackoverflow.com/search?q={q}", @@ -148,7 +148,7 @@ namespace Flow.Launcher.Plugin.WebSearch }, new SearchSource { - Title = "Google Image", + Title = "Google Images", ActionKeyword = "image", Icon = "google.png", Url = "https://www.google.com/search?q={q}&tbm=isch", @@ -156,7 +156,7 @@ namespace Flow.Launcher.Plugin.WebSearch }, new SearchSource { - Title = "Youtube", + Title = "YouTube", ActionKeyword = "youtube", Icon = "youtube.png", Url = "https://www.youtube.com/results?search_query={q}", @@ -225,4 +225,4 @@ namespace Flow.Launcher.Plugin.WebSearch public bool OpenInNewBrowser { get; set; } = true; } -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs index ccb5b20d7..d1fbd4ac5 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Baidu.cs @@ -16,7 +16,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources { private readonly Regex _reg = new Regex("window.baidu.sug\\((.*)\\)"); - public override async Task> Suggestions(string query, CancellationToken token) + public override async Task> SuggestionsAsync(string query, CancellationToken token) { string result; @@ -25,7 +25,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources const string api = "http://suggestion.baidu.com/su?json=1&wd="; result = await Http.GetAsync(api + Uri.EscapeUriString(query), token).ConfigureAwait(false); } - catch (Exception e) when (e is HttpRequestException || e.InnerException is TimeoutException) + catch (Exception e) when (e is HttpRequestException or {InnerException: TimeoutException}) { Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e); return null; diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs index 38c5fb4a0..971fc079c 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Bing.cs @@ -15,7 +15,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources { class Bing : SuggestionSource { - public override async Task> Suggestions(string query, CancellationToken token) + public override async Task> SuggestionsAsync(string query, CancellationToken token) { try @@ -40,7 +40,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources } - catch (Exception e) when (e is HttpRequestException || e.InnerException is TimeoutException) + catch (Exception e) when (e is HttpRequestException or {InnerException: TimeoutException}) { Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e); return null; diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs index c5f43d081..a6c18b1ef 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/Google.cs @@ -14,7 +14,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources { public class Google : SuggestionSource { - public override async Task> Suggestions(string query, CancellationToken token) + public override async Task> SuggestionsAsync(string query, CancellationToken token) { try { @@ -32,7 +32,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources return results.EnumerateArray().Select(o => o.GetString()).ToList(); } - catch (Exception e) when (e is HttpRequestException || e.InnerException is TimeoutException) + catch (Exception e) when (e is HttpRequestException or {InnerException: TimeoutException}) { Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e); return null; diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/SuggestionSource.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/SuggestionSource.cs index c58e61141..e89addee9 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/SuggestionSource.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SuggestionSources/SuggestionSource.cs @@ -6,6 +6,6 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources { public abstract class SuggestionSource { - public abstract Task> Suggestions(string query, CancellationToken token); + public abstract Task> SuggestionsAsync(string query, CancellationToken token); } } diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json b/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json index d9bc47f3b..9239e082c 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json @@ -26,7 +26,7 @@ "Name": "Web Searches", "Description": "Provide the web search ability", "Author": "qianlifeng", - "Version": "1.5.1", + "Version": "1.5.3", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll", diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json b/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json index c8f521653..533b894b8 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json @@ -8,7 +8,7 @@ "Enabled": true }, { - "Title": "Youtube", + "Title": "YouTube", "ActionKeyword": "youtube", "IconPath": "Images\\youtube.png", "Url": "http://www.youtube.com/results?search_query={q}", @@ -43,7 +43,7 @@ "Enabled": true }, { - "Title": "Youtube Music", + "Title": "YouTube Music", "ActionKeyword": "ytmusic", "IconPath": "Images\\youtubemusic.png", "Url": "https://music.youtube.com/search?q={q}", @@ -78,35 +78,35 @@ "Enabled": true }, { - "Title": "Duckduckgo", + "Title": "DuckDuckGo", "ActionKeyword": "duckduckgo", "IconPath": "Images\\duckduckgo.png", "Url": "https://duckduckgo.com/?q={q}", "Enabled": true }, { - "Title": "Github", + "Title": "GitHub", "ActionKeyword": "github", "IconPath": "Images\\github.png", "Url": "https://github.com/search?q={q}", "Enabled": true }, { - "Title": "Github Gist", + "Title": "GitHub Gist", "ActionKeyword": "gist", "IconPath": "Images\\gist.png", "Url": "https://gist.github.com/search?q={q}", "Enabled": true }, { - "Title": "Wolframalpha", + "Title": "WolframAlpha", "ActionKeyword": "wolframalpha", "IconPath": "Images\\wolframalpha.png", "Url": "http://www.wolframalpha.com/input/?i={q}", "Enabled": true }, { - "Title": "Stackoverflow", + "Title": "Stack Overflow", "ActionKeyword": "stackoverflow", "IconPath": "Images\\stackoverflow.png", "Url": "http://stackoverflow.com/search?q={q}", @@ -120,7 +120,7 @@ "Enabled": true }, { - "Title": "Google Image", + "Title": "Google Images", "ActionKeyword": "image", "IconPath": "Images\\google.png", "Url": "https://www.google.com/search?q={q}&tbm=isch", diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Launcher.Plugin.WindowsSettings.csproj b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Launcher.Plugin.WindowsSettings.csproj index c30fbf997..81ea31c21 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Launcher.Plugin.WindowsSettings.csproj +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Flow.Launcher.Plugin.WindowsSettings.csproj @@ -1,7 +1,7 @@ - + Library - net5.0-windows + net6.0-windows true true false diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs index 3005567c4..c693331e9 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Helper/ResultHelper.cs @@ -34,8 +34,9 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper var resultList = new List(); foreach (var entry in list) { - const int highScore = 20; - const int midScore = 10; + // Adjust the score to lower the order of many irrelevant matches from area strings + // that may only be for description. + const int nonNameMatchScoreAdj = 10; Result? result; Debug.Assert(_api != null, nameof(_api) + " != null"); @@ -44,7 +45,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper if (nameMatch.IsSearchPrecisionScoreMet()) { - var settingResult = NewSettingResult(nameMatch.Score + highScore, entry.Type); + var settingResult = NewSettingResult(nameMatch.Score, entry.Type); settingResult.TitleHighlightData = nameMatch.MatchData; result = settingResult; } @@ -53,7 +54,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper var areaMatch = _api.FuzzySearch(query.Search, entry.Area); if (areaMatch.IsSearchPrecisionScoreMet()) { - var settingResult = NewSettingResult(areaMatch.Score + midScore, entry.Type); + var settingResult = NewSettingResult(areaMatch.Score - nonNameMatchScoreAdj, entry.Type); result = settingResult; } else @@ -61,7 +62,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper result = entry.AltNames? .Select(altName => _api.FuzzySearch(query.Search, altName)) .Where(match => match.IsSearchPrecisionScoreMet()) - .Select(altNameMatch => NewSettingResult(altNameMatch.Score + midScore, entry.Type)) + .Select(altNameMatch => NewSettingResult(altNameMatch.Score - nonNameMatchScoreAdj, entry.Type)) .FirstOrDefault(); } @@ -75,7 +76,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper .SelectMany(x => x) .Contains(x, StringComparer.CurrentCultureIgnoreCase)) ) - result = NewSettingResult(midScore, entry.Type); + result = NewSettingResult(nonNameMatchScoreAdj, entry.Type); } } @@ -115,7 +116,7 @@ namespace Flow.Launcher.Plugin.WindowsSettings.Helper private static void AddOptionalToolTip(WindowsSetting entry, Result result) { var toolTipText = new StringBuilder(); - + var settingType = entry.Type == "AppSettingsApp" ? "System settings" : "Control Panel"; toolTipText.AppendLine($"{Resources.Application}: {settingType}"); diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.resx b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.resx index 6bb283e7b..dc6895d21 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.resx +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.resx @@ -1,4 +1,4 @@ - +