diff --git a/.editorconfig b/.editorconfig index 11a0bcdf6..e1b8ed79e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -58,7 +58,7 @@ dotnet_style_prefer_conditional_expression_over_return = true:silent ############################### # Style Definitions dotnet_naming_style.pascal_case_style.capitalization = pascal_case -# Use PascalCase for constant fields +# Use PascalCase for constant fields dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style @@ -134,7 +134,7 @@ csharp_preserve_single_line_statements = true csharp_preserve_single_line_blocks = true csharp_using_directive_placement = outside_namespace:silent csharp_prefer_simple_using_statement = true:suggestion -csharp_style_namespace_declarations = block_scoped:silent +csharp_style_namespace_declarations = file_scoped:silent csharp_style_prefer_method_group_conversion = true:silent csharp_style_expression_bodied_lambdas = true:silent csharp_style_expression_bodied_local_functions = false:silent diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 2d6fdb7f0..c4b1ee849 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -106,3 +106,4 @@ alreadyexists JsonRPC JsonRPCV2 Softpedia +img diff --git a/.github/workflows/default_plugins.yml b/.github/workflows/default_plugins.yml index a2283defe..a0a816877 100644 --- a/.github/workflows/default_plugins.yml +++ b/.github/workflows/default_plugins.yml @@ -18,7 +18,7 @@ jobs: dotnet-version: 7.0.x - name: Determine New Plugin Updates - uses: dorny/paths-filter@v2 + uses: dorny/paths-filter@v3 id: changes with: filters: | @@ -65,7 +65,7 @@ jobs: - name: Publish BrowserBookmark if: steps.changes.outputs.browserbookmark == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.BrowserBookmark" files: "Flow.Launcher.Plugin.BrowserBookmark.zip" @@ -92,7 +92,7 @@ jobs: - name: Publish Calculator if: steps.changes.outputs.calculator == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.Calculator" files: "Flow.Launcher.Plugin.Calculator.zip" @@ -119,7 +119,7 @@ jobs: - name: Publish Explorer if: steps.changes.outputs.explorer == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.Explorer" files: "Flow.Launcher.Plugin.Explorer.zip" @@ -146,7 +146,7 @@ jobs: - name: Publish PluginIndicator if: steps.changes.outputs.pluginindicator == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.PluginIndicator" files: "Flow.Launcher.Plugin.PluginIndicator.zip" @@ -173,7 +173,7 @@ jobs: - name: Publish PluginsManager if: steps.changes.outputs.pluginsmanager == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.PluginsManager" files: "Flow.Launcher.Plugin.PluginsManager.zip" @@ -200,7 +200,7 @@ jobs: - name: Publish ProcessKiller if: steps.changes.outputs.processkiller == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.ProcessKiller" files: "Flow.Launcher.Plugin.ProcessKiller.zip" @@ -227,7 +227,7 @@ jobs: - name: Publish Program if: steps.changes.outputs.program == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.Program" files: "Flow.Launcher.Plugin.Program.zip" @@ -254,7 +254,7 @@ jobs: - name: Publish Shell if: steps.changes.outputs.shell == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.Shell" files: "Flow.Launcher.Plugin.Shell.zip" @@ -281,7 +281,7 @@ jobs: - name: Publish Sys if: steps.changes.outputs.sys == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.Sys" files: "Flow.Launcher.Plugin.Sys.zip" @@ -308,7 +308,7 @@ jobs: - name: Publish Url if: steps.changes.outputs.url == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.Url" files: "Flow.Launcher.Plugin.Url.zip" @@ -335,7 +335,7 @@ jobs: - name: Publish WebSearch if: steps.changes.outputs.websearch == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.WebSearch" files: "Flow.Launcher.Plugin.WebSearch.zip" @@ -362,7 +362,7 @@ jobs: - name: Publish WindowsSettings if: steps.changes.outputs.windowssettings == 'true' - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: repository: "Flow-Launcher/Flow.Launcher.Plugin.WindowsSettings" files: "Flow.Launcher.Plugin.WindowsSettings.zip" diff --git a/Flow.Launcher.Core/Flow.Launcher.Core.csproj b/Flow.Launcher.Core/Flow.Launcher.Core.csproj index 68e7c115c..18101ccf0 100644 --- a/Flow.Launcher.Core/Flow.Launcher.Core.csproj +++ b/Flow.Launcher.Core/Flow.Launcher.Core.csproj @@ -56,9 +56,9 @@ - + - + diff --git a/Flow.Launcher.Core/Plugin/ExecutablePluginV2.cs b/Flow.Launcher.Core/Plugin/ExecutablePluginV2.cs index ee1b315c2..852f57b9f 100644 --- a/Flow.Launcher.Core/Plugin/ExecutablePluginV2.cs +++ b/Flow.Launcher.Core/Plugin/ExecutablePluginV2.cs @@ -12,15 +12,9 @@ namespace Flow.Launcher.Core.Plugin public ExecutablePluginV2(string filename) { - StartInfo = new ProcessStartInfo - { - FileName = filename, - UseShellExecute = false, - CreateNoWindow = true, - RedirectStandardOutput = true, - RedirectStandardError = true - }; + StartInfo = new ProcessStartInfo { FileName = filename }; } + protected override MessageHandlerType MessageHandler { get; } = MessageHandlerType.NewLineDelimited; } } diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs index 390da072b..46c72624a 100644 --- a/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs +++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs @@ -15,8 +15,6 @@ namespace Flow.Launcher.Core.Plugin { internal abstract class JsonRPCPluginV2 : JsonRPCPluginBase, IAsyncDisposable, IAsyncReloadable, IResultUpdated { - public abstract string SupportedLanguage { get; set; } - public const string JsonRpc = "JsonRPC"; protected abstract IDuplexPipe ClientPipe { get; set; } @@ -41,9 +39,23 @@ namespace Flow.Launcher.Core.Plugin } } + private JoinableTaskFactory JTF { get; } = new JoinableTaskFactory(new JoinableTaskContext()); + public override List LoadContextMenus(Result selectedResult) { - throw new NotImplementedException(); + try + { + var res = JTF.Run(() => RPC.InvokeWithCancellationAsync("context_menu", + new object[] { selectedResult.ContextData })); + + var results = ParseResults(res); + + return results; + } + catch + { + return new List(); + } } public override async Task> QueryAsync(Query query, CancellationToken token) @@ -51,7 +63,7 @@ namespace Flow.Launcher.Core.Plugin try { var res = await RPC.InvokeWithCancellationAsync("query", - new[] { query }, + new object[] { query, Settings.Inner }, token); var results = ParseResults(res); @@ -88,12 +100,26 @@ namespace Flow.Launcher.Core.Plugin public event ResultUpdatedEventHandler ResultsUpdated; + protected enum MessageHandlerType + { + HeaderDelimited, + LengthHeaderDelimited, + NewLineDelimited + } + + protected abstract MessageHandlerType MessageHandler { get; } + private void SetupJsonRPC() { var formatter = new SystemTextJsonFormatter { JsonSerializerOptions = RequestSerializeOption }; - var handler = new NewLineDelimitedMessageHandler(ClientPipe, - formatter); + IJsonRpcMessageHandler handler = MessageHandler switch + { + MessageHandlerType.HeaderDelimited => new HeaderDelimitedMessageHandler(ClientPipe, formatter), + MessageHandlerType.LengthHeaderDelimited => new LengthHeaderMessageHandler(ClientPipe, formatter), + MessageHandlerType.NewLineDelimited => new NewLineDelimitedMessageHandler(ClientPipe, formatter), + _ => throw new ArgumentOutOfRangeException() + }; RPC = new JsonRpc(handler, new JsonRPCPublicAPI(Context.API)); diff --git a/Flow.Launcher.Core/Plugin/NodePluginV2.cs b/Flow.Launcher.Core/Plugin/NodePluginV2.cs index 6c95777f0..c8cc37c57 100644 --- a/Flow.Launcher.Core/Plugin/NodePluginV2.cs +++ b/Flow.Launcher.Core/Plugin/NodePluginV2.cs @@ -10,29 +10,21 @@ namespace Flow.Launcher.Core.Plugin /// /// Execution of JavaScript & TypeScript plugins /// - internal class NodePluginV2 : ProcessStreamPluginV2 + internal sealed class NodePluginV2 : ProcessStreamPluginV2 { public NodePluginV2(string filename) { - StartInfo = new ProcessStartInfo - { - FileName = filename, - UseShellExecute = false, - CreateNoWindow = true, - RedirectStandardOutput = true, - RedirectStandardError = true - }; + StartInfo = new ProcessStartInfo { FileName = filename, }; } - public override string SupportedLanguage { get; set; } protected override ProcessStartInfo StartInfo { get; set; } public override async Task InitAsync(PluginInitContext context) { StartInfo.ArgumentList.Add(context.CurrentPluginMetadata.ExecuteFilePath); - StartInfo.ArgumentList.Add(string.Empty); - StartInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory; await base.InitAsync(context); } + + protected override MessageHandlerType MessageHandler { get; } = MessageHandlerType.HeaderDelimited; } } diff --git a/Flow.Launcher.Core/Plugin/ProcessStreamPluginV2.cs b/Flow.Launcher.Core/Plugin/ProcessStreamPluginV2.cs index 16f9dfbf9..a14baf271 100644 --- a/Flow.Launcher.Core/Plugin/ProcessStreamPluginV2.cs +++ b/Flow.Launcher.Core/Plugin/ProcessStreamPluginV2.cs @@ -1,4 +1,6 @@ -using System; +#nullable enable + +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO.Pipelines; @@ -6,6 +8,7 @@ using System.Threading.Tasks; using Flow.Launcher.Infrastructure; using Flow.Launcher.Plugin; using Meziantou.Framework.Win32; +using Microsoft.VisualBasic.ApplicationServices; using Nerdbank.Streams; namespace Flow.Launcher.Core.Plugin @@ -18,18 +21,18 @@ namespace Flow.Launcher.Core.Plugin { _jobObject.SetLimits(new JobObjectLimits() { - Flags = JobObjectLimitFlags.KillOnJobClose | JobObjectLimitFlags.DieOnUnhandledException + Flags = JobObjectLimitFlags.KillOnJobClose | JobObjectLimitFlags.DieOnUnhandledException | + JobObjectLimitFlags.SilentBreakawayOk }); - + _jobObject.AssignProcess(Process.GetCurrentProcess()); } - public override string SupportedLanguage { get; set; } - protected sealed override IDuplexPipe ClientPipe { get; set; } + protected sealed override IDuplexPipe ClientPipe { get; set; } = null!; protected abstract ProcessStartInfo StartInfo { get; set; } - protected Process ClientProcess { get; set; } + protected Process ClientProcess { get; set; } = null!; public override async Task InitAsync(PluginInitContext context) { @@ -37,12 +40,18 @@ namespace Flow.Launcher.Core.Plugin StartInfo.EnvironmentVariables["FLOW_PROGRAM_DIRECTORY"] = Constant.ProgramDirectory; StartInfo.EnvironmentVariables["FLOW_APPLICATION_DIRECTORY"] = Constant.ApplicationDirectory; - StartInfo.ArgumentList.Add(context.CurrentPluginMetadata.ExecuteFilePath); + StartInfo.RedirectStandardError = true; + StartInfo.RedirectStandardInput = true; + StartInfo.RedirectStandardOutput = true; + StartInfo.CreateNoWindow = true; + StartInfo.UseShellExecute = false; StartInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory; - ClientProcess = Process.Start(StartInfo); - ArgumentNullException.ThrowIfNull(ClientProcess); - + var process = Process.Start(StartInfo); + ArgumentNullException.ThrowIfNull(process); + ClientProcess = process; + _jobObject.AssignProcess(ClientProcess); + SetupPipe(ClientProcess); ErrorStream = ClientProcess.StandardError; diff --git a/Flow.Launcher.Core/Plugin/PythonPluginV2.cs b/Flow.Launcher.Core/Plugin/PythonPluginV2.cs index 4a8d8d7de..5c36e0eea 100644 --- a/Flow.Launcher.Core/Plugin/PythonPluginV2.cs +++ b/Flow.Launcher.Core/Plugin/PythonPluginV2.cs @@ -18,20 +18,11 @@ namespace Flow.Launcher.Core.Plugin { internal sealed class PythonPluginV2 : ProcessStreamPluginV2 { - public override string SupportedLanguage { get; set; } = AllowedLanguage.Python; protected override ProcessStartInfo StartInfo { get; set; } - + public PythonPluginV2(string filename) { - StartInfo = new ProcessStartInfo - { - FileName = filename, - UseShellExecute = false, - CreateNoWindow = true, - RedirectStandardOutput = true, - RedirectStandardError = true, - RedirectStandardInput = true - }; + StartInfo = new ProcessStartInfo { FileName = filename, }; var path = Path.Combine(Constant.ProgramDirectory, JsonRpc); StartInfo.EnvironmentVariables["PYTHONPATH"] = path; @@ -39,5 +30,13 @@ namespace Flow.Launcher.Core.Plugin //Add -B flag to tell python don't write .py[co] files. Because .pyc contains location infos which will prevent python portable StartInfo.ArgumentList.Add("-B"); } + + public override async Task InitAsync(PluginInitContext context) + { + StartInfo.ArgumentList.Add(context.CurrentPluginMetadata.ExecuteFilePath); + await base.InitAsync(context); + } + + protected override MessageHandlerType MessageHandler { get; } = MessageHandlerType.NewLineDelimited; } } diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj index b24f069c1..831091732 100644 --- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj +++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj @@ -49,11 +49,12 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/Flow.Launcher.Infrastructure/Image/ImageCache.cs b/Flow.Launcher.Infrastructure/Image/ImageCache.cs index 7a2b57637..55545b9a7 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageCache.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageCache.cs @@ -4,13 +4,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Windows.Media; +using FastCache; +using FastCache.Services; namespace Flow.Launcher.Infrastructure.Image { - [Serializable] public class ImageUsage { - public int usage; public ImageSource imageSource; @@ -23,16 +23,13 @@ namespace Flow.Launcher.Infrastructure.Image public class ImageCache { - private const int MaxCached = 50; - public ConcurrentDictionary<(string, bool), ImageUsage> Data { get; } = new(); - private const int permissibleFactor = 2; - private SemaphoreSlim semaphore = new(1, 1); + private const int MaxCached = 150; public void Initialize(Dictionary<(string, bool), int> usage) { foreach (var key in usage.Keys) { - Data[key] = new ImageUsage(usage[key], null); + Cached.Save(key, new ImageUsage(usage[key], null), TimeSpan.MaxValue, MaxCached); } } @@ -40,70 +37,48 @@ namespace Flow.Launcher.Infrastructure.Image { get { - if (!Data.TryGetValue((path, isFullImage), out var value)) + if (!Cached.TryGet((path, isFullImage), out var value)) { return null; } - value.usage++; - return value.imageSource; + value.Value.usage++; + return value.Value.imageSource; } set { - Data.AddOrUpdate( - (path, isFullImage), - new ImageUsage(0, value), - (k, v) => - { - v.imageSource = value; - v.usage++; - return v; - } - ); - - SliceExtra(); - - async void SliceExtra() + if (Cached.TryGet((path, isFullImage), out var cached)) { - // To prevent the dictionary from drastically increasing in size by caching images, the dictionary size is not allowed to grow more than the permissibleFactor * maxCached size - // This is done so that we don't constantly perform this resizing operation and also maintain the image cache size at the same time - if (Data.Count > permissibleFactor * MaxCached) - { - await semaphore.WaitAsync().ConfigureAwait(false); - // 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)) - Data.TryRemove(key, out _); - semaphore.Release(); - } + cached.Value.imageSource = value; + cached.Value.usage++; } + + Cached.Save((path, isFullImage), new ImageUsage(0, value), TimeSpan.MaxValue, + MaxCached); } } public bool ContainsKey(string key, bool isFullImage) { - return key is not null && Data.ContainsKey((key, isFullImage)) && Data[(key, isFullImage)].imageSource != null; + return Cached.TryGet((key, isFullImage), out _); } public bool TryGetValue(string key, bool isFullImage, out ImageSource image) { - if (key is not null) + if (Cached.TryGet((key, isFullImage), out var value)) { - bool hasKey = Data.TryGetValue((key, isFullImage), out var imageUsage); - image = hasKey ? imageUsage.imageSource : null; - return hasKey; - } - else - { - image = null; - return false; + image = value.Value.imageSource; + value.Value.usage++; + return image != null; } + + image = null; + return false; } public int CacheSize() { - return Data.Count; + return CacheManager.TotalCount<(string, bool), ImageUsage>(); } /// @@ -111,7 +86,14 @@ namespace Flow.Launcher.Infrastructure.Image /// public int UniqueImagesInCache() { - return Data.Values.Select(x => x.imageSource).Distinct().Count(); + return CacheManager.EnumerateEntries<(string, bool), ImageUsage>().Select(x => x.Value.imageSource) + .Distinct() + .Count(); + } + + public IEnumerable> EnumerateEntries() + { + return CacheManager.EnumerateEntries<(string, bool), ImageUsage>(); } } } diff --git a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs index add6d4e92..75c2a4ec9 100644 --- a/Flow.Launcher.Infrastructure/Image/ImageLoader.cs +++ b/Flow.Launcher.Infrastructure/Image/ImageLoader.cs @@ -49,7 +49,7 @@ namespace Flow.Launcher.Infrastructure.Image { await Stopwatch.NormalAsync("|ImageLoader.Initialize|Preload images cost", async () => { - foreach (var ((path, isFullImage), _) in ImageCache.Data) + foreach (var ((path, isFullImage), _) in usage) { await LoadAsync(path, isFullImage); } @@ -65,7 +65,7 @@ namespace Flow.Launcher.Infrastructure.Image try { - _storage.SaveAsync(ImageCache.Data + await _storage.SaveAsync(ImageCache.EnumerateEntries() .ToDictionary( x => x.Key, x => x.Value.usage)); @@ -125,9 +125,12 @@ namespace Flow.Launcher.Infrastructure.Image return new ImageResult(MissingImage, ImageType.Error); } - if (ImageCache.ContainsKey(path, loadFullImage)) + // extra scope for use of same variable name { - return new ImageResult(ImageCache[path, loadFullImage], ImageType.Cache); + if (ImageCache.TryGetValue(path, loadFullImage, out var imageSource)) + { + return new ImageResult(imageSource, ImageType.Cache); + } } if (Uri.TryCreate(path, UriKind.RelativeOrAbsolute, out var uriResult) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index ca1674315..274f88dc6 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -54,6 +54,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool UseGlyphIcons { get; set; } = true; public bool UseAnimation { get; set; } = true; public bool UseSound { get; set; } = true; + public double SoundVolume { get; set; } = 50; + public bool UseClock { get; set; } = true; public bool UseDate { get; set; } = false; public string TimeFormat { get; set; } = "hh:mm tt"; diff --git a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj index cc89afbc2..7b0880b67 100644 --- a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj +++ b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj @@ -14,10 +14,10 @@ - 4.2.0 - 4.2.0 - 4.2.0 - 4.2.0 + 4.3.0 + 4.3.0 + 4.3.0 + 4.3.0 Flow.Launcher.Plugin Flow-Launcher MIT diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index 49fe680f1..c95a8ce7b 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -291,5 +291,12 @@ namespace Flow.Launcher.Plugin /// /// public bool IsGameModeOn(); + + /// + /// Reloads the query. + /// This method should run + /// + /// Choose the first result after reload if true; keep the last selected result if false. Default is true. + public void ReQuery(bool reselect = true); } } diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index bfb0b0411..fc6c5d185 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -183,6 +183,31 @@ namespace Flow.Launcher.Plugin return Title + SubTitle + Score; } + /// + /// Clones the current result + /// + public Result Clone() + { + return new Result + { + Title = Title, + SubTitle = SubTitle, + ActionKeywordAssigned = ActionKeywordAssigned, + CopyText = CopyText, + AutoCompleteText = AutoCompleteText, + IcoPath = IcoPath, + RoundedIcon = RoundedIcon, + Icon = Icon, + Glyph = Glyph, + Action = Action, + AsyncAction = AsyncAction, + Score = Score, + TitleHighlightData = TitleHighlightData, + OriginQuery = OriginQuery, + PluginDirectory = PluginDirectory + }; + } + /// /// Additional data associated with this result /// diff --git a/Flow.Launcher.Test/Flow.Launcher.Test.csproj b/Flow.Launcher.Test/Flow.Launcher.Test.csproj index 29414baa6..fd967de4a 100644 --- a/Flow.Launcher.Test/Flow.Launcher.Test.csproj +++ b/Flow.Launcher.Test/Flow.Launcher.Test.csproj @@ -54,7 +54,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + \ No newline at end of file diff --git a/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs b/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs index 0bff23fe1..41e879913 100644 --- a/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs +++ b/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs @@ -3,53 +3,38 @@ using System.Globalization; using System.Windows.Data; using System.Windows.Input; -namespace Flow.Launcher.Converters -{ - internal class BoolToIMEConversionModeConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value is bool v) - { - if (v) - { - return ImeConversionModeValues.Alphanumeric; - } - else - { - return ImeConversionModeValues.DoNotCare; - } - } - return ImeConversionModeValues.DoNotCare; - } +namespace Flow.Launcher.Converters; - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) +internal class BoolToIMEConversionModeConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value switch { - throw new NotImplementedException(); - } + true => ImeConversionModeValues.Alphanumeric, + _ => ImeConversionModeValues.DoNotCare + }; } - internal class BoolToIMEStateConverter : IValueConverter + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value is bool v) - { - if (v) - { - return InputMethodState.Off; - } - else - { - return InputMethodState.DoNotCare; - } - } - return InputMethodState.DoNotCare; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } + throw new NotImplementedException(); + } +} + +internal class BoolToIMEStateConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value switch + { + true => InputMethodState.Off, + _ => InputMethodState.DoNotCare + }; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); } } diff --git a/Flow.Launcher/Converters/BoolToVisibilityConverter.cs b/Flow.Launcher/Converters/BoolToVisibilityConverter.cs index 627937c7f..c0fe6ab55 100644 --- a/Flow.Launcher/Converters/BoolToVisibilityConverter.cs +++ b/Flow.Launcher/Converters/BoolToVisibilityConverter.cs @@ -2,70 +2,39 @@ using System.Windows; using System.Windows.Data; -namespace Flow.Launcher.Converters +namespace Flow.Launcher.Converters; + +public class BoolToVisibilityConverter : IValueConverter { - public class BoolToVisibilityConverter : IValueConverter + public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) { - public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) + return (value, parameter) switch { - if (parameter != null) - { - if (value is true) - { - return Visibility.Collapsed; - } + (true, not null) => Visibility.Collapsed, + (_, not null) => Visibility.Visible, - else - { - return Visibility.Visible; - } - } - else { - if (value is true) - { - return Visibility.Visible; - } - - else { - return Visibility.Collapsed; - } - } - } - - public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException(); + (true, null) => Visibility.Visible, + (_, null) => Visibility.Collapsed + }; } - public class SplitterConverter : IValueConverter - /* Prevents the dragging part of the preview area from working when preview is turned off. */ - { - public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) - { - if (parameter != null) - { - if (value is true) - { - return 0; - } - - else - { - return 5; - } - } - else - { - if (value is true) - { - return 5; - } - - else - { - return 0; - } - } - } - - public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException(); - } + public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException(); +} + +public class SplitterConverter : IValueConverter +/* Prevents the dragging part of the preview area from working when preview is turned off. */ +{ + public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) + { + return (value, parameter) switch + { + (true, not null) => 0, + (_, not null) => 5, + + (true, null) => 5, + (_, null) => 0 + }; + } + + public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException(); } diff --git a/Flow.Launcher/Converters/BorderClipConverter.cs b/Flow.Launcher/Converters/BorderClipConverter.cs index c0bce2cd9..9b0579c33 100644 --- a/Flow.Launcher/Converters/BorderClipConverter.cs +++ b/Flow.Launcher/Converters/BorderClipConverter.cs @@ -7,46 +7,41 @@ using System.Windows.Shapes; // For Clipping inside listbox item -namespace Flow.Launcher.Converters +namespace Flow.Launcher.Converters; + +public class BorderClipConverter : IMultiValueConverter { - public class BorderClipConverter : IMultiValueConverter + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + if (values is not [double width, double height, CornerRadius radius]) { - if (values.Length == 3 && values[0] is double && values[1] is double && values[2] is CornerRadius) - { - var width = (double)values[0]; - var height = (double)values[1]; - Path myPath = new Path(); - if (width < Double.Epsilon || height < Double.Epsilon) - { - return Geometry.Empty; - } - var radius = (CornerRadius)values[2]; - var radiusHeight = radius.TopLeft; - - // Drawing Round box for bottom round, and rect for top area of listbox. - var corner = new RectangleGeometry(new Rect(0, 0, width, height), radius.TopLeft, radius.TopLeft); - var box = new RectangleGeometry(new Rect(0, 0, width, radiusHeight), 0, 0); - - GeometryGroup myGeometryGroup = new GeometryGroup(); - myGeometryGroup.Children.Add(corner); - myGeometryGroup.Children.Add(box); - - CombinedGeometry c1 = new CombinedGeometry(GeometryCombineMode.Union, corner, box); - myPath.Data = c1; - - myPath.Data.Freeze(); - return myPath.Data; - } - return DependencyProperty.UnsetValue; } - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + Path myPath = new Path(); + if (width < Double.Epsilon || height < Double.Epsilon) { - throw new NotSupportedException(); + return Geometry.Empty; } + var radiusHeight = radius.TopLeft; + + // Drawing Round box for bottom round, and rect for top area of listbox. + var corner = new RectangleGeometry(new Rect(0, 0, width, height), radius.TopLeft, radius.TopLeft); + var box = new RectangleGeometry(new Rect(0, 0, width, radiusHeight), 0, 0); + + GeometryGroup myGeometryGroup = new GeometryGroup(); + myGeometryGroup.Children.Add(corner); + myGeometryGroup.Children.Add(box); + + CombinedGeometry c1 = new CombinedGeometry(GeometryCombineMode.Union, corner, box); + myPath.Data = c1; + + myPath.Data.Freeze(); + return myPath.Data; } + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotSupportedException(); + } } diff --git a/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs b/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs index 3c46fd01a..7d75ffd5c 100644 --- a/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs +++ b/Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs @@ -2,18 +2,17 @@ using System.Globalization; using System.Windows.Data; -namespace Flow.Launcher.Converters -{ - public class DateTimeFormatToNowConverter : IValueConverter - { +namespace Flow.Launcher.Converters; - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return value is not string format ? null : DateTime.Now.ToString(format); - } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } +public class DateTimeFormatToNowConverter : IValueConverter +{ + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value is not string format ? null : DateTime.Now.ToString(format); + } + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); } } diff --git a/Flow.Launcher/Converters/DiameterToCenterPointConverter.cs b/Flow.Launcher/Converters/DiameterToCenterPointConverter.cs index e81bb2507..24a316603 100644 --- a/Flow.Launcher/Converters/DiameterToCenterPointConverter.cs +++ b/Flow.Launcher/Converters/DiameterToCenterPointConverter.cs @@ -3,23 +3,22 @@ using System.Globalization; using System.Windows; using System.Windows.Data; -namespace Flow.Launcher.Converters +namespace Flow.Launcher.Converters; + +public class DiameterToCenterPointConverter : IValueConverter { - public class DiameterToCenterPointConverter : IValueConverter + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + if (value is double d) { - if (value is double d) - { - return new Point(d / 2, d / 2); - } - - return new Point(0, 0); + return new Point(d / 2, d / 2); } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotSupportedException(); - } + return new Point(0, 0); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotSupportedException(); } } diff --git a/Flow.Launcher/Converters/HighlightTextConverter.cs b/Flow.Launcher/Converters/HighlightTextConverter.cs index cb62c0d3d..436f5fed5 100644 --- a/Flow.Launcher/Converters/HighlightTextConverter.cs +++ b/Flow.Launcher/Converters/HighlightTextConverter.cs @@ -1,53 +1,48 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; using System.Windows; using System.Windows.Data; using System.Windows.Documents; -namespace Flow.Launcher.Converters +namespace Flow.Launcher.Converters; + +public class HighlightTextConverter : IMultiValueConverter { - public class HighlightTextConverter : IMultiValueConverter + public object Convert(object[] value, Type targetType, object parameter, CultureInfo cultureInfo) { - public object Convert(object[] value, Type targetType, object parameter, CultureInfo cultureInfo) + if (value.Length < 2) + return new Run(string.Empty); + + if (value[0] is not string text) + return new Run(string.Empty); + + if (value[1] is not List { Count: > 0 } highlightData) + // No highlight data, just return the text + return new Run(text); + + var highlightStyle = (Style)Application.Current.FindResource("HighlightStyle"); + var textBlock = new Span(); + + for (var i = 0; i < text.Length; i++) { - var text = value[0] as string; - var highlightData = value[1] as List; - - var textBlock = new Span(); - - if (highlightData == null || !highlightData.Any()) + var currentCharacter = text.Substring(i, 1); + var run = new Run(currentCharacter) { - // No highlight data, just return the text - return new Run(text); - } - - for (var i = 0; i < text.Length; i++) - { - var currentCharacter = text.Substring(i, 1); - if (this.ShouldHighlight(highlightData, i)) - { - - textBlock.Inlines.Add(new Run(currentCharacter) { Style = (Style)Application.Current.FindResource("HighlightStyle") }); - - } - else - { - textBlock.Inlines.Add(new Run(currentCharacter)); - } - } - return textBlock; + Style = ShouldHighlight(highlightData, i) ? highlightStyle : null + }; + textBlock.Inlines.Add(run); } + return textBlock; + } - public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture) - { - return new[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; - } + public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture) + { + return new[] { DependencyProperty.UnsetValue, DependencyProperty.UnsetValue }; + } - private bool ShouldHighlight(List highlightData, int index) - { - return highlightData.Contains(index); - } + private bool ShouldHighlight(List highlightData, int index) + { + return highlightData.Contains(index); } } diff --git a/Flow.Launcher/Converters/IconRadiusConverter.cs b/Flow.Launcher/Converters/IconRadiusConverter.cs index c73bef8b2..d26b39d6b 100644 --- a/Flow.Launcher/Converters/IconRadiusConverter.cs +++ b/Flow.Launcher/Converters/IconRadiusConverter.cs @@ -2,25 +2,19 @@ using System.Globalization; using System.Windows.Data; -namespace Flow.Launcher.Converters -{ - public class IconRadiusConverter : IMultiValueConverter - { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) - { - if (values.Length != 2) - throw new ArgumentException("IconRadiusConverter must have 2 parameters"); +namespace Flow.Launcher.Converters; - return values[1] switch - { - true => (double)values[0] / 2, - false => (double)values[0], - _ => throw new ArgumentException("The second argument should be boolean", nameof(values)) - }; - } - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) - { - throw new NotSupportedException(); - } +public class IconRadiusConverter : IMultiValueConverter +{ + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + if (values is not [double size, bool isIconCircular]) + throw new ArgumentException("IconRadiusConverter must have 2 parameters: [double, bool]"); + + return isIconCircular ? size / 2 : size; + } + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotSupportedException(); } } diff --git a/Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs b/Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs index a44b07cab..7ab13190a 100644 --- a/Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs +++ b/Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs @@ -4,24 +4,23 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Data; -namespace Flow.Launcher.Converters +namespace Flow.Launcher.Converters; + +[ValueConversion(typeof(bool), typeof(Visibility))] +public class OpenResultHotkeyVisibilityConverter : IValueConverter { - [ValueConversion(typeof(bool), typeof(Visibility))] - public class OpenResultHotkeyVisibilityConverter : IValueConverter + private const int MaxVisibleHotkeys = 10; + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - private const int MaxVisibleHotkeys = 10; + var number = int.MaxValue; - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var number = int.MaxValue; + if (value is ListBoxItem listBoxItem + && ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox) + number = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1; - if (value is ListBoxItem listBoxItem - && ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox) - number = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1; - - return number <= MaxVisibleHotkeys ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException(); + return number <= MaxVisibleHotkeys ? Visibility.Visible : Visibility.Collapsed; } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new InvalidOperationException(); } diff --git a/Flow.Launcher/Converters/OrdinalConverter.cs b/Flow.Launcher/Converters/OrdinalConverter.cs index 02b9bdbde..9aed2e07b 100644 --- a/Flow.Launcher/Converters/OrdinalConverter.cs +++ b/Flow.Launcher/Converters/OrdinalConverter.cs @@ -1,23 +1,24 @@ +using System; using System.Globalization; using System.Windows.Controls; using System.Windows.Data; -namespace Flow.Launcher.Converters -{ - public class OrdinalConverter : IValueConverter - { - public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) - { - if (value is ListBoxItem listBoxItem - && ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox) - { - var res = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1; - return res == 10 ? 0 : res; // 10th item => HOTKEY+0 - } +namespace Flow.Launcher.Converters; +public class OrdinalConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is not ListBoxItem listBoxItem + || ItemsControl.ItemsControlFromItemContainer(listBoxItem) is not ListBox listBox) + { return 0; } - public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException(); + var res = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1; + return res == 10 ? 0 : res; // 10th item => HOTKEY+0 + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new InvalidOperationException(); } diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs index 1e39473e0..fabd01a24 100644 --- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs +++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs @@ -6,74 +6,62 @@ using System.Windows.Media; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.ViewModel; -namespace Flow.Launcher.Converters +namespace Flow.Launcher.Converters; + +public class QuerySuggestionBoxConverter : IMultiValueConverter { - public class QuerySuggestionBoxConverter : IMultiValueConverter + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + // values[0] is TextBox: The textbox displaying the autocomplete suggestion + // values[1] is ResultViewModel: Currently selected item in the list + // values[2] is string: Query text + if ( + values.Length != 3 || + values[0] is not TextBox queryTextBox || + values[1] is null || + values[2] is not string queryText || + string.IsNullOrEmpty(queryText) + ) + return string.Empty; + + if (values[1] is not ResultViewModel selectedItem) + return Binding.DoNothing; + + try { - if (values.Length != 3) - { - return string.Empty; - } - var QueryTextBox = values[0] as TextBox; + var selectedResult = selectedItem.Result; + var selectedResultActionKeyword = string.IsNullOrEmpty(selectedResult.ActionKeywordAssigned) ? "" : selectedResult.ActionKeywordAssigned + " "; + var selectedResultPossibleSuggestion = selectedResultActionKeyword + selectedResult.Title; - var queryText = (string)values[2]; - - if (string.IsNullOrEmpty(queryText)) + if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase)) return string.Empty; - // second prop is the current selected item result - var val = values[1]; - if (val == null) - { + + // For AutocompleteQueryCommand. + // When user typed lower case and result title is uppercase, we still want to display suggestion + selectedItem.QuerySuggestionText = queryText + selectedResultPossibleSuggestion.Substring(queryText.Length); + + // Check if Text will be larger than our QueryTextBox + Typeface typeface = new Typeface(queryTextBox.FontFamily, queryTextBox.FontStyle, queryTextBox.FontWeight, queryTextBox.FontStretch); + // TODO: Obsolete warning? + var ft = new FormattedText(queryTextBox.Text, CultureInfo.DefaultThreadCurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, queryTextBox.FontSize, Brushes.Black); + + var offset = queryTextBox.Padding.Right; + + if (ft.Width + offset > queryTextBox.ActualWidth || queryTextBox.HorizontalOffset != 0) return string.Empty; - } - if (!(val is ResultViewModel)) - { - return System.Windows.Data.Binding.DoNothing; - } - try - { - var selectedItem = (ResultViewModel)val; - - var selectedResult = selectedItem.Result; - var selectedResultActionKeyword = string.IsNullOrEmpty(selectedResult.ActionKeywordAssigned) ? "" : selectedResult.ActionKeywordAssigned + " "; - var selectedResultPossibleSuggestion = selectedResultActionKeyword + selectedResult.Title; - - if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase)) - return string.Empty; - - - // For AutocompleteQueryCommand. - // When user typed lower case and result title is uppercase, we still want to display suggestion - selectedItem.QuerySuggestionText = queryText + selectedResultPossibleSuggestion.Substring(queryText.Length); - - // Check if Text will be larger then our QueryTextBox - System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch); - // TODO: Obsolete warning? - System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.DefaultThreadCurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black); - - var offset = QueryTextBox.Padding.Right; - - if ((ft.Width + offset) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0) - { - return string.Empty; - }; - - return selectedItem.QuerySuggestionText; - } - catch (Exception e) - { - Log.Exception(nameof(QuerySuggestionBoxConverter), "fail to convert text for suggestion box", e); - return string.Empty; - } + return selectedItem.QuerySuggestionText; } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + catch (Exception e) { - throw new NotImplementedException(); + Log.Exception(nameof(QuerySuggestionBoxConverter), "fail to convert text for suggestion box", e); + return string.Empty; } } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } } diff --git a/Flow.Launcher/Converters/StringToKeyBindingConverter.cs b/Flow.Launcher/Converters/StringToKeyBindingConverter.cs index 3675f06fc..21bf584e7 100644 --- a/Flow.Launcher/Converters/StringToKeyBindingConverter.cs +++ b/Flow.Launcher/Converters/StringToKeyBindingConverter.cs @@ -3,30 +3,27 @@ using System.Globalization; using System.Windows.Data; using System.Windows.Input; -namespace Flow.Launcher.Converters -{ - class StringToKeyBindingConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var mode = parameter as string; - var hotkeyStr = value as string; - var converter = new KeyGestureConverter(); - var key = (KeyGesture)converter.ConvertFromString(hotkeyStr); - if (mode == "key") - { - return key.Key; - } - else if (mode == "modifiers") - { - return key.Modifiers; - } - return null; - } +namespace Flow.Launcher.Converters; - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) +class StringToKeyBindingConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (parameter is not string mode || value is not string hotkeyStr) + return null; + + var converter = new KeyGestureConverter(); + var key = (KeyGesture)converter.ConvertFromString(hotkeyStr); + return mode switch { - throw new NotImplementedException(); - } + "key" => key?.Key, + "modifiers" => key?.Modifiers, + _ => null + }; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); } } diff --git a/Flow.Launcher/Converters/TextConverter.cs b/Flow.Launcher/Converters/TextConverter.cs index 90d445776..5f0e1ea82 100644 --- a/Flow.Launcher/Converters/TextConverter.cs +++ b/Flow.Launcher/Converters/TextConverter.cs @@ -4,29 +4,27 @@ using System.Windows.Data; using Flow.Launcher.Core.Resource; using Flow.Launcher.ViewModel; -namespace Flow.Launcher.Converters -{ - public class TextConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var ID = value.ToString(); - switch(ID) - { - case PluginStoreItemViewModel.NewRelease: - return InternationalizationManager.Instance.GetTranslation("pluginStore_NewRelease"); - case PluginStoreItemViewModel.RecentlyUpdated: - return InternationalizationManager.Instance.GetTranslation("pluginStore_RecentlyUpdated"); - case PluginStoreItemViewModel.None: - return InternationalizationManager.Instance.GetTranslation("pluginStore_None"); - case PluginStoreItemViewModel.Installed: - return InternationalizationManager.Instance.GetTranslation("pluginStore_Installed"); - default: - return ID; - } - - } +namespace Flow.Launcher.Converters; - public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException(); +public class TextConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var id = value?.ToString(); + var translationKey = id switch + { + PluginStoreItemViewModel.NewRelease => "pluginStore_NewRelease", + PluginStoreItemViewModel.RecentlyUpdated => "pluginStore_RecentlyUpdated", + PluginStoreItemViewModel.None => "pluginStore_None", + PluginStoreItemViewModel.Installed => "pluginStore_Installed", + _ => null + }; + + if (translationKey is null) + return id; + + return InternationalizationManager.Instance.GetTranslation(translationKey); } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new InvalidOperationException(); } diff --git a/Flow.Launcher/Helper/AutoStartup.cs b/Flow.Launcher/Helper/AutoStartup.cs index bf36b7f6f..4bff30caf 100644 --- a/Flow.Launcher/Helper/AutoStartup.cs +++ b/Flow.Launcher/Helper/AutoStartup.cs @@ -3,57 +3,56 @@ using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; using Microsoft.Win32; -namespace Flow.Launcher.Helper +namespace Flow.Launcher.Helper; + +public class AutoStartup { - public class AutoStartup + private const string StartupPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; + + public static bool IsEnabled { - private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; - - public static bool IsEnabled - { - get - { - try - { - using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true); - var path = key?.GetValue(Constant.FlowLauncher) as string; - return path == Constant.ExecutablePath; - } - catch (Exception e) - { - Log.Error("AutoStartup", $"Ignoring non-critical registry error (querying if enabled): {e}"); - } - - return false; - } - } - - public static void Disable() + get { try { using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true); - key?.DeleteValue(Constant.FlowLauncher, false); + var path = key?.GetValue(Constant.FlowLauncher) as string; + return path == Constant.ExecutablePath; } catch (Exception e) { - Log.Error("AutoStartup", $"Failed to disable auto-startup: {e}"); - throw; + Log.Error("AutoStartup", $"Ignoring non-critical registry error (querying if enabled): {e}"); } - } - internal static void Enable() + return false; + } + } + + public static void Disable() + { + try { - try - { - using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true); - key?.SetValue(Constant.FlowLauncher, $"\"{Constant.ExecutablePath}\""); - } - catch (Exception e) - { - Log.Error("AutoStartup", $"Failed to enable auto-startup: {e}"); - throw; - } + using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true); + key?.DeleteValue(Constant.FlowLauncher, false); + } + catch (Exception e) + { + Log.Error("AutoStartup", $"Failed to disable auto-startup: {e}"); + throw; + } + } + + internal static void Enable() + { + try + { + using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true); + key?.SetValue(Constant.FlowLauncher, $"\"{Constant.ExecutablePath}\""); + } + catch (Exception e) + { + Log.Error("AutoStartup", $"Failed to enable auto-startup: {e}"); + throw; } } } diff --git a/Flow.Launcher/Helper/DWMDropShadow.cs b/Flow.Launcher/Helper/DWMDropShadow.cs index 3a1f82d6f..e448acd4c 100644 --- a/Flow.Launcher/Helper/DWMDropShadow.cs +++ b/Flow.Launcher/Helper/DWMDropShadow.cs @@ -4,70 +4,69 @@ using System.Runtime.InteropServices; using System.Windows; using System.Windows.Interop; -namespace Flow.Launcher.Helper +namespace Flow.Launcher.Helper; + +public class DwmDropShadow { - public class DwmDropShadow + + [DllImport("dwmapi.dll", PreserveSig = true)] + private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize); + + [DllImport("dwmapi.dll")] + private static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset); + + /// + /// Drops a standard shadow to a WPF Window, even if the window isborderless. Only works with DWM (Vista and Seven). + /// This method is much more efficient than setting AllowsTransparency to true and using the DropShadow effect, + /// as AllowsTransparency involves a huge permormance issue (hardware acceleration is turned off for all the window). + /// + /// Window to which the shadow will be applied + public static void DropShadowToWindow(Window window) { - - [DllImport("dwmapi.dll", PreserveSig = true)] - private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize); - - [DllImport("dwmapi.dll")] - private static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset); - - /// - /// Drops a standard shadow to a WPF Window, even if the window isborderless. Only works with DWM (Vista and Seven). - /// This method is much more efficient than setting AllowsTransparency to true and using the DropShadow effect, - /// as AllowsTransparency involves a huge permormance issue (hardware acceleration is turned off for all the window). - /// - /// Window to which the shadow will be applied - public static void DropShadowToWindow(Window window) + if (!DropShadow(window)) { - if (!DropShadow(window)) - { - window.SourceInitialized += window_SourceInitialized; - } + window.SourceInitialized += window_SourceInitialized; } + } - private static void window_SourceInitialized(object sender, EventArgs e) //fixed typo + private static void window_SourceInitialized(object sender, EventArgs e) //fixed typo + { + Window window = (Window)sender; + + DropShadow(window); + + window.SourceInitialized -= window_SourceInitialized; + } + + /// + /// The actual method that makes API calls to drop the shadow to the window + /// + /// Window to which the shadow will be applied + /// True if the method succeeded, false if not + private static bool DropShadow(Window window) + { + try { - Window window = (Window)sender; + WindowInteropHelper helper = new WindowInteropHelper(window); + int val = 2; + int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4); - DropShadow(window); - - window.SourceInitialized -= window_SourceInitialized; - } - - /// - /// The actual method that makes API calls to drop the shadow to the window - /// - /// Window to which the shadow will be applied - /// True if the method succeeded, false if not - private static bool DropShadow(Window window) - { - try + if (ret1 == 0) { - WindowInteropHelper helper = new WindowInteropHelper(window); - int val = 2; - int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4); - - if (ret1 == 0) - { - Margins m = new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0 }; - int ret2 = DwmExtendFrameIntoClientArea(helper.Handle, ref m); - return ret2 == 0; - } - else - { - return false; - } + Margins m = new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0 }; + int ret2 = DwmExtendFrameIntoClientArea(helper.Handle, ref m); + return ret2 == 0; } - catch (Exception) + else { - // Probably dwmapi.dll not found (incompatible OS) return false; } } - + catch (Exception) + { + // Probably dwmapi.dll not found (incompatible OS) + return false; + } } -} \ No newline at end of file + +} diff --git a/Flow.Launcher/Helper/DataWebRequestFactory.cs b/Flow.Launcher/Helper/DataWebRequestFactory.cs index b3b7e9c63..2e72ee240 100644 --- a/Flow.Launcher/Helper/DataWebRequestFactory.cs +++ b/Flow.Launcher/Helper/DataWebRequestFactory.cs @@ -2,68 +2,67 @@ using System.IO; using System.Net; -namespace Flow.Launcher.Helper +namespace Flow.Launcher.Helper; + +public class DataWebRequestFactory : IWebRequestCreate { - public class DataWebRequestFactory : IWebRequestCreate + class DataWebRequest : WebRequest { - class DataWebRequest : WebRequest + private readonly Uri _uri; + + public DataWebRequest(Uri uri) { - private readonly Uri m_uri; - - public DataWebRequest(Uri uri) - { - m_uri = uri; - } - - public override WebResponse GetResponse() - { - return new DataWebResponse(m_uri); - } + _uri = uri; } - class DataWebResponse : WebResponse + public override WebResponse GetResponse() { - private readonly string m_contentType; - private readonly byte[] m_data; - - public DataWebResponse(Uri uri) - { - string uriString = uri.AbsoluteUri; - - int commaIndex = uriString.IndexOf(','); - var headers = uriString.Substring(0, commaIndex).Split(';'); - m_contentType = headers[0]; - string dataString = uriString.Substring(commaIndex + 1); - m_data = Convert.FromBase64String(dataString); - } - - public override string ContentType - { - get { return m_contentType; } - set - { - throw new NotSupportedException(); - } - } - - public override long ContentLength - { - get { return m_data.Length; } - set - { - throw new NotSupportedException(); - } - } - - public override Stream GetResponseStream() - { - return new MemoryStream(m_data); - } - } - - public WebRequest Create(Uri uri) - { - return new DataWebRequest(uri); + return new DataWebResponse(_uri); } } + + class DataWebResponse : WebResponse + { + private readonly string _contentType; + private readonly byte[] _data; + + public DataWebResponse(Uri uri) + { + string uriString = uri.AbsoluteUri; + + int commaIndex = uriString.IndexOf(','); + var headers = uriString.Substring(0, commaIndex).Split(';'); + _contentType = headers[0]; + string dataString = uriString.Substring(commaIndex + 1); + _data = Convert.FromBase64String(dataString); + } + + public override string ContentType + { + get { return _contentType; } + set + { + throw new NotSupportedException(); + } + } + + public override long ContentLength + { + get { return _data.Length; } + set + { + throw new NotSupportedException(); + } + } + + public override Stream GetResponseStream() + { + return new MemoryStream(_data); + } + } + + public WebRequest Create(Uri uri) + { + return new DataWebRequest(uri); + } } diff --git a/Flow.Launcher/Helper/ErrorReporting.cs b/Flow.Launcher/Helper/ErrorReporting.cs index b5da2efad..5b79c520d 100644 --- a/Flow.Launcher/Helper/ErrorReporting.cs +++ b/Flow.Launcher/Helper/ErrorReporting.cs @@ -4,45 +4,52 @@ using NLog; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Exception; -namespace Flow.Launcher.Helper +namespace Flow.Launcher.Helper; + +public static class ErrorReporting { - public static class ErrorReporting + private static void Report(Exception e) { - private static void Report(Exception e) - { - var logger = LogManager.GetLogger("UnHandledException"); - logger.Fatal(ExceptionFormatter.FormatExcpetion(e)); - var reportWindow = new ReportWindow(e); - reportWindow.Show(); - } + var logger = LogManager.GetLogger("UnHandledException"); + logger.Fatal(ExceptionFormatter.FormatExcpetion(e)); + var reportWindow = new ReportWindow(e); + reportWindow.Show(); + } - public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e) - { - //handle non-ui thread exceptions - Report((Exception)e.ExceptionObject); - } + public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e) + { + //handle non-ui thread exceptions + Report((Exception)e.ExceptionObject); + } - public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) - { - //handle ui thread exceptions - Report(e.Exception); - //prevent application exist, so the user can copy prompted error info - e.Handled = true; - } - - public static string RuntimeInfo() - { - var info = $"\nFlow Launcher version: {Constant.Version}" + - $"\nOS Version: {ExceptionFormatter.GetWindowsFullVersionFromRegistry()}" + - $"\nIntPtr Length: {IntPtr.Size}" + - $"\nx64: {Environment.Is64BitOperatingSystem}"; - return info; - } + public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) + { + //handle ui thread exceptions + Report(e.Exception); + //prevent application exist, so the user can copy prompted error info + e.Handled = true; + } - public static string DependenciesInfo() - { - var info = $"\nPython Path: {Constant.PythonPath}\nNode Path: {Constant.NodePath}"; - return info; - } + public static string RuntimeInfo() + { + var info = + $""" + + Flow Launcher version: {Constant.Version} + OS Version: {ExceptionFormatter.GetWindowsFullVersionFromRegistry()} + IntPtr Length: {IntPtr.Size} + x64: {Environment.Is64BitOperatingSystem} + """; + return info; + } + + public static string DependenciesInfo() + { + var info = $""" + + Python Path: {Constant.PythonPath} + Node Path: {Constant.NodePath} + """; + return info; } } diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index 3949d2828..21ddf276a 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -7,97 +7,96 @@ using Flow.Launcher.Core.Resource; using System.Windows; using Flow.Launcher.ViewModel; -namespace Flow.Launcher.Helper +namespace Flow.Launcher.Helper; + +internal static class HotKeyMapper { - internal static class HotKeyMapper + private static Settings _settings; + private static MainViewModel _mainViewModel; + + internal static void Initialize(MainViewModel mainVM) { - private static Settings settings; - private static MainViewModel mainViewModel; + _mainViewModel = mainVM; + _settings = _mainViewModel.Settings; - internal static void Initialize(MainViewModel mainVM) + SetHotkey(_settings.Hotkey, OnToggleHotkey); + LoadCustomPluginHotkey(); + } + + internal static void OnToggleHotkey(object sender, HotkeyEventArgs args) + { + if (!_mainViewModel.ShouldIgnoreHotkeys()) + _mainViewModel.ToggleFlowLauncher(); + } + + private static void SetHotkey(string hotkeyStr, EventHandler action) + { + var hotkey = new HotkeyModel(hotkeyStr); + SetHotkey(hotkey, action); + } + + internal static void SetHotkey(HotkeyModel hotkey, EventHandler action) + { + string hotkeyStr = hotkey.ToString(); + try { - mainViewModel = mainVM; - settings = mainViewModel.Settings; - - SetHotkey(settings.Hotkey, OnToggleHotkey); - LoadCustomPluginHotkey(); + HotkeyManager.Current.AddOrReplace(hotkeyStr, hotkey.CharKey, hotkey.ModifierKeys, action); } - - internal static void OnToggleHotkey(object sender, HotkeyEventArgs args) + catch (Exception) { - if (!mainViewModel.ShouldIgnoreHotkeys()) - mainViewModel.ToggleFlowLauncher(); - } - - private static void SetHotkey(string hotkeyStr, EventHandler action) - { - var hotkey = new HotkeyModel(hotkeyStr); - SetHotkey(hotkey, action); - } - - internal static void SetHotkey(HotkeyModel hotkey, EventHandler action) - { - string hotkeyStr = hotkey.ToString(); - try - { - HotkeyManager.Current.AddOrReplace(hotkeyStr, hotkey.CharKey, hotkey.ModifierKeys, action); - } - catch (Exception) - { - string errorMsg = string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr); - string errorMsgTitle = InternationalizationManager.Instance.GetTranslation("MessageBoxTitle"); - MessageBox.Show(errorMsg,errorMsgTitle); - } - } - - internal static void RemoveHotkey(string hotkeyStr) - { - if (!string.IsNullOrEmpty(hotkeyStr)) - { - HotkeyManager.Current.Remove(hotkeyStr); - } - } - - internal static void LoadCustomPluginHotkey() - { - if (settings.CustomPluginHotkeys == null) - return; - - foreach (CustomPluginHotkey hotkey in settings.CustomPluginHotkeys) - { - SetCustomQueryHotkey(hotkey); - } - } - - internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey) - { - SetHotkey(hotkey.Hotkey, (s, e) => - { - if (mainViewModel.ShouldIgnoreHotkeys()) - return; - - mainViewModel.Show(); - mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true); - }); - } - - internal static bool CheckAvailability(HotkeyModel currentHotkey) - { - try - { - HotkeyManager.Current.AddOrReplace("HotkeyAvailabilityTest", currentHotkey.CharKey, currentHotkey.ModifierKeys, (sender, e) => { }); - - return true; - } - catch - { - } - finally - { - HotkeyManager.Current.Remove("HotkeyAvailabilityTest"); - } - - return false; + string errorMsg = string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr); + string errorMsgTitle = InternationalizationManager.Instance.GetTranslation("MessageBoxTitle"); + MessageBox.Show(errorMsg,errorMsgTitle); } } + + internal static void RemoveHotkey(string hotkeyStr) + { + if (!string.IsNullOrEmpty(hotkeyStr)) + { + HotkeyManager.Current.Remove(hotkeyStr); + } + } + + internal static void LoadCustomPluginHotkey() + { + if (_settings.CustomPluginHotkeys == null) + return; + + foreach (CustomPluginHotkey hotkey in _settings.CustomPluginHotkeys) + { + SetCustomQueryHotkey(hotkey); + } + } + + internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey) + { + SetHotkey(hotkey.Hotkey, (s, e) => + { + if (_mainViewModel.ShouldIgnoreHotkeys()) + return; + + _mainViewModel.Show(); + _mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true); + }); + } + + internal static bool CheckAvailability(HotkeyModel currentHotkey) + { + try + { + HotkeyManager.Current.AddOrReplace("HotkeyAvailabilityTest", currentHotkey.CharKey, currentHotkey.ModifierKeys, (sender, e) => { }); + + return true; + } + catch + { + } + finally + { + HotkeyManager.Current.Remove("HotkeyAvailabilityTest"); + } + + return false; + } } diff --git a/Flow.Launcher/Helper/SingletonWindowOpener.cs b/Flow.Launcher/Helper/SingletonWindowOpener.cs index 8efc9be99..b5c2d8b55 100644 --- a/Flow.Launcher/Helper/SingletonWindowOpener.cs +++ b/Flow.Launcher/Helper/SingletonWindowOpener.cs @@ -2,27 +2,26 @@ using System.Linq; using System.Windows; -namespace Flow.Launcher.Helper -{ - public static class SingletonWindowOpener - { - public static T Open(params object[] args) where T : Window - { - var window = Application.Current.Windows.OfType().FirstOrDefault(x => x.GetType() == typeof(T)) - ?? (T)Activator.CreateInstance(typeof(T), args); - - // Fix UI bug - // Add `window.WindowState = WindowState.Normal` - // If only use `window.Show()`, Settings-window doesn't show when minimized in taskbar - // Not sure why this works tho - // Probably because, when `.Show()` fails, `window.WindowState == Minimized` (not `Normal`) - // https://stackoverflow.com/a/59719760/4230390 - window.WindowState = WindowState.Normal; - window.Show(); - - window.Focus(); +namespace Flow.Launcher.Helper; - return (T)window; - } +public static class SingletonWindowOpener +{ + public static T Open(params object[] args) where T : Window + { + var window = Application.Current.Windows.OfType().FirstOrDefault(x => x.GetType() == typeof(T)) + ?? (T)Activator.CreateInstance(typeof(T), args); + + // Fix UI bug + // Add `window.WindowState = WindowState.Normal` + // If only use `window.Show()`, Settings-window doesn't show when minimized in taskbar + // Not sure why this works tho + // Probably because, when `.Show()` fails, `window.WindowState == Minimized` (not `Normal`) + // https://stackoverflow.com/a/59719760/4230390 + window.WindowState = WindowState.Normal; + window.Show(); + + window.Focus(); + + return (T)window; } -} \ No newline at end of file +} diff --git a/Flow.Launcher/Helper/SyntaxSugars.cs b/Flow.Launcher/Helper/SyntaxSugars.cs index 7e0349422..41250dadf 100644 --- a/Flow.Launcher/Helper/SyntaxSugars.cs +++ b/Flow.Launcher/Helper/SyntaxSugars.cs @@ -1,24 +1,23 @@ using System; -namespace Flow.Launcher.Helper -{ - public static class SyntaxSugars - { - public static TResult CallOrRescueDefault(Func callback) - { - return CallOrRescueDefault(callback, default(TResult)); - } +namespace Flow.Launcher.Helper; - public static TResult CallOrRescueDefault(Func callback, TResult def) +public static class SyntaxSugars +{ + public static TResult CallOrRescueDefault(Func callback) + { + return CallOrRescueDefault(callback, default(TResult)); + } + + public static TResult CallOrRescueDefault(Func callback, TResult def) + { + try { - try - { - return callback(); - } - catch - { - return def; - } + return callback(); + } + catch + { + return def; } } } diff --git a/Flow.Launcher/Helper/WallpaperPathRetrieval.cs b/Flow.Launcher/Helper/WallpaperPathRetrieval.cs index 9e5d77283..e08e227cc 100644 --- a/Flow.Launcher/Helper/WallpaperPathRetrieval.cs +++ b/Flow.Launcher/Helper/WallpaperPathRetrieval.cs @@ -5,44 +5,43 @@ using System.Text; using System.Windows.Media; using Microsoft.Win32; -namespace Flow.Launcher.Helper +namespace Flow.Launcher.Helper; + +public static class WallpaperPathRetrieval { - public static class WallpaperPathRetrieval + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + private static extern Int32 SystemParametersInfo(UInt32 action, + Int32 uParam, StringBuilder vParam, UInt32 winIni); + private static readonly UInt32 SPI_GETDESKWALLPAPER = 0x73; + private static int MAX_PATH = 260; + + public static string GetWallpaperPath() { - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - private static extern Int32 SystemParametersInfo(UInt32 action, - Int32 uParam, StringBuilder vParam, UInt32 winIni); - private static readonly UInt32 SPI_GETDESKWALLPAPER = 0x73; - private static int MAX_PATH = 260; + var wallpaper = new StringBuilder(MAX_PATH); + SystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, wallpaper, 0); - public static string GetWallpaperPath() + var str = wallpaper.ToString(); + if (string.IsNullOrEmpty(str)) + return null; + + return str; + } + + public static Color GetWallpaperColor() + { + RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Colors", true); + var result = key?.GetValue("Background", null); + if (result is string strResult) { - var wallpaper = new StringBuilder(MAX_PATH); - SystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, wallpaper, 0); - - var str = wallpaper.ToString(); - if (string.IsNullOrEmpty(str)) - return null; - - return str; - } - - public static Color GetWallpaperColor() - { - RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Colors", true); - var result = key.GetValue(@"Background", null); - if (result != null && result is string) + try + { + var parts = strResult.Trim().Split(new[] {' '}, 3).Select(byte.Parse).ToList(); + return Color.FromRgb(parts[0], parts[1], parts[2]); + } + catch { - try - { - var parts = result.ToString().Trim().Split(new[] {' '}, 3).Select(byte.Parse).ToList(); - return Color.FromRgb(parts[0], parts[1], parts[2]); - } - catch - { - } } - return Colors.Transparent; } + return Colors.Transparent; } } diff --git a/Flow.Launcher/Helper/WindowsInteropHelper.cs b/Flow.Launcher/Helper/WindowsInteropHelper.cs index 16a96cd64..89fbec967 100644 --- a/Flow.Launcher/Helper/WindowsInteropHelper.cs +++ b/Flow.Launcher/Helper/WindowsInteropHelper.cs @@ -8,156 +8,152 @@ using System.Windows.Interop; using System.Windows.Media; using Point = System.Windows.Point; -namespace Flow.Launcher.Helper +namespace Flow.Launcher.Helper; + +public class WindowsInteropHelper { - public class WindowsInteropHelper + private const int GWL_STYLE = -16; //WPF's Message code for Title Bar's Style + private const int WS_SYSMENU = 0x80000; //WPF's Message code for System Menu + private static IntPtr _hwnd_shell; + private static IntPtr _hwnd_desktop; + + //Accessors for shell and desktop handlers + //Will set the variables once and then will return them + private static IntPtr HWND_SHELL { - private const int GWL_STYLE = -16; //WPF's Message code for Title Bar's Style - private const int WS_SYSMENU = 0x80000; //WPF's Message code for System Menu - private static IntPtr _hwnd_shell; - private static IntPtr _hwnd_desktop; - - //Accessors for shell and desktop handlers - //Will set the variables once and then will return them - private static IntPtr HWND_SHELL + get { - get - { - return _hwnd_shell != IntPtr.Zero ? _hwnd_shell : _hwnd_shell = GetShellWindow(); - } + return _hwnd_shell != IntPtr.Zero ? _hwnd_shell : _hwnd_shell = GetShellWindow(); } - private static IntPtr HWND_DESKTOP + } + private static IntPtr HWND_DESKTOP + { + get { - get - { - return _hwnd_desktop != IntPtr.Zero ? _hwnd_desktop : _hwnd_desktop = GetDesktopWindow(); - } + return _hwnd_desktop != IntPtr.Zero ? _hwnd_desktop : _hwnd_desktop = GetDesktopWindow(); } + } - [DllImport("user32.dll", SetLastError = true)] - internal static extern int GetWindowLong(IntPtr hWnd, int nIndex); - - [DllImport("user32.dll")] - internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); + [DllImport("user32.dll", SetLastError = true)] + internal static extern int GetWindowLong(IntPtr hWnd, int nIndex); - [DllImport("user32.dll")] - internal static extern IntPtr GetForegroundWindow(); + [DllImport("user32.dll")] + internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); - [DllImport("user32.dll")] - internal static extern IntPtr GetDesktopWindow(); + [DllImport("user32.dll")] + internal static extern IntPtr GetForegroundWindow(); - [DllImport("user32.dll")] - internal static extern IntPtr GetShellWindow(); + [DllImport("user32.dll")] + internal static extern IntPtr GetDesktopWindow(); - [DllImport("user32.dll", SetLastError = true)] - internal static extern int GetWindowRect(IntPtr hwnd, out RECT rc); + [DllImport("user32.dll")] + internal static extern IntPtr GetShellWindow(); - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - internal static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); + [DllImport("user32.dll", SetLastError = true)] + internal static extern int GetWindowRect(IntPtr hwnd, out RECT rc); - [DllImport("user32.DLL")] - public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + internal static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); + + [DllImport("user32.DLL")] + public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); - const string WINDOW_CLASS_CONSOLE = "ConsoleWindowClass"; - const string WINDOW_CLASS_WINTAB = "Flip3D"; - const string WINDOW_CLASS_PROGMAN = "Progman"; - const string WINDOW_CLASS_WORKERW = "WorkerW"; + const string WINDOW_CLASS_CONSOLE = "ConsoleWindowClass"; + const string WINDOW_CLASS_WINTAB = "Flip3D"; + const string WINDOW_CLASS_PROGMAN = "Progman"; + const string WINDOW_CLASS_WORKERW = "WorkerW"; - public static bool IsWindowFullscreen() + public static bool IsWindowFullscreen() + { + //get current active window + IntPtr hWnd = GetForegroundWindow(); + + if (hWnd.Equals(IntPtr.Zero)) { - //get current active window - IntPtr hWnd = GetForegroundWindow(); - - if (!hWnd.Equals(IntPtr.Zero)) - { - //if current active window is NOT desktop or shell - if (!(hWnd.Equals(HWND_DESKTOP) || hWnd.Equals(HWND_SHELL))) - { - StringBuilder sb = new StringBuilder(256); - GetClassName(hWnd, sb, sb.Capacity); - string windowClass = sb.ToString(); - - //for Win+Tab (Flip3D) - if (windowClass == WINDOW_CLASS_WINTAB) - { - return false; - } - - RECT appBounds; - GetWindowRect(hWnd, out appBounds); - - //for console (ConsoleWindowClass), we have to check for negative dimensions - if (windowClass == WINDOW_CLASS_CONSOLE) - { - return appBounds.Top < 0 && appBounds.Bottom < 0; - } - - //for desktop (Progman or WorkerW, depends on the system), we have to check - if (windowClass == WINDOW_CLASS_PROGMAN || windowClass == WINDOW_CLASS_WORKERW) - { - IntPtr hWndDesktop = FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null); - hWndDesktop = FindWindowEx(hWndDesktop, IntPtr.Zero, "SysListView32", "FolderView"); - if (!hWndDesktop.Equals(IntPtr.Zero)) - { - return false; - } - } - - Rectangle screenBounds = Screen.FromHandle(hWnd).Bounds; - if ((appBounds.Bottom - appBounds.Top) == screenBounds.Height && (appBounds.Right - appBounds.Left) == screenBounds.Width) - { - return true; - } - } - } - return false; } - /// - /// disable windows toolbar's control box - /// this will also disable system menu with Alt+Space hotkey - /// - public static void DisableControlBox(Window win) + //if current active window is desktop or shell, exit early + if (hWnd.Equals(HWND_DESKTOP) || hWnd.Equals(HWND_SHELL)) { - var hwnd = new WindowInteropHelper(win).Handle; - SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); + return false; } - /// - /// Transforms pixels to Device Independent Pixels used by WPF - /// - /// current window, required to get presentation source - /// horizontal position in pixels - /// vertical position in pixels - /// point containing device independent pixels - public static Point TransformPixelsToDIP(Visual visual, double unitX, double unitY) + StringBuilder sb = new StringBuilder(256); + GetClassName(hWnd, sb, sb.Capacity); + string windowClass = sb.ToString(); + + //for Win+Tab (Flip3D) + if (windowClass == WINDOW_CLASS_WINTAB) { - Matrix matrix; - var source = PresentationSource.FromVisual(visual); - if (source != null) + return false; + } + + RECT appBounds; + GetWindowRect(hWnd, out appBounds); + + //for console (ConsoleWindowClass), we have to check for negative dimensions + if (windowClass == WINDOW_CLASS_CONSOLE) + { + return appBounds.Top < 0 && appBounds.Bottom < 0; + } + + //for desktop (Progman or WorkerW, depends on the system), we have to check + if (windowClass is WINDOW_CLASS_PROGMAN or WINDOW_CLASS_WORKERW) + { + IntPtr hWndDesktop = FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null); + hWndDesktop = FindWindowEx(hWndDesktop, IntPtr.Zero, "SysListView32", "FolderView"); + if (!hWndDesktop.Equals(IntPtr.Zero)) { - matrix = source.CompositionTarget.TransformFromDevice; + return false; } - else - { - using (var src = new HwndSource(new HwndSourceParameters())) - { - matrix = src.CompositionTarget.TransformFromDevice; - } - } - return new Point((int)(matrix.M11 * unitX), (int)(matrix.M22 * unitY)); } + Rectangle screenBounds = Screen.FromHandle(hWnd).Bounds; + return (appBounds.Bottom - appBounds.Top) == screenBounds.Height && (appBounds.Right - appBounds.Left) == screenBounds.Width; + } - [StructLayout(LayoutKind.Sequential)] - public struct RECT + /// + /// disable windows toolbar's control box + /// this will also disable system menu with Alt+Space hotkey + /// + public static void DisableControlBox(Window win) + { + var hwnd = new WindowInteropHelper(win).Handle; + SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); + } + + /// + /// Transforms pixels to Device Independent Pixels used by WPF + /// + /// current window, required to get presentation source + /// horizontal position in pixels + /// vertical position in pixels + /// point containing device independent pixels + public static Point TransformPixelsToDIP(Visual visual, double unitX, double unitY) + { + Matrix matrix; + var source = PresentationSource.FromVisual(visual); + if (source is not null) { - public int Left; - public int Top; - public int Right; - public int Bottom; + matrix = source.CompositionTarget.TransformFromDevice; } + else + { + using var src = new HwndSource(new HwndSourceParameters()); + matrix = src.CompositionTarget.TransformFromDevice; + } + return new Point((int)(matrix.M11 * unitX), (int)(matrix.M22 * unitY)); + } + + + [StructLayout(LayoutKind.Sequential)] + public struct RECT + { + public int Left; + public int Top; + public int Right; + public int Bottom; } } diff --git a/Flow.Launcher/Languages/ar.xaml b/Flow.Launcher/Languages/ar.xaml index fbb52f9ee..7f5c067f5 100644 --- a/Flow.Launcher/Languages/ar.xaml +++ b/Flow.Launcher/Languages/ar.xaml @@ -154,6 +154,8 @@ Dark Sound Effect Play a small sound when the search window opens + Sound Effect Volume + Adjust the volume of the sound effect Animation Use Animation in UI Animation Speed diff --git a/Flow.Launcher/Languages/cs.xaml b/Flow.Launcher/Languages/cs.xaml index 90b24229b..c5ac941bc 100644 --- a/Flow.Launcher/Languages/cs.xaml +++ b/Flow.Launcher/Languages/cs.xaml @@ -154,6 +154,8 @@ Tmavý Zvukový efekt Přehrát krátký zvuk při otevření okna vyhledávání + Sound Effect Volume + Adjust the volume of the sound effect Animace Použít animaci v UI Rychlost animace diff --git a/Flow.Launcher/Languages/da.xaml b/Flow.Launcher/Languages/da.xaml index 364b8a2da..830f49798 100644 --- a/Flow.Launcher/Languages/da.xaml +++ b/Flow.Launcher/Languages/da.xaml @@ -154,6 +154,8 @@ Dark Sound Effect Play a small sound when the search window opens + Sound Effect Volume + Adjust the volume of the sound effect Animation Use Animation in UI Animation Speed diff --git a/Flow.Launcher/Languages/de.xaml b/Flow.Launcher/Languages/de.xaml index a360140d6..189ac678e 100644 --- a/Flow.Launcher/Languages/de.xaml +++ b/Flow.Launcher/Languages/de.xaml @@ -154,6 +154,8 @@ Dunkel Soundeffekt Ton abspielen, wenn das Suchfenster geöffnet wird + Sound Effect Volume + Adjust the volume of the sound effect Animation Animationen in der Oberfläche verwenden Animation Speed diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index d36a49538..4bc79ccb3 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -156,6 +156,8 @@ Dark Sound Effect Play a small sound when the search window opens + Sound Effect Volume + Adjust the volume of the sound effect Animation Use Animation in UI Animation Speed diff --git a/Flow.Launcher/Languages/es-419.xaml b/Flow.Launcher/Languages/es-419.xaml index 8417f7c7e..9fc54c373 100644 --- a/Flow.Launcher/Languages/es-419.xaml +++ b/Flow.Launcher/Languages/es-419.xaml @@ -154,6 +154,8 @@ Oscuro Efectos de Sonido Reproducir un sonido al abrir la ventana de búsqueda + Sound Effect Volume + Adjust the volume of the sound effect Animación Usar Animación en la Interfaz Animation Speed diff --git a/Flow.Launcher/Languages/es.xaml b/Flow.Launcher/Languages/es.xaml index bcfef1f04..5153b79f7 100644 --- a/Flow.Launcher/Languages/es.xaml +++ b/Flow.Launcher/Languages/es.xaml @@ -55,7 +55,7 @@ Seleccionar la última consulta Limpiar la última consulta Número máximo de resultados mostrados - También puede ajustarlo rápidamente usando CTRL+Más y CTRL+Menos. + También puede ajustarse rápidamente usando Ctrl+Más y Ctrl+Menos. Ignorar atajos de teclado en modo pantalla completa No permite activar Flow Launcher con aplicaciones a pantalla completa (Recomendado para juegos). Administrador de archivos predeterminado @@ -73,13 +73,13 @@ Ocultar Flow Launcher al inicio Ocultar icono en la bandeja del sistema Cuando el icono está oculto en la bandeja del sistema, se puede abrir el menú de configuración haciendo clic con el botón derecho en la ventana de búsqueda. - Precisión en la búsqueda de consultas + Precisión de búsqueda en consultas Cambia la puntuación mínima requerida para la coincidencia de los resultados. Buscar con Pinyin Permite utilizar Pinyin para la búsqueda. Pinyin es el sistema estándar de ortografía romanizado para traducir chino. Mostrar siempre vista previa Muestra siempre el panel de vista previa al iniciar Flow. Pulse {0} para mostrar/ocultar la vista previa. - El efecto de sombra no está permitido mientras el tema actual tenga el efecto de desenfoque activado + El efecto de sombra no está permitido si el tema actual tiene activado el efecto de desenfoque Buscar complemento @@ -154,8 +154,10 @@ Oscuro Efecto de sonido Reproduce un pequeño sonido cuando se abre el cuadro de búsqueda + Volumen del efecto de sonido + Ajusta el volumen del efecto de sonido Animación - Usar animación en la Interfaz de Usuario + Usa animación en la Interfaz de Usuario Velocidad de animación Velocidad de animación de la interfaz de usuario Lenta @@ -170,7 +172,7 @@ Atajos de teclado Atajo de teclado de Flow Launcher Introduzca el atajo de teclado para mostrar/ocultar Flow Launcher. - Atajo de teclado para vista previa + Acceso directo para vista previa Introduzca el acceso directo para mostrar/ocultar la vista previa en la ventana de búsqueda. Tecla modificadora para abrir resultado Seleccione una tecla modificadora para abrir el resultado seleccionado con el teclado. @@ -194,7 +196,7 @@ Efecto de sombra de la ventana de consultas El efecto de sombra hace un uso sustancial de la GPU. No se recomienda para ordenadores de rendimiento limitado. Tamaño del ancho de la ventana - También puede ajustarlo rápidamente usando Ctrl+[y Ctrl+]. + También puede ajustarse rápidamente usando Ctrl+[ y Ctrl+]. Usar iconos Segoe Fluent Usa iconos Segoe Fluent para los resultados de la consulta cuando sean compatibles Pulsar Tecla @@ -296,7 +298,7 @@ Si añade un prefijo "@" al introducir un acceso directo, éste coinci El acceso directo y/o su expansión están vacíos. - Atajo de teclado no disponible + No disponible Versión diff --git a/Flow.Launcher/Languages/fr.xaml b/Flow.Launcher/Languages/fr.xaml index c33cefbfb..82b93b1e7 100644 --- a/Flow.Launcher/Languages/fr.xaml +++ b/Flow.Launcher/Languages/fr.xaml @@ -154,6 +154,8 @@ Sombre Effet Sonore Jouer un petit son lorsque la fenêtre de recherche s'ouvre + Volume de l'effet sonore + Ajuster le volume de l'effet sonore Animation Utiliser l'animation dans l'interface Vitesse d'animation diff --git a/Flow.Launcher/Languages/it.xaml b/Flow.Launcher/Languages/it.xaml index 2b5157962..a9a6e4fee 100644 --- a/Flow.Launcher/Languages/it.xaml +++ b/Flow.Launcher/Languages/it.xaml @@ -154,6 +154,8 @@ Scuro Effetto sonoro Riproduce un piccolo suono all'apertura della finestra di ricerca + Sound Effect Volume + Adjust the volume of the sound effect Animazione Usa l'animazione nell'interfaccia utente Velocità di animazione diff --git a/Flow.Launcher/Languages/ja.xaml b/Flow.Launcher/Languages/ja.xaml index e846613e8..f4859c806 100644 --- a/Flow.Launcher/Languages/ja.xaml +++ b/Flow.Launcher/Languages/ja.xaml @@ -154,6 +154,8 @@ Dark Sound Effect Play a small sound when the search window opens + Sound Effect Volume + Adjust the volume of the sound effect Animation Use Animation in UI Animation Speed diff --git a/Flow.Launcher/Languages/ko.xaml b/Flow.Launcher/Languages/ko.xaml index 612836bd5..bf76718e8 100644 --- a/Flow.Launcher/Languages/ko.xaml +++ b/Flow.Launcher/Languages/ko.xaml @@ -154,6 +154,8 @@ 어둡게 소리 효과 검색창을 열 때 작은 소리를 재생합니다. + Sound Effect Volume + Adjust the volume of the sound effect 애니메이션 일부 UI에 애니메이션을 사용합니다. Animation Speed diff --git a/Flow.Launcher/Languages/nb.xaml b/Flow.Launcher/Languages/nb.xaml index fbb52f9ee..7f5c067f5 100644 --- a/Flow.Launcher/Languages/nb.xaml +++ b/Flow.Launcher/Languages/nb.xaml @@ -154,6 +154,8 @@ Dark Sound Effect Play a small sound when the search window opens + Sound Effect Volume + Adjust the volume of the sound effect Animation Use Animation in UI Animation Speed diff --git a/Flow.Launcher/Languages/nl.xaml b/Flow.Launcher/Languages/nl.xaml index 3a2ba44c1..66383a90c 100644 --- a/Flow.Launcher/Languages/nl.xaml +++ b/Flow.Launcher/Languages/nl.xaml @@ -154,6 +154,8 @@ Donker Geluidseffect Een klein geluid afspelen wanneer het zoekvenster wordt geopend + Sound Effect Volume + Adjust the volume of the sound effect Animatie Animatie gebruiken in UI Animation Speed @@ -182,7 +184,7 @@ Query Shortcut Expansion - Description + Beschrijving Verwijder Bewerken Toevoegen diff --git a/Flow.Launcher/Languages/pl.xaml b/Flow.Launcher/Languages/pl.xaml index 340e6c3e9..8ac419ab0 100644 --- a/Flow.Launcher/Languages/pl.xaml +++ b/Flow.Launcher/Languages/pl.xaml @@ -1,7 +1,7 @@  - Failed to register hotkey "{0}". The hotkey may be in use by another program. Change to a different hotkey, or exit another program. + Nie udało się zarejestrować skrótu klawiszowego "{0}". Klucz skrótu może być używany przez inny program. Zmień skrót klawiszowy lub wyjdź z innego programu. Flow Launcher Nie udało się uruchomić: {0} Niepoprawny format pliku wtyczki @@ -21,11 +21,11 @@ Zaznacz wszystko Plik Folder - Text + Tekst Tryb grania Wstrzymaj używanie skrótów. - Position Reset - Reset search window position + Resetowanie pozycji + Zresetuj pozycję okna wyszukiwania Ustawienia @@ -33,29 +33,29 @@ Tryb przenośny Przechowuj wszystkie ustawienia i dane użytkownika w jednym folderze (Przydatne, gdy używane na dyskach wymiennych lub usługach chmurowych). Uruchamiaj Flow Launcher przy starcie systemu - Error setting launch on startup + Błąd uruchamiania ustawień przy starcie Ukryj okno Flow Launcher kiedy przestanie ono być aktywne Nie pokazuj powiadomienia o nowej wersji - Search Window Position - Remember Last Position - Monitor with Mouse Cursor - Monitor with Focused Window - Primary Monitor - Custom Monitor - Search Window Position on Monitor - Center - Center Top - Left Top - Right Top - Custom Position + Pozycja Okna Wyszukiwania + Zapamiętaj Ostatnią Pozycję + Monitoruj kursorem myszy + Monitor z Dostosowanym Oknem + Monitor główny + Monitor Niestandardowy + Pozycja Okna Wyszukiwania na Monitorze + Wyśrodkowane + Środek Góra + Lewa Góra + Prawa Góra + Pozycja niestandardowa Język - Last Query Style - Show/Hide previous results when Flow Launcher is reactivated. - Preserve Last Query - Select last Query - Empty last Query + Styl ostatniego zapytania + Pokaż/Ukryj poprzednie wyniki, gdy Flow Launcher jest ponownie aktywowany. + Zachowaj ostatnie zapytanie + Wybierz ostatnie zapytanie + Puste ostatnie zapytanie Maksymalna liczba wyników - You can also quickly adjust this by using CTRL+Plus and CTRL+Minus. + Możesz to również szybko dostosować używając CTRL+Plus i CTRL+Minus. Ignoruj skróty klawiszowe w trybie pełnego ekranu Wyłącz aktywowanie Flow Launcher, gdy uruchomiona jest aplikacja pełnoekranowa (Zalecane dla gier). Domyślny menedżer plików @@ -63,45 +63,45 @@ Domyślna przeglądarka Ustawienie dla nowej karty, nowego okna i trybu prywatnego. Python Path - Node.js Path - Please select the Node.js executable - Please select pythonw.exe - Always Start Typing in English Mode - Temporarily change your input method to English mode when activating Flow. + Ścieżka Node.js + Wybierz plik wykonywalny Node.js + Wybierz pythonw.exe + Zawsze rozpoczynaj wpisywanie w trybie angielskim + Tymczasowo zmień metodę wprowadzania na tryb angielski podczas aktywacji Flow. Automatyczne aktualizacje Wybierz Uruchamiaj Flow Launcher zminimalizowany Ukryj ikonę zasobnika - When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window. - Query Search Precision - Changes minimum match score required for results. - Search with Pinyin - Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. - Always Preview - Always open preview panel when Flow activates. Press {0} to toggle preview. - Shadow effect is not allowed while current theme has blur effect enabled + Gdy ikona jest ukryta w zasobniku, menu Ustawienia można otworzyć, klikając prawym przyciskiem myszy okno wyszukiwania. + Precyzja wyszukiwania zapytań + Zmienia minimalny wynik dopasowania wymagany do uzyskania wyników. + Szukaj z Pinyin + Umożliwia wyszukiwanie przy użyciu Pinyin. Pinyin to standardowy system pisowni zromanizowanej służący do tłumaczenia języka chińskiego. + Zawsze Podgląd + Zawsze otwieraj panel podglądu, gdy aktywowany jest Flow. Naciśnij {0}, aby przełączyć podgląd. + Efekt cienia jest niedozwolony, gdy bieżący motyw ma włączony efekt rozmycia Szukaj wtyczek Ctrl+F aby wyszukać wtyczki - No results found - Please try a different search. - Plugin + Nie znaleziono wyników + Spróbuj użyć innego wyszukiwania. + Wtyczka Wtyczki Znajdź więcej wtyczek - On + Włącz Wyłącz - Action keyword Setting + Ustawienie akcji słowa kluczowego Wyzwalacze - Current action keyword - New action keyword - Change Action Keywords - Current Priority - New Priority - Priority - Change Plugin Results Priority + Bieżące słowo kluczowe akcji + Nowe słowo kluczowe akcji + Zmień słowa kluczowe akcji + Obecny Priorytet + Nowy Priorytet + Priorytet + Zmień priorytet wyników wtyczki Folder wtyczki - by + wg Czas ładowania: Czas zapytania: Wersja @@ -111,67 +111,69 @@ Sklep z wtyczkami - New Release - Recently Updated + Nowe wydanie + Ostatnio zaktualizowano Wtyczki - Installed - Refresh - Install + Zainstalowany + Odśwież + Instalacja Odinstalowywanie Aktualizuj - Plugin already installed - New Version - This plugin has been updated within the last 7 days - New Update is Available + Plugin już jest zainstalowany + Nowa wersja + Ta wtyczka została zaktualizowana w ciągu ostatnich 7 dni + Dostępna jest nowa aktualizacja Skórka - Appearance + Wygląd Znajdź więcej skórek - How to create a theme - Hi There + Jak utworzyć motyw + Cześć, Explorer - Search for files, folders and file contents - WebSearch - Search the web with different search engine support + Wyszukiwanie plików, folderów i zawartości plików + Wyszukiwarka internetowa + Wyszukiwanie w Internecie z obsługą różnych wyszukiwarek Programy - Launch programs as admin or a different user - ProcessKiller - Terminate unwanted processes + Uruchamiaj programy jako administrator lub inny użytkownik + ZabijProces + Zakończ niechciane procesy Czcionka okna zapytania Czcionka okna wyników Tryb w oknie Przeźroczystość - Theme {0} not exists, fallback to default theme - Fail to load theme {0}, fallback to default theme - Theme Folder - Open Theme Folder - Color Scheme - System Default - Light - Dark - Sound Effect - Play a small sound when the search window opens - Animation - Use Animation in UI - Animation Speed - The speed of the UI animation - Slow - Medium - Fast - Custom - Clock - Date + Motyw {0} nie istnieje, powróć do domyślnego motywu + Nie można załadować motywu {0}, wróć do motywu domyślnego + Folder Motywu + Otwórz folder motywu + Schemat kolorów + Domyślne ustawienie systemowe + Jasny + Ciemny + Efekty dźwiękowe + Odtwarzaj krótki dźwięk po otwarciu okna wyszukiwania + Sound Effect Volume + Adjust the volume of the sound effect + Animacja + Użyj animacji w interfejsie użytkownika + Szybkość animacji + Szybkość animacji interfejsu użytkownika + Wolna + Średnia + Szybka + Niestandardowa + Zegar + Data Skrót klawiszowy Skrót klawiszowy Skrót klawiszowy Flow Launcher - Enter shortcut to show/hide Flow Launcher. - Preview Hotkey - Enter shortcut to show/hide preview in search window. + Wprowadź skrót, aby pokazać/ukryć Flow Launcher. + Podgląd skrótu + Wprowadź skrót, aby pokazać/ukryć podgląd w oknie wyszukiwania. Modyfikatory klawiszów otwierających wyniki Select a modifier key to open selected result via keyboard. Pokaż skrót klawiszowy @@ -243,27 +245,27 @@ Select File Manager Please specify the file location of the file manager you using and add arguments if necessary. The default arguments are "%d", and a path is entered at that location. For example, If a command is required such as "totalcmd.exe /A c:\windows", argument is /A "%d". - "%f" is an argument that represent the file path. It is used to emphasize the file/folder name when opening a specific file location in 3rd party file manager. This argument is only available in the "Arg for File" item. If the file manager does not have that function, you can use "%d". - File Manager - Profile Name - File Manager Path - Arg For Folder - Arg For File + "%f" jest argumentem reprezentującym ścieżkę do pliku. Służy do podkreślenia nazwy pliku/folderu podczas otwierania określonej lokalizacji pliku w menedżerze plików innych firm. Ten argument jest dostępny tylko w pozycji "Arg dla pliku". Jeśli menedżer plików nie ma tej funkcji, możesz użyć "%d". + Menadżer plików + Nazwa profilu + Ścieżka menedżera plików + Arg dla folderu + Arg dla pliku Domyślna przeglądarka - The default setting follows the OS default browser setting. If specified separately, flow uses that browser. - Browser - Browser Name - Browser Path - New Window - New Tab - Private Mode + Ustawienie domyślne jest zgodne z domyślnym ustawieniem przeglądarki systemu operacyjnego. Jeśli określono to oddzielnie, flow korzysta z tej przeglądarki. + Przeglądarka + Nazwa przeglądarki + Ścieżka przeglądarki + Nowe okno + Nowa zakładka + Tryb prywatny - Change Priority - Greater the number, the higher the result will be ranked. Try setting it as 5. If you want the results to be lower than any other plugin's, provide a negative number - Please provide an valid integer for Priority! + Zmień priorytet + Im większa liczba, tym wyższa pozycja w rankingu. Spróbuj ustawić go jako 5. Jeśli chcesz, aby wyniki były niższe niż w przypadku jakiejkolwiek innej wtyczki, podaj liczbę ujemną + Podaj prawidłową liczbę całkowitą dla priorytetu! Stary wyzwalacz @@ -274,26 +276,26 @@ Nowy wyzwalacz nie może być pusty Ten wyzwalacz został już przypisany do innej wtyczki, musisz podać inny wyzwalacz. Sukces - Completed successfully + Zakończono pomyślnie Użyj * jeżeli nie chcesz podawać wyzwalacza Skrót klawiszowy niestandardowych zapyta - Press a custom hotkey to open Flow Launcher and input the specified query automatically. + Naciśnij niestandardowy klawisz skrótu, aby otworzyć Flow Launcher i automatycznie wprowadzić określone zapytanie. Podgląd Skrót klawiszowy jest niedostępny, musisz podać inny skrót klawiszowy Niepoprawny skrót klawiszowy Aktualizuj - Custom Query Shortcut - Enter a shortcut that automatically expands to the specified query. - A shortcut is expanded when it exactly matches the query. + Niestandardowy skrót zapytania + Wprowadź skrót, który automatycznie rozszerzy się do określonego zapytania. + Skrót jest rozwijany, gdy dokładnie pasuje do zapytania. -If you add an '@' prefix while inputting a shortcut, it matches any position in the query. Builtin shortcuts match any position in a query. +Jeśli dodasz prefiks '@' podczas wprowadzania skrótu, będzie on pasował do dowolnej pozycji w zapytaniu. Wbudowane skróty pasują do każdej pozycji w zapytaniu. - Shortcut already exists, please enter a new Shortcut or edit the existing one. - Shortcut and/or its expansion is empty. + Skrót już istnieje, wprowadź nowy skrót lub edytuj istniejący. + Skrót i/lub jego rozwinięcie jest puste. Niepoprawny skrót klawiszowy @@ -315,51 +317,51 @@ If you add an '@' prefix while inputting a shortcut, it matches any position in W programie Flow Launcher wystąpił błąd - Please wait... + Proszę czekać... - Checking for new update - You already have the latest Flow Launcher version - Update found - Updating... + Sprawdzanie nowej aktualizacji + Masz już najnowszą wersję Flow Launcher + Znaleziono aktualizację + Aktualizacja... - Flow Launcher was not able to move your user profile data to the new update version. - Please manually move your profile data folder from {0} to {1} + Flow Launcher nie był w stanie przenieść danych profilu użytkownika do nowej wersji aktualizacji. + Ręcznie przenieś folder danych profilu z {0} do {1} - New Update + Nowa aktualizacja Nowa wersja Flow Launcher {0} jest dostępna Wystąpił błąd podczas instalowania aktualizacji programu Aktualizuj Anuluj - Update Failed - Check your connection and try updating proxy settings to github-cloud.s3.amazonaws.com. + Aktualizacja nie powiodła się + Sprawdź połączenie i spróbuj zaktualizować ustawienia proxy do github-cloud.s3.amazonaws.com. Aby dokończyć proces aktualizacji Flow Launcher musi zostać zresetowany Następujące pliki zostaną zaktualizowane Aktualizuj pliki Opis aktualizacji - Skip - Welcome to Flow Launcher - Hello, this is the first time you are running Flow Launcher! - Before starting, this wizard will assist in setting up Flow Launcher. You can skip this if you wish. Please choose a language - Search and run all files and applications on your PC - Search everything from applications, files, bookmarks, YouTube, Twitter and more. All from the comfort of your keyboard without ever touching the mouse. - Flow Launcher starts with the hotkey below, go ahead and try it out now. To change it, click on the input and press the desired hotkey on the keyboard. - Hotkeys - Action Keyword and Commands - Search the web, launch applications or run various functions through Flow Launcher plugins. Certain functions start with an action keyword, and if necessary, they can be used without action keywords. Try the queries below in Flow Launcher. - Let's Start Flow Launcher - Finished. Enjoy Flow Launcher. Don't forget the hotkey to start :) + Pomiń + Witamy w Flow Launcher + Witaj, po raz pierwszy uruchamiasz Flow Launcher! + Przed rozpoczęciem ten kreator pomoże skonfigurować Flow Launcher. Jeśli chcesz, możesz to pominąć. Proszę wybierz język + Wyszukiwanie i uruchamianie wszystkich plików i aplikacji na PC + Przeszukuj wszystko, od aplikacji, plików, zakładek, YouTube, X i nie tylko. Wszystko to z komfortowej klawiatury, bez konieczności dotykania myszy. + Flow Launcher uruchamia się za pomocą poniższego skrótu klawiszowego, śmiało i wypróbuj go teraz. Aby to zmienić, kliknij dane wejściowe i naciśnij żądany klawisz skrótu na klawiaturze. + Skróty klawiszowe + Słowo kluczowe akcji i polecenia + Przeszukuj sieć, uruchamiaj aplikacje lub uruchamiaj różne funkcje za pomocą wtyczek Flow Launcher. Niektóre funkcje zaczynają się od słowa kluczowego akcji, a w razie potrzeby można ich używać bez słów kluczowych akcji. Wypróbuj poniższe zapytania w Flow Launcher. + Uruchom Flow Launcher + Zakończono. Ciesz się Flow Launcher. Nie zapomnij o klawiszu skrótu, aby rozpocząć :) - Back / Context Menu - Item Navigation - Open Context Menu - Open Containing Folder - Run as Admin / Open Folder in Default File Manager - Query History + Powrót / Menu kontekstowe + Nawigacja pozycji + Otwórz menu kontekstowe + Otwórz folder zawierający + Uruchom jako administrator / Otwórz folder w domyślnym menedżerze plików + Historia zapytań Back to Result in Context Menu Autocomplete Open / Run Selected Item diff --git a/Flow.Launcher/Languages/pt-br.xaml b/Flow.Launcher/Languages/pt-br.xaml index 23a669536..e2ddd0524 100644 --- a/Flow.Launcher/Languages/pt-br.xaml +++ b/Flow.Launcher/Languages/pt-br.xaml @@ -154,6 +154,8 @@ Escuro Efeito Sonoro Reproduzir um pequeno som ao abrir a janela de pesquisa + Sound Effect Volume + Adjust the volume of the sound effect Animação Utilizar Animação na Interface Velocidade de Animação diff --git a/Flow.Launcher/Languages/pt-pt.xaml b/Flow.Launcher/Languages/pt-pt.xaml index 5edd8a37d..ce04e907a 100644 --- a/Flow.Launcher/Languages/pt-pt.xaml +++ b/Flow.Launcher/Languages/pt-pt.xaml @@ -154,6 +154,8 @@ Escuro Efeitos sonoros Reproduzir um som ao abrir a janela de pesquisa + Volume dos efeitos sonoros + Ajustar volume dos efeitos sonoros Animação Utilizar animações na aplicação Velocidade da animação diff --git a/Flow.Launcher/Languages/ru.xaml b/Flow.Launcher/Languages/ru.xaml index 88f6d060d..cf1e88c44 100644 --- a/Flow.Launcher/Languages/ru.xaml +++ b/Flow.Launcher/Languages/ru.xaml @@ -154,6 +154,8 @@ Тёмная Звуковой эффект Воспроизведение небольшого звука при открытии окна поиска + Sound Effect Volume + Adjust the volume of the sound effect Анимация Использование анимации в меню Скорость анимации diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index 91ae87631..974895bcb 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -154,6 +154,8 @@ Tmavá Zvukový efekt Po otvorení okna vyhľadávania prehrať krátky zvuk + Hlasitosť zvukového efektu + Upraviť hlasitosť zvukového efektu Animácia Animovať používateľské rozhranie Rýchlosť animácie @@ -171,7 +173,7 @@ Klávesová skratka pre Flow Launcher Zadajte skratku na zobrazenie/skrytie Flow Launchera. Klávesová skratka pre náhľad - Zadajte klávesovú skratku pre zobrazenie/skytie náhľadu vo vyhľadávacom okne. + Zadajte klávesovú skratku pre zobrazenie/skrytie náhľadu vo vyhľadávacom okne. Modifikačný kláves na otvorenie výsledkov Vyberte modifikačný kláves na otvorenie vybraného výsledku pomocou klávesnice. Zobraziť klávesovú skratku diff --git a/Flow.Launcher/Languages/sr.xaml b/Flow.Launcher/Languages/sr.xaml index 0c3c0f5a7..973ee60cc 100644 --- a/Flow.Launcher/Languages/sr.xaml +++ b/Flow.Launcher/Languages/sr.xaml @@ -154,6 +154,8 @@ Dark Sound Effect Play a small sound when the search window opens + Sound Effect Volume + Adjust the volume of the sound effect Animation Use Animation in UI Animation Speed diff --git a/Flow.Launcher/Languages/tr.xaml b/Flow.Launcher/Languages/tr.xaml index 8d5c595a2..16564c112 100644 --- a/Flow.Launcher/Languages/tr.xaml +++ b/Flow.Launcher/Languages/tr.xaml @@ -154,6 +154,8 @@ Koyu Ses Efekti Arama penceresi açıldığında küçük bir ses oynat + Sound Effect Volume + Adjust the volume of the sound effect Animasyon Arayüzde Animasyon Kullan Animation Speed diff --git a/Flow.Launcher/Languages/uk-UA.xaml b/Flow.Launcher/Languages/uk-UA.xaml index 2adbf5d2f..46ae5d2c0 100644 --- a/Flow.Launcher/Languages/uk-UA.xaml +++ b/Flow.Launcher/Languages/uk-UA.xaml @@ -154,6 +154,8 @@ Темна Звуковий ефект Відтворювати невеликий звук при відкритті вікна пошуку + Гучність звукового ефекту + Налаштуйте гучність звукового ефекту Анімація Використовувати анімацію в інтерфейсі Швидкість анімації diff --git a/Flow.Launcher/Languages/zh-cn.xaml b/Flow.Launcher/Languages/zh-cn.xaml index f3d2609b1..b2d9eeaa5 100644 --- a/Flow.Launcher/Languages/zh-cn.xaml +++ b/Flow.Launcher/Languages/zh-cn.xaml @@ -154,6 +154,8 @@ 深色 音效 启用激活音效 + 音效音量 + 调整音效音量 动画 启用动画 动画速度 diff --git a/Flow.Launcher/Languages/zh-tw.xaml b/Flow.Launcher/Languages/zh-tw.xaml index 5cd0591f4..4f5db8194 100644 --- a/Flow.Launcher/Languages/zh-tw.xaml +++ b/Flow.Launcher/Languages/zh-tw.xaml @@ -154,6 +154,8 @@ 暗色系 音效 搜尋窗口打開時播放音效 + Sound Effect Volume + Adjust the volume of the sound effect 動畫 使用介面動畫 Animation Speed diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 88e95aa69..e2c74d367 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -186,6 +186,10 @@ Key="F12" Command="{Binding ToggleGameModeCommand}" Modifiers="Ctrl" /> + callback) => _globalKeyboardHandlers.Add(callback); public void RemoveGlobalKeyboardCallback(Func callback) => _globalKeyboardHandlers.Remove(callback); + public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect); + #endregion #region Private Methods diff --git a/Flow.Launcher/Resources/open.wav b/Flow.Launcher/Resources/open.wav index 4f13724f7..0f692c75b 100644 Binary files a/Flow.Launcher/Resources/open.wav and b/Flow.Launcher/Resources/open.wav differ diff --git a/Flow.Launcher/ResultListBox.xaml.cs b/Flow.Launcher/ResultListBox.xaml.cs index 78720e86a..ac51b195c 100644 --- a/Flow.Launcher/ResultListBox.xaml.cs +++ b/Flow.Launcher/ResultListBox.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Windows; using System.Windows.Controls; @@ -137,6 +137,8 @@ namespace Flow.Launcher isDragging = false; + App.API.HideMainWindow(); + var data = new DataObject(DataFormats.FileDrop, new[] { path diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 1e886c022..96f80f0c5 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2474,27 +2474,81 @@ - - - - - - - + + + + + + + - + +  + + + + + + + + + + + + + + + + + + +  - - + + + + diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index db481d410..9b799e582 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -176,7 +176,8 @@ namespace Flow.Launcher.ViewModel var token = e.Token == default ? _updateToken : e.Token; PluginManager.UpdatePluginMetadata(e.Results, pair.Metadata, e.Query); - if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(e.Results, pair.Metadata, e.Query, token))) + if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(e.Results, pair.Metadata, e.Query, + token))) { Log.Error("MainViewModel", "Unable to add item to Result Update Queue"); } @@ -190,7 +191,8 @@ namespace Flow.Launcher.ViewModel Hide(); await PluginManager.ReloadDataAsync().ConfigureAwait(false); - Notification.Show(InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully")); + Notification.Show(InternationalizationManager.Instance.GetTranslation("success"), + InternationalizationManager.Instance.GetTranslation("completedSuccessfully")); } [RelayCommand] @@ -208,7 +210,7 @@ namespace Flow.Launcher.ViewModel } [RelayCommand] - private void ReQuery() + public void ReQuery() { if (SelectedIsFromQueryResults()) { @@ -216,6 +218,14 @@ namespace Flow.Launcher.ViewModel } } + public void ReQuery(bool reselect) + { + if (SelectedIsFromQueryResults()) + { + QueryResults(isReQuery: true, reSelect: reselect); + } + } + [RelayCommand] private void LoadContextMenu() { @@ -265,6 +275,7 @@ namespace Flow.Launcher.ViewModel { autoCompleteText = $"{result.ActionKeywordAssigned} {defaultSuggestion}"; } + autoCompleteText = SelectedResults.SelectedItem.QuerySuggestionText; } @@ -286,11 +297,13 @@ namespace Flow.Launcher.ViewModel { results.SelectedIndex = int.Parse(index); } + var result = results.SelectedItem?.Result; if (result == null) { return; } + var hideWindow = await result.ExecuteAsync(new ActionContext { // not null means pressing modifier key + number, should ignore the modifier key @@ -371,6 +384,17 @@ namespace Flow.Launcher.ViewModel { GameModeStatus = !GameModeStatus; } + + [RelayCommand] + public void CopyAlternative() + { + var result = Results.SelectedItem?.Result?.CopyText; + + if (result != null) + { + App.API.CopyToClipboard(result, directCopy: false); + } + } #endregion @@ -403,6 +427,7 @@ namespace Flow.Launcher.ViewModel public bool GameModeStatus { get; set; } = false; private string _queryText; + public string QueryText { get => _queryText; @@ -426,6 +451,7 @@ namespace Flow.Launcher.ViewModel Settings.WindowSize += 100; Settings.WindowLeft -= 50; } + OnPropertyChanged(); } @@ -441,6 +467,7 @@ namespace Flow.Launcher.ViewModel Settings.WindowLeft += 50; Settings.WindowSize -= 100; } + OnPropertyChanged(); } @@ -520,18 +547,17 @@ namespace Flow.Launcher.ViewModel { if (QueryText != queryText) { - // re-query is done in QueryText's setter method QueryText = queryText; // set to false so the subsequent set true triggers // PropertyChanged and MoveQueryTextToEnd is called QueryTextCursorMovedToEnd = false; - } else if (isReQuery) { Query(isReQuery: true); } + QueryTextCursorMovedToEnd = true; }); } @@ -601,8 +627,8 @@ namespace Flow.Launcher.ViewModel public string OpenResultCommandModifiers => Settings.OpenResultModifiers; - public string PreviewHotkey - { + public string PreviewHotkey + { get { // TODO try to patch issue #1755 @@ -616,6 +642,7 @@ namespace Flow.Launcher.ViewModel { Settings.PreviewHotkey = "F1"; } + return Settings.PreviewHotkey; } } @@ -661,20 +688,7 @@ namespace Flow.Launcher.ViewModel List results; if (selected == lastContextMenuResult) { - // Use copy to keep the original results unchanged - results = lastContextMenuResults.ConvertAll(result => new Result - { - Title = result.Title, - SubTitle = result.SubTitle, - IcoPath = result.IcoPath, - PluginDirectory = result.PluginDirectory, - Action = result.Action, - ContextData = result.ContextData, - Glyph = result.Glyph, - OriginQuery = result.OriginQuery, - Score = result.Score, - AsyncAction = result.AsyncAction, - }); + results = lastContextMenuResults; } else { @@ -684,12 +698,11 @@ namespace Flow.Launcher.ViewModel results.Add(ContextMenuTopMost(selected)); results.Add(ContextMenuPluginInfo(selected.PluginID)); } - if (!string.IsNullOrEmpty(query)) { - var filtered = results.Where + var filtered = results.Select(x => x.Clone()).Where ( r => { @@ -703,7 +716,6 @@ namespace Flow.Launcher.ViewModel r.Score = match.Score; return true; - }).ToList(); ContextMenu.AddResults(filtered, id); } @@ -730,10 +742,7 @@ namespace Flow.Launcher.ViewModel Title = string.Format(title, h.Query), SubTitle = string.Format(time, h.ExecutedDateTime), IcoPath = "Images\\history.png", - OriginQuery = new Query - { - RawQuery = h.Query - }, + OriginQuery = new Query { RawQuery = h.Query }, Action = _ => { SelectedResults = Results; @@ -761,7 +770,7 @@ namespace Flow.Launcher.ViewModel private readonly IReadOnlyList _emptyResult = new List(); - private async void QueryResults(bool isReQuery = false) + private async void QueryResults(bool isReQuery = false, bool reSelect = true) { _updateSource?.Cancel(); @@ -836,7 +845,7 @@ namespace Flow.Launcher.ViewModel var tasks = plugins.Select(plugin => plugin.Metadata.Disabled switch { - false => QueryTask(plugin), + false => QueryTask(plugin, reSelect), true => Task.CompletedTask }).ToArray(); @@ -864,26 +873,29 @@ namespace Flow.Launcher.ViewModel } // Local function - async Task QueryTask(PluginPair plugin) + async Task QueryTask(PluginPair plugin, bool reSelect = true) { // Since it is wrapped within a ThreadPool Thread, the synchronous context is null // Task.Yield will force it to run in ThreadPool await Task.Yield(); - IReadOnlyList results = await PluginManager.QueryForPluginAsync(plugin, query, currentCancellationToken); + IReadOnlyList results = + await PluginManager.QueryForPluginAsync(plugin, query, currentCancellationToken); currentCancellationToken.ThrowIfCancellationRequested(); results ??= _emptyResult; - if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(results, plugin.Metadata, query, currentCancellationToken))) + if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(results, plugin.Metadata, query, + currentCancellationToken, reSelect))) { Log.Error("MainViewModel", "Unable to add item to Result Update Queue"); } } } - private Query ConstructQuery(string queryText, IEnumerable customShortcuts, IEnumerable builtInShortcuts) + private Query ConstructQuery(string queryText, IEnumerable customShortcuts, + IEnumerable builtInShortcuts) { if (string.IsNullOrWhiteSpace(queryText)) { @@ -893,7 +905,8 @@ namespace Flow.Launcher.ViewModel StringBuilder queryBuilder = new(queryText); StringBuilder queryBuilderTmp = new(queryText); - foreach (var shortcut in customShortcuts) + // Sorting order is important here, the reason is for matching longest shortcut by default + foreach (var shortcut in customShortcuts.OrderByDescending(x => x.Key.Length)) { if (queryBuilder.Equals(shortcut.Key)) { @@ -920,7 +933,9 @@ namespace Flow.Launcher.ViewModel } catch (Exception e) { - Log.Exception($"{nameof(MainViewModel)}.{nameof(ConstructQuery)}|Error when expanding shortcut {shortcut.Key}", e); + Log.Exception( + $"{nameof(MainViewModel)}.{nameof(ConstructQuery)}|Error when expanding shortcut {shortcut.Key}", + e); } } }); @@ -1065,6 +1080,7 @@ namespace Flow.Launcher.ViewModel { SelectedResults = Results; } + switch (Settings.LastQueryMode) { case LastQueryMode.Empty: @@ -1112,7 +1128,7 @@ namespace Flow.Launcher.ViewModel /// /// To avoid deadlock, this method should not called from main thread /// - public void UpdateResultView(IEnumerable resultsForUpdates) + public void UpdateResultView(ICollection resultsForUpdates) { if (!resultsForUpdates.Any()) return; @@ -1151,7 +1167,10 @@ namespace Flow.Launcher.ViewModel } } - Results.AddResults(resultsForUpdates, token); + // it should be the same for all results + bool reSelect = resultsForUpdates.First().ReSelectFirstResult; + + Results.AddResults(resultsForUpdates, token, reSelect); } #endregion diff --git a/Flow.Launcher/ViewModel/ResultsForUpdate.cs b/Flow.Launcher/ViewModel/ResultsForUpdate.cs index 4cb5b1a95..bc0be0de8 100644 --- a/Flow.Launcher/ViewModel/ResultsForUpdate.cs +++ b/Flow.Launcher/ViewModel/ResultsForUpdate.cs @@ -4,23 +4,13 @@ using System.Threading; namespace Flow.Launcher.ViewModel { - public struct ResultsForUpdate + public record struct ResultsForUpdate( + IReadOnlyList Results, + PluginMetadata Metadata, + Query Query, + CancellationToken Token, + bool ReSelectFirstResult = true) { - public IReadOnlyList Results { get; } - - public PluginMetadata Metadata { get; } - public string ID { get; } - - public Query Query { get; } - public CancellationToken Token { get; } - - public ResultsForUpdate(IReadOnlyList results, PluginMetadata metadata, Query query, CancellationToken token) - { - Results = results; - Metadata = metadata; - Query = query; - Token = token; - ID = metadata.ID; - } + public string ID { get; } = Metadata.ID; } } diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs index bb07ce085..d02dc9bd5 100644 --- a/Flow.Launcher/ViewModel/ResultsViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs @@ -147,23 +147,23 @@ namespace Flow.Launcher.ViewModel /// /// To avoid deadlock, this method should not called from main thread /// - public void AddResults(IEnumerable resultsForUpdates, CancellationToken token) + public void AddResults(IEnumerable resultsForUpdates, CancellationToken token, bool reselect = true) { var newResults = NewResults(resultsForUpdates); if (token.IsCancellationRequested) return; - UpdateResults(newResults, token); + UpdateResults(newResults, token, reselect); } - private void UpdateResults(List newResults, CancellationToken token = default) + private void UpdateResults(List newResults, CancellationToken token = default, bool reselect = true) { lock (_collectionLock) { // update UI in one run, so it can avoid UI flickering Results.Update(newResults, token); - if (Results.Any()) + if (reselect && Results.Any()) SelectedItem = Results[0]; } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 231e65539..86a25ffb1 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -63,6 +63,9 @@ namespace Flow.Launcher.ViewModel case nameof(Settings.PreviewHotkey): OnPropertyChanged(nameof(AlwaysPreviewToolTip)); break; + case nameof(Settings.SoundVolume): + OnPropertyChanged(nameof(SoundEffectVolume)); + break; } }; @@ -631,6 +634,12 @@ namespace Flow.Launcher.ViewModel set => Settings.UseSound = value; } + public double SoundEffectVolume + { + get => Settings.SoundVolume; + set => Settings.SoundVolume = value; + } + public bool UseClock { get => Settings.UseClock; diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs index 1e4f3f9ac..8ce597b30 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs @@ -33,20 +33,32 @@ namespace Flow.Launcher.Plugin.BrowserBookmark protected List LoadBookmarksFromFile(string path, string source) { - if (!File.Exists(path)) - return new List(); - var bookmarks = new List(); + + if (!File.Exists(path)) + return bookmarks; + using var jsonDocument = JsonDocument.Parse(File.ReadAllText(path)); if (!jsonDocument.RootElement.TryGetProperty("roots", out var rootElement)) - return new List(); + return bookmarks; + EnumerateRoot(rootElement, bookmarks, source); + return bookmarks; + } + + private void EnumerateRoot(JsonElement rootElement, ICollection bookmarks, string source) + { foreach (var folder in rootElement.EnumerateObject()) { - if (folder.Value.ValueKind == JsonValueKind.Object) + if (folder.Value.ValueKind != JsonValueKind.Object) + continue; + + // Fix for Opera. It stores bookmarks slightly different than chrome. See PR and bug report for this change for details. + // If various exceptions start to build up here consider splitting this Loader into multiple separate ones. + if (folder.Name == "custom_root") + EnumerateRoot(folder.Value, bookmarks, source); + else EnumerateFolderBookmark(folder.Value, bookmarks, source); } - - return bookmarks; } private void EnumerateFolderBookmark(JsonElement folderElement, ICollection bookmarks, 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 2ee832b81..fe118c2c3 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj @@ -56,7 +56,7 @@ - + \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/plugin.json b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/plugin.json index 0778b7ae5..c4a24a57b 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": "3.1.5", + "Version": "3.2.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.BrowserBookmark.dll", diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/ru.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/ru.xaml index efb08c3f1..cb7f2cda5 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/ru.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/ru.xaml @@ -3,13 +3,13 @@ Сначала отметьте что-нибудь - Please select a folder link + Пожалуйста, выберите ссылку на папку Вы уверены, что хотите удалить {0}? Вы действительно хотите безвозвратно удалить этот файл? Вы действительно хотите безвозвратно удалить этот файл/папку? Удаление завершено Успешно удалено {0} - Assigning the global action keyword could bring up too many results during search. Please choose a specific action keyword + Назначение ключевого слова глобальных действий может привести к слишком большому количеству результатов поиска. Пожалуйста, выберите конкретное ключевое слово действий Quick Access can not be set to the global action keyword when enabled. Please choose a specific action keyword The required service for Windows Index Search does not appear to be running To fix this, start the Windows Search service. Select here to remove this warning diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index fac4621b0..60c1b11b5 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -10,7 +10,7 @@ "Name": "Explorer", "Description": "Find and manage files and folders via Windows Search or Everything", "Author": "Jeremy Wu", - "Version": "3.1.5", + "Version": "3.1.6", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/zh-cn.xaml b/Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/zh-cn.xaml index be73c37f4..749c7c3ac 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/zh-cn.xaml +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/zh-cn.xaml @@ -28,11 +28,11 @@ 此插件已安装 插件列表下载失败 请检查您是否可以连接到 github.com。这个错误意味着您可能无法安装或更新插件。 - Update all plugins - Would you like to update all plugins? - Would you like to update {0} plugins?{1}Flow Launcher will restart after updating all plugins. - Would you like to update {0} plugins? - {0} plugins successfully updated. Restarting Flow, please wait... + 更新所有插件 + 您想要更新所有插件吗? + 您想要更新 {0} 插件吗?{1}更新所有插件后 Flow Launcher 将重启。 + 您想要更新 {0} 插件吗? + 插件 {0} 更新成功。正在重新启动 Flow Launcher,请稍候..…… 插件{0}更新成功。正在重新启动 Flow Launcher,请稍候... 从未知源安装 您正在从未知源安装此插件,它可能包含潜在风险!{0}{0}请确保您了解来源以及安全性。{0}{0}您想要继续吗?{0}{0}(您可以通过设置关闭此警告) @@ -40,7 +40,7 @@ 成功安装插件{0}。请重新启动 Flow Launcher。 成功卸载插件{0}。请重新启动 Flow Launcher。 成功更新插件{0}。请重新启动 Flow Launcher。 - {0} plugins successfully updated. Please restart Flow. + 插件 {0} 更新成功。请重新启动 Flow Launcher。 插件 {0} 已被修改。请在进行任何进一步更改之前重新启动Flow。 diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json index 4e475f171..438a407e2 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": "3.1.0", + "Version": "3.1.1", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll", diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/ar.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/ar.xaml index e62854305..dda427996 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/ar.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/ar.xaml @@ -71,6 +71,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/cs.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/cs.xaml index 7be93ad14..9a703d3de 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/cs.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/cs.xaml @@ -71,6 +71,7 @@ Spustit jako správce Otevřít umístění složky Zakázat zobrazování tohoto programu + Open target folder Program  Vyhledávání programů ve Flow Launcheru diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/da.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/da.xaml index 905f7e787..676eb76cb 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/da.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/da.xaml @@ -71,6 +71,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml index 5ab3eb9ec..293dbc9c8 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml @@ -71,6 +71,7 @@ Als Administrator ausführen Enthaltenden Ordner öffnen Disable this program from displaying + Open target folder Programm Suche Programme mit Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml index 39807db2c..d7e87b50b 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml @@ -73,6 +73,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/es-419.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/es-419.xaml index 4a18143bf..375dcd041 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/es-419.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/es-419.xaml @@ -71,6 +71,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/es.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/es.xaml index 4955c4ea2..d4eccc8ac 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/es.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/es.xaml @@ -71,6 +71,7 @@ Ejecutar como administrador Abrir carpeta contenedora Desactivar la visualización de este programa + Abrir carpeta de destino Programa Busca programas en Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/fr.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/fr.xaml index 91f5e3ee5..d8b3dc5dd 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/fr.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/fr.xaml @@ -71,6 +71,7 @@ Exécuter en tant qu'administrateur Ouvrir le répertoire Désactiver l'affichage de ce programme + Ouvrir le répertoire cible Programme Rechercher des programmes dans Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/it.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/it.xaml index d13f926d6..3a4d0e238 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/it.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/it.xaml @@ -71,6 +71,7 @@ Run As Administrator Apri percorso file Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml index 863735769..6c35d7df1 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml @@ -71,6 +71,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/ko.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/ko.xaml index 9741a7fe2..2857194c7 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/ko.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/ko.xaml @@ -71,6 +71,7 @@ 관리자 권한으로 실행 포함된 폴더 열기 이 프로그램 표시 비활성화 + Open target folder 프로그램 Flow Launcher에서 프로그램을 검색합니다 diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/nb.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/nb.xaml index e62854305..dda427996 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/nb.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/nb.xaml @@ -71,6 +71,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/nl.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/nl.xaml index 3c3b20afd..972cbe8d6 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/nl.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/nl.xaml @@ -71,6 +71,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml index c46a92006..d651fb0b9 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml @@ -71,6 +71,7 @@ Uruchom jako administrator Open containing folder Disable this program from displaying + Open target folder Programy Szukaj i uruchamiaj programy z poziomu Flow Launchera diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/pt-br.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/pt-br.xaml index b943ffe97..f1cb7d7a2 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/pt-br.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/pt-br.xaml @@ -71,6 +71,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/pt-pt.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/pt-pt.xaml index 669fe3182..0832c2150 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/pt-pt.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/pt-pt.xaml @@ -71,6 +71,7 @@ Executar como administrador Abrir pasta de destino Desativar exibição deste programa + Abrir pasta de destino Programas Pesquisa de programas com o Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/ru.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/ru.xaml index 9fdb70d4f..ebc30e161 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/ru.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/ru.xaml @@ -71,6 +71,7 @@ Запустить от имени администратора Открыть содержащую папку Отключить отображение этой программы + Open target folder Программа Поиск программ в Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml index ee62a823e..a669d256b 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml @@ -71,6 +71,7 @@ Spustiť ako správca Otvoriť umiestnenie priečinka Zakázať zobrazovanie tohto programu + Otvoriť cieľový pričinok Program Vyhľadávanie programov vo Flow Launcheri diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/sr.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/sr.xaml index f77bce039..6d995e1ab 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/sr.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/sr.xaml @@ -71,6 +71,7 @@ Run As Administrator Open containing folder Disable this program from displaying + Open target folder Program Search programs in Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml index 3d1f087f2..675c9f132 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml @@ -71,6 +71,7 @@ Yönetici Olarak Çalıştır Open containing folder Disable this program from displaying + Open target folder Program Programları Flow Launcher'tan arayın diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/uk-UA.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/uk-UA.xaml index f4a9926e8..344695d1e 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/uk-UA.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/uk-UA.xaml @@ -71,6 +71,7 @@ Запустити від імені адміністратора Відкрити папку Вимкнути відображення цієї програми + Відкрити цільову папку Програма Пошук програм у Flow Launcher diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml index 3a6fbda5d..324bd3057 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml @@ -71,6 +71,7 @@ 以管理员身份运行 打开文件所在文件夹 禁止显示该程序 + Open target folder 程序 在 Flow Launcher 中搜索程序 diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml index d27b5f78f..7c72b1aa3 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml @@ -71,6 +71,7 @@ 以系統管理員身分執行 開啟檔案位置 Disable this program from displaying + Open target folder 程式 在 Flow Launcher 中搜尋程式 diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index c02573ed8..e0a7f23de 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -84,7 +84,7 @@ namespace Flow.Launcher.Plugin.Program Log.Info($"|Flow.Launcher.Plugin.Program.Main|Number of preload win32 programs <{_win32s.Length}>"); Log.Info($"|Flow.Launcher.Plugin.Program.Main|Number of preload uwps <{_uwps.Length}>"); - bool cacheEmpty = !_win32s.Any() && !_uwps.Any(); + bool cacheEmpty = !_win32s.Any() || !_uwps.Any(); if (cacheEmpty || _settings.LastIndexTime.AddHours(30) < DateTime.Now) { diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 7d08d3670..a64a708ef 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -39,15 +39,20 @@ namespace Flow.Launcher.Plugin.Program.Programs public string FullPath { get; set; } /// - /// Path of the executable for .lnk, or the URL for .url. Arguments are included if any. + /// Path of the executable for .lnk, or the URL for .url /// public string LnkResolvedPath { get; set; } /// - /// Path of the actual executable file. Args are included. + /// Path of the actual executable file /// public string ExecutablePath => LnkResolvedPath ?? FullPath; + /// + /// Arguments for the executable. + /// + public string Args { get; set; } + public string ParentDirectory { get; set; } /// @@ -178,6 +183,7 @@ namespace Flow.Launcher.Plugin.Program.Programs Score = matchResult.Score, TitleHighlightData = matchResult.MatchData, ContextData = this, + TitleToolTip = $"{title}\n{ExecutablePath}", Action = c => { // Ctrl + Enter to open containing folder @@ -196,7 +202,7 @@ namespace Flow.Launcher.Plugin.Program.Programs FileName = FullPath, WorkingDirectory = ParentDirectory, UseShellExecute = true, - Verb = runAsAdmin ? "runas" : "" + Verb = runAsAdmin ? "runas" : "", }; _ = Task.Run(() => Main.StartProcess(Process.Start, info)); @@ -261,11 +267,29 @@ namespace Flow.Launcher.Plugin.Program.Programs }, IcoPath = "Images/folder.png", Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\xe838"), - } + }, }; + if (Extension(FullPath) == ShortcutExtension) + { + contextMenus.Add(OpenTargetFolderContextMenuResult(api)); + } return contextMenus; } + private Result OpenTargetFolderContextMenuResult(IPublicAPI api) + { + return new Result + { + Title = api.GetTranslation("flowlauncher_plugin_program_open_target_folder"), + Action = _ => + { + api.OpenDirectory(Path.GetDirectoryName(ExecutablePath), ExecutablePath); + return true; + }, + IcoPath = "Images/folder.png", + Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\xe8de"), + }; + } public override string ToString() { @@ -327,7 +351,7 @@ namespace Flow.Launcher.Plugin.Program.Programs var args = _helper.arguments; if (!string.IsNullOrEmpty(args)) { - program.LnkResolvedPath += " " + args; + program.Args = args; } var description = _helper.description; @@ -624,7 +648,7 @@ namespace Flow.Launcher.Plugin.Program.Programs private static IEnumerable ProgramsHasher(IEnumerable programs) { var startMenuPaths = GetStartMenuPaths(); - return programs.GroupBy(p => p.ExecutablePath.ToLowerInvariant()) + return programs.GroupBy(p => (p.ExecutablePath + p.Args).ToLowerInvariant()) .AsParallel() .SelectMany(g => { diff --git a/Plugins/Flow.Launcher.Plugin.Program/plugin.json b/Plugins/Flow.Launcher.Plugin.Program/plugin.json index 7f6b5f938..9ed7edbd9 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": "3.2.0", + "Version": "3.2.1", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Program.dll", diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Languages/zh-cn.xaml b/Plugins/Flow.Launcher.Plugin.Shell/Languages/zh-cn.xaml index 318903f07..2db287e39 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/Languages/zh-cn.xaml +++ b/Plugins/Flow.Launcher.Plugin.Shell/Languages/zh-cn.xaml @@ -2,8 +2,8 @@ 替换 Win+R - Close Command Prompt after pressing any key - Press any key to close this window... + 按下任意键后关闭命令提示符 + 按下任意键以关闭此窗口... 执行后不关闭命令窗口 始终以管理员身份运行 以其他用户身份运行 diff --git a/Plugins/Flow.Launcher.Plugin.Shell/plugin.json b/Plugins/Flow.Launcher.Plugin.Shell/plugin.json index 6c2b2a184..e06c22c54 100644 --- a/Plugins/Flow.Launcher.Plugin.Shell/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Shell/plugin.json @@ -4,7 +4,7 @@ "Name": "Shell", "Description": "Provide executing commands from Flow Launcher", "Author": "qianlifeng", - "Version": "3.2.0", + "Version": "3.2.1", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Shell.dll", diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/ar.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/ar.xaml index 41e005894..ddf8a4d71 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/ar.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/ar.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Exit Save Settings - Restart Flow Launcher" + Restart Flow Launcher Settings Reload Plugin Data Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/cs.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/cs.xaml index 3e053b39f..b377ad3d2 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/cs.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/cs.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Ukončit Save Settings - Restart Flow Launcher" + Restartovat Flow Launcher Nastavení Znovu načíst data pluginů Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/da.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/da.xaml index 8c5e4d0ff..30beff7b5 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/da.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/da.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Afslut Save Settings - Restart Flow Launcher" + Restart Flow Launcher Indstillinger Reload Plugin Data Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml index 282a0e809..91f32a844 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml @@ -19,7 +19,7 @@ Open Recycle Bin Exit Save Settings - Restart Flow Launcher" + Restart Flow Launcher Settings Reload Plugin Data Check For Update @@ -62,4 +62,4 @@ System Commands Provides System related commands. e.g. shutdown, lock, settings etc. - \ No newline at end of file + diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/es-419.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/es-419.xaml index 05a5458e1..1275f8b74 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/es-419.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/es-419.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Salir Save Settings - Restart Flow Launcher" + Restart Flow Launcher Ajustes Reload Plugin Data Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/es.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/es.xaml index f95e44dcf..c457b160c 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/es.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/es.xaml @@ -17,7 +17,7 @@ Abrir papelera de reciclaje Salir Guardar configuración - Reiniciar Flow Launcher" + Reinicia Flow Launcher Configuración Recargar datos del complemento Buscar actualizaciones diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/it.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/it.xaml index a70994188..62d455c07 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/it.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/it.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Esci Save Settings - Restart Flow Launcher" + Riavvia Flow Launcher Impostazioni Ricarica i dati del plugin Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/ja.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/ja.xaml index 9080cf314..bb00a0df6 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/ja.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/ja.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Save Settings - Restart Flow Launcher" + Flow Launcherを再起動する プラグインデータのリロード Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/ko.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/ko.xaml index 5389cbb38..e2962ff34 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/ko.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/ko.xaml @@ -17,7 +17,7 @@ Open Recycle Bin 종료 Save Settings - Restart Flow Launcher" + Flow Launcher 재시작 설정 플러그인 데이터 새로고 Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/nb.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/nb.xaml index 41e005894..ddf8a4d71 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/nb.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/nb.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Exit Save Settings - Restart Flow Launcher" + Restart Flow Launcher Settings Reload Plugin Data Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/nl.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/nl.xaml index ca798f9d7..00201fa0e 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/nl.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/nl.xaml @@ -2,8 +2,8 @@ - Command - Description + Opdracht + Beschrijving Shutdown Restart @@ -17,7 +17,7 @@ Open Recycle Bin Afsluiten Save Settings - Restart Flow Launcher" + Flow Launcher herstarten Instellingen Reload Plugin Data Check For Update @@ -27,37 +27,37 @@ Toggle Game Mode - Shutdown Computer - Restart Computer - Restart the computer with Advanced Boot Options for Safe and Debugging modes, as well as other options - Log off - Lock this computer - Close Flow Launcher - Restart Flow Launcher + Computer afsluiten + Computer opnieuw opstarten + Start de computer opnieuw op met geavanceerde opstartopties voor veilige en foutopsporing modi en andere opties + Afmelden + Deze computer vergrendelen + Sluit Flow Launcher + Flow Launcher herstarten Tweak Flow Launcher's settings - Put computer to sleep - Empty recycle bin + De computer in slaapstand zetten + Prullenbak leegmaken Open recycle bin Indexing Options - Hibernate computer - Save all Flow Launcher settings - Refreshes plugin data with new content - Open Flow Launcher's log location - Check for new Flow Launcher update - Visit Flow Launcher's documentation for more help and how to use tips - Open the location where Flow Launcher's settings are stored + De computer in sluimerstand zetten + Sla alle Flow Launcher instellingen op + Vernieuwt plugin data met nieuwe inhoud + Open de locatie van Flow Launcher's log bestand + Controleer op nieuwe Flow Launcher update + Bezoek Flow Launcher's documentatie voor meer hulp en tips + Open de locatie waar Flow Launcher's instellingen worden opgeslagen Toggle Game Mode Succesvol - All Flow Launcher settings saved - Reloaded all applicable plugin data - Are you sure you want to shut the computer down? - Are you sure you want to restart the computer? - Are you sure you want to restart the computer with Advanced Boot Options? + Alle Flow Launcher instellingen opgeslagen + Alle toepasselijke plugin gegevens zijn herladen + Weet u zeker dat u de computer wilt uitschakelen? + Weet u zeker dat u de computer wilt herstarten? + Weet u zeker dat u de computer wilt herstarten met geavanceerde opstartopties? Are you sure you want to log off? - System Commands - Provides System related commands. e.g. shutdown, lock, settings etc. + Systeemopdrachten + Voorziet in systeem gerelateerde opdrachten. bijv.: afsluiten, vergrendelen, instellingen, enz. diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/pl.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/pl.xaml index 4549f193e..4c7592411 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/pl.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/pl.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Wyjdź Save Settings - Restart Flow Launcher" + Uruchom ponownie Flow Launchera Ustawienia Reload Plugin Data Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/pt-br.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/pt-br.xaml index b80ddf621..a51c751df 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/pt-br.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/pt-br.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Sair Save Settings - Restart Flow Launcher" + Reiniciar Flow Launcher Configurações Recarregar Dados de Plugin Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/ru.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/ru.xaml index 927ccb0b6..3d3bcfc87 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/ru.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/ru.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Выйти Save Settings - Restart Flow Launcher" + Restart Flow Launcher Настройки Перезагрузить данные плагинов Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/sk.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/sk.xaml index 82d8c2fe4..c5cee316f 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/sk.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/sk.xaml @@ -17,7 +17,7 @@ Otvoriť kôš Ukončiť Uložiť nastavenia - Reštartovať Flow Launcher" + Reštartovať Flow Launcher Nastavenia Znova načítať údaje pluginov Skontrolovať aktualizácie diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/sr.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/sr.xaml index fa6b54b81..a984954f9 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/sr.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/sr.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Izlaz Save Settings - Restart Flow Launcher" + Restart Flow Launcher Podešavanja Reload Plugin Data Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/tr.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/tr.xaml index 9670d8297..35850cb26 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/tr.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/tr.xaml @@ -17,7 +17,7 @@ Open Recycle Bin Çıkı Save Settings - Restart Flow Launcher" + Flow Launcher'u Yeniden Başlat Ayarlar Reload Plugin Data Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/uk-UA.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/uk-UA.xaml index 526144b43..8f2883bce 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/uk-UA.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/uk-UA.xaml @@ -17,7 +17,7 @@ Відкрити кошик Вийти Зберегти налаштування - Перезапустити Flow Launcher" + Перезапустити Flow Launcher Налаштування Перезавантажити дані плагінів Перевірити наявність оновлень diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/zh-cn.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/zh-cn.xaml index be84d0e7f..cd0b6f166 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/zh-cn.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/zh-cn.xaml @@ -11,20 +11,20 @@ Log Off/Sign Out Lock Sleep - Hibernate - Index Option - Empty Recycle Bin - Open Recycle Bin + 休眠 + 索引选项 + 清空回收站 + 打开回收站 退出 - Save Settings - Restart Flow Launcher" + 保存设置 + 重启 Flow Launcher 设置 重新加载插件数据 - Check For Update - Open Log Location - Flow Launcher Tips - Flow Launcher UserData Folder - Toggle Game Mode + 检查更新 + 打开日志文件夹 + Flow Launcher 提示 + Flow Launcher 用户数据文件夹 + 切换游戏模式 关闭电脑 @@ -46,7 +46,7 @@ 检查新的 Flow Launcher 更新 访问 Flow Launcher 的文档以获取更多帮助以及使用技巧 打开Flow Launcher 设置文件夹 - Toggle Game Mode + 切换游戏模式 成功 diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Languages/zh-tw.xaml b/Plugins/Flow.Launcher.Plugin.Sys/Languages/zh-tw.xaml index 62bf8f012..9934acc9f 100644 --- a/Plugins/Flow.Launcher.Plugin.Sys/Languages/zh-tw.xaml +++ b/Plugins/Flow.Launcher.Plugin.Sys/Languages/zh-tw.xaml @@ -17,7 +17,7 @@ Open Recycle Bin 結束 Save Settings - Restart Flow Launcher" + 重新啟動 Flow Launcher 設定 重新載入插件資料 Check For Update diff --git a/Plugins/Flow.Launcher.Plugin.Sys/plugin.json b/Plugins/Flow.Launcher.Plugin.Sys/plugin.json index 5276690e3..f7dea266a 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": "3.1.1", + "Version": "3.1.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Sys.dll", diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.fr-FR.resx b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.fr-FR.resx index 49644f5a3..9864cdfc1 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.fr-FR.resx +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.fr-FR.resx @@ -1890,7 +1890,7 @@ Microsoft New Phonetic Settings - Generate a system health report + Générer un rapport de santé du système Fix problems with your computer @@ -1959,7 +1959,7 @@ Configure advanced user profile properties - Start or stop using AutoPlay for all media and devices + Démarrer ou arrêter l'utilisation de la fonction AutoPlay pour tous les médias et appareils Change Automatic Maintenance settings @@ -1971,16 +1971,16 @@ Select users who can use remote desktop - Show which programs are installed on your computer + Afficher les programmes installés sur votre ordinateur Allow remote access to your computer - View advanced system settings + Afficher les paramètres avancés du système - How to install a program + Comment installer un programme Modifier le fonctionnement de votre clavier @@ -2013,7 +2013,7 @@ Change your homepage - Group similar windows on the taskbar + Grouper les fenêtres similaires sur la barre des tâches Change Windows SideShow settings @@ -2031,7 +2031,7 @@ Change when the computer sleeps - Set up a virtual private network (VPN) connection + Configurer une connexion à un réseau privé virtuel (VPN) Accommodate learning abilities @@ -2040,10 +2040,10 @@ Set up a dial-up connection - Set up a connection or network + Configurer une connexion ou un réseau - How to change your Windows password + Comment modifier votre mot de passe Windows Make it easier to see the mouse pointer @@ -2097,13 +2097,13 @@ Show how much RAM is on this computer - Edit power plan + Modifier le mode de gestion d'alimentation - Adjust system volume + Ajuster le volume système - Defragment and optimise your drives + Défragmenter et optimiser les lecteurs Set up ODBC data sources (32-bit) @@ -2115,7 +2115,7 @@ Magnify portions of the screen using Magnifier - Change the file type associated with a file extension + Modifier le type de fichier associé à une extension de fichier View event logs @@ -2140,10 +2140,10 @@ - Turn Windows features on or off + Activer ou désactiver des fonctionnalités Windows - Show which operating system your computer is running + Afficher le système d'exploitation utilisé par l'ordinateur View local services @@ -2161,10 +2161,10 @@ Advanced printer setup - Change default printer + Changer l'imprimante par défaut - Edit environment variables for your account + Modifier les variables d'environnement pour votre compte Optimise visual display @@ -2182,7 +2182,7 @@ Clear disk space by deleting unnecessary files - View devices and printers + Afficher les appareils et les imprimantes Private Character Editor @@ -2206,16 +2206,16 @@ Choose the order of how your screen rotates - Change how Windows searches + Modifier le mode de recherche de Windows Set flicks to perform certain tasks - Change account type + Changer le type de compte - Change screen saver + Modifier l'économiseur d'écran Change User Account Control settings @@ -2224,10 +2224,10 @@ Turn on easy access keys - Identify and repair network problems + Identifier et réparer les problèmes de réseau - Find and fix networking and connection problems + Rechercher et résoudre les problèmes de réseau et de connexion Play CDs or other media automatically @@ -2236,34 +2236,34 @@ View basic information about your computer - Choose how you open links + Choisissez comment ouvrir les liens Allow Remote Assistance invitations to be sent from this computer - Task Manager + Gestionnaire des tâches Turn flicks on or off - Add a language + Ajouter une langue - View network status and tasks + Afficher l'état du réseau et les tâches - Turn Magnifier on or off + Activer ou désactiver la loupe - See the name of this computer + Afficher le nom de cet ordinateur - View network connections + Afficher les connexions réseau - Perform recommended maintenance tasks automatically + Effectuer automatiquement les tâches de maintenance recommandées Manage disk space used by your offline files @@ -2281,7 +2281,7 @@ Change the way dates and lists are displayed - Manage audio devices + Gérer les appareils audio Change security settings @@ -2290,7 +2290,7 @@ Check security status - Delete cookies or temporary files + Supprimer les cookies ou les fichiers temporaires Specify which hand you write with @@ -2323,7 +2323,7 @@ Enable or disable session cookies - Give administrative rights to a domain user + Donner des droits d'administration à un utilisateur du domaine Choose when to turn off display @@ -2332,7 +2332,7 @@ Move the pointer with the keypad using MouseKeys - Change Windows SideShow-compatible device settings + Modifier les paramètres des appareils compatibles avec Windows SideShow Adjust commonly used mobility settings @@ -2341,7 +2341,7 @@ Change text-to-speech settings - Set the time and date + Définir l'heure et la date Change location settings @@ -2350,16 +2350,16 @@ Change mouse settings - Manage Storage Spaces + Gérer les espaces de stockage Show or hide file extensions - Allow an app through Windows Firewall + Autoriser une application via le pare-feu Windows - Change system sounds + Modifier les sons du système Adjust ClearType text @@ -2368,25 +2368,25 @@ Turn screen saver on or off - Find and fix windows update problems + Rechercher et résoudre les problèmes de mise à jour de Windows Change Bluetooth settings - Connect to a network + Se connecter à un réseau - Change the search provider in Internet Explorer + Changer le moteur de recherche dans Internet Explorer Join a domain - Add a device + Ajouter un appareil - Find and fix problems with Windows Search + Rechercher et résoudre les problèmes avec Windows Search Choose a power plan @@ -2395,7 +2395,7 @@ Change how the mouse pointer looks when it’s moving - Uninstall a program + Désinstaller un programme Create and format hard disk partitions @@ -2407,7 +2407,7 @@ Change PC wake-up settings - Manage network passwords + Gérer les mots de passe réseau Change input methods @@ -2419,10 +2419,10 @@ Change battery settings - Rename this computer + Renommer cet ordinateur - Lock or unlock the taskbar + Verrouiller ou déverrouiller la barre des tâches Manage Web Credentials @@ -2431,16 +2431,16 @@ Change the time zone - Start speech recognition + Démarrer la reconnaissance vocale - View installed updates + Afficher les mises à jour installées - What's happened to the Quick Launch toolbar? + Qu'est-il arrivé à la barre d'outils de lancement rapide ? - Change search options for files and folders + Modifier les options de recherche pour les fichiers et les dossiers Adjust settings before giving a presentation @@ -2470,7 +2470,7 @@ Gérer les certificats utilisateur - Schedule tasks + Planifier des tâches Ignore repeated keystrokes using FilterKeys @@ -2485,7 +2485,7 @@ Delete browsing history - Change what the power buttons do + Changer ce que font les boutons d'alimentation Create standard user account @@ -2494,7 +2494,7 @@ Take speech tutorials - View system resource usage in Task Manager + Afficher l'utilisation des ressources du système dans le gestionnaire des tâches Créer un compte diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.nl-NL.resx b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.nl-NL.resx index e5ff84248..c28489cc8 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.nl-NL.resx +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.nl-NL.resx @@ -456,7 +456,7 @@ Area Personalization - Command + Opdracht The command to direct start a setting diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.pt-PT.resx b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.pt-PT.resx index b243dafd8..45dc2c8cc 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.pt-PT.resx +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.pt-PT.resx @@ -2443,7 +2443,7 @@ Change search options for files and folders - Adjust settings before giving a presentation + Ajustar definições antes de uma apresentação Digitalizar um documento ou imagem @@ -2467,10 +2467,10 @@ Calibrate the screen for pen or touch input - Manage user certificates + Gerir certificados do utilizador - Schedule tasks + Agendar tarefas Ignore repeated keystrokes using FilterKeys diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.zh-cn.resx b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.zh-cn.resx index 16cd7a3f0..2b39d48e4 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.zh-cn.resx +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/Properties/Resources.zh-cn.resx @@ -1926,13 +1926,13 @@ 微软拼音 SimpleFast 选项 - Change what closing the lid does + 更改盖上盖子时的操作 - Turn off unnecessary animations + 关闭不必要的动画效果 - Create a restore point + 创建还原点 Turn off automatic window arrangement @@ -2007,7 +2007,7 @@ Set up ODBC data sources (64-bit) - Configure proxy server + 设置代理服务器 Change your homepage @@ -2242,7 +2242,7 @@ Allow Remote Assistance invitations to be sent from this computer - Task Manager + 任务管理器 Turn flicks on or off @@ -2356,7 +2356,7 @@ 是否显示文件扩展名 - Allow an app through Windows Firewall + 允许应用程序通过 Windows 防火墙 更改系统声音 diff --git a/Plugins/Flow.Launcher.Plugin.WindowsSettings/plugin.json b/Plugins/Flow.Launcher.Plugin.WindowsSettings/plugin.json index 5e82a43c0..dc8bfa22c 100644 --- a/Plugins/Flow.Launcher.Plugin.WindowsSettings/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.WindowsSettings/plugin.json @@ -4,7 +4,7 @@ "Description": "Search settings inside Control Panel and Settings App", "Name": "Windows Settings", "Author": "TobiasSekan", - "Version": "4.0.6", + "Version": "4.0.7", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.WindowsSettings.dll", diff --git a/appveyor.yml b/appveyor.yml index b84230c43..e0f3fc104 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: '1.17.2.{build}' +version: '1.18.0.{build}' init: - ps: |