diff --git a/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs b/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs new file mode 100644 index 000000000..c0cd022ea --- /dev/null +++ b/Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs @@ -0,0 +1,57 @@ +using Flow.Launcher.Infrastructure.Http; +using Flow.Launcher.Infrastructure.Logger; +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; + +namespace Flow.Launcher.Core.ExternalPlugins +{ + public static class PluginsManifest + { + static PluginsManifest() + { + UpdateTask = UpdateManifestAsync(); + } + + public static List UserPlugins { get; private set; } = new List(); + + public static Task UpdateTask { get; private set; } + + private static readonly SemaphoreSlim manifestUpdateLock = new(1); + + public static Task UpdateManifestAsync() + { + if (manifestUpdateLock.CurrentCount == 0) + { + return UpdateTask; + } + + return UpdateTask = DownloadManifestAsync(); + } + + private async static Task DownloadManifestAsync() + { + try + { + await manifestUpdateLock.WaitAsync().ConfigureAwait(false); + + await using var jsonStream = await Http.GetStreamAsync("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json") + .ConfigureAwait(false); + + UserPlugins = await JsonSerializer.DeserializeAsync>(jsonStream).ConfigureAwait(false); + } + catch (Exception e) + { + Log.Exception("|PluginManagement.GetManifest|Encountered error trying to download plugins manifest", e); + + UserPlugins = new List(); + } + finally + { + manifestUpdateLock.Release(); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Models/UserPlugin.cs b/Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs similarity index 77% rename from Plugins/Flow.Launcher.Plugin.PluginsManager/Models/UserPlugin.cs rename to Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs index c1af3014b..f98815c1a 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Models/UserPlugin.cs +++ b/Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs @@ -1,7 +1,6 @@ - -namespace Flow.Launcher.Plugin.PluginsManager.Models +namespace Flow.Launcher.Core.ExternalPlugins { - public class UserPlugin + public record UserPlugin { public string ID { get; set; } public string Name { get; set; } @@ -12,5 +11,6 @@ namespace Flow.Launcher.Plugin.PluginsManager.Models public string Website { get; set; } public string UrlDownload { get; set; } public string UrlSourceCode { get; set; } + public string IcoPath { get; set; } } } diff --git a/Flow.Launcher.Core/Plugin/QueryBuilder.cs b/Flow.Launcher.Core/Plugin/QueryBuilder.cs index df336e14b..ef387b693 100644 --- a/Flow.Launcher.Core/Plugin/QueryBuilder.cs +++ b/Flow.Launcher.Core/Plugin/QueryBuilder.cs @@ -10,35 +10,31 @@ namespace Flow.Launcher.Core.Plugin public static Query Build(string text, Dictionary nonGlobalPlugins) { // replace multiple white spaces with one white space - var terms = text.Split(new[] { Query.TermSeperater }, StringSplitOptions.RemoveEmptyEntries); + var terms = text.Split(Query.TermSeparator, StringSplitOptions.RemoveEmptyEntries); if (terms.Length == 0) { // nothing was typed return null; } - var rawQuery = string.Join(Query.TermSeperater, terms); + var rawQuery = string.Join(Query.TermSeparator, terms); string actionKeyword, search; string possibleActionKeyword = terms[0]; - List actionParameters; + string[] searchTerms; + if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPair) && !pluginPair.Metadata.Disabled) { // use non global plugin for query actionKeyword = possibleActionKeyword; - actionParameters = terms.Skip(1).ToList(); - search = actionParameters.Count > 0 ? rawQuery.Substring(actionKeyword.Length + 1) : string.Empty; + search = terms.Length > 1 ? rawQuery[(actionKeyword.Length + 1)..] : string.Empty; + searchTerms = terms[1..]; } else { // non action keyword actionKeyword = string.Empty; search = rawQuery; + searchTerms = terms; } - var query = new Query - { - Terms = terms, - RawQuery = rawQuery, - ActionKeyword = actionKeyword, - Search = search - }; + var query = new Query(rawQuery, search,terms, searchTerms, actionKeyword); return query; } diff --git a/Flow.Launcher.Core/Resource/Internationalization.cs b/Flow.Launcher.Core/Resource/Internationalization.cs index 64b949cbb..78e8c5cbf 100644 --- a/Flow.Launcher.Core/Resource/Internationalization.cs +++ b/Flow.Launcher.Core/Resource/Internationalization.cs @@ -9,6 +9,7 @@ using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; +using System.Globalization; namespace Flow.Launcher.Core.Resource { @@ -96,7 +97,8 @@ namespace Flow.Launcher.Core.Resource } UpdatePluginMetadataTranslations(); Settings.Language = language.LanguageCode; - + CultureInfo.CurrentCulture = new CultureInfo(language.LanguageCode); + CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture; } public bool PromptShouldUsePinyin(string languageCodeToSet) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 4648aef63..6561419a1 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -189,22 +189,11 @@ namespace Flow.Launcher.Core.Resource new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); } - + /* Ignore Theme Window Width and use setting */ var windowStyle = dict["WindowStyle"] as Style; - - var width = windowStyle?.Setters.OfType().Where(x => x.Property.Name == "Width") - .Select(x => x.Value).FirstOrDefault(); - - if (width == null) - { - windowStyle = dict["BaseWindowStyle"] as Style; - - width = windowStyle?.Setters.OfType().Where(x => x.Property.Name == "Width") - .Select(x => x.Value).FirstOrDefault(); - } - + var width = Settings.WindowSize; + windowStyle.Setters.Add(new Setter(Window.WidthProperty, width)); mainWindowWidth = (double)width; - return dict; } @@ -375,8 +364,6 @@ namespace Flow.Launcher.Core.Resource { var windowHelper = new WindowInteropHelper(w); - // this determines the width of the main query window - w.Width = mainWindowWidth; windowHelper.EnsureHandle(); var accent = new AccentPolicy { AccentState = state }; diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 76713ce2a..e09c6380c 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -16,6 +16,7 @@ using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using System.Text.Json.Serialization; +using System.Threading; namespace Flow.Launcher.Core { @@ -28,21 +29,21 @@ namespace Flow.Launcher.Core GitHubRepository = gitHubRepository; } - public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true) + private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1); + + public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true) { + await UpdateLock.WaitAsync(); try { - UpdateInfo newUpdateInfo; - if (!silentUpdate) api.ShowMsg(api.GetTranslation("pleaseWait"), - api.GetTranslation("update_flowlauncher_update_check")); + api.GetTranslation("update_flowlauncher_update_check")); using var updateManager = await GitHubUpdateManager(GitHubRepository).ConfigureAwait(false); - // UpdateApp CheckForUpdate will return value only if the app is squirrel installed - newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false); + var newUpdateInfo = await updateManager.CheckForUpdate().NonNull().ConfigureAwait(false); var newReleaseVersion = Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString()); var currentVersion = Version.Parse(Constant.Version); @@ -58,7 +59,7 @@ namespace Flow.Launcher.Core if (!silentUpdate) api.ShowMsg(api.GetTranslation("update_flowlauncher_update_found"), - api.GetTranslation("update_flowlauncher_updating")); + api.GetTranslation("update_flowlauncher_updating")); await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply).ConfigureAwait(false); @@ -70,8 +71,8 @@ namespace Flow.Launcher.Core FilesFolders.CopyAll(DataLocation.PortableDataPath, targetDestination); if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination)) MessageBox.Show(string.Format(api.GetTranslation("update_flowlauncher_fail_moving_portable_user_profile_data"), - DataLocation.PortableDataPath, - targetDestination)); + DataLocation.PortableDataPath, + targetDestination)); } else { @@ -87,12 +88,15 @@ namespace Flow.Launcher.Core UpdateManager.RestartApp(Constant.ApplicationFileName); } } - catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException || e.InnerException is TimeoutException) + catch (Exception e) when (e is HttpRequestException or WebException or SocketException || e.InnerException is TimeoutException) { Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e); api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"), - api.GetTranslation("update_flowlauncher_check_connection")); - return; + api.GetTranslation("update_flowlauncher_check_connection")); + } + finally + { + UpdateLock.Release(); } } @@ -115,13 +119,16 @@ namespace Flow.Launcher.Core var uri = new Uri(repository); var api = $"https://api.github.com/repos{uri.AbsolutePath}/releases"; - var jsonStream = await Http.GetStreamAsync(api).ConfigureAwait(false); + await using var jsonStream = await Http.GetStreamAsync(api).ConfigureAwait(false); var releases = await System.Text.Json.JsonSerializer.DeserializeAsync>(jsonStream).ConfigureAwait(false); var latest = releases.Where(r => !r.Prerelease).OrderByDescending(r => r.PublishedAt).First(); var latestUrl = latest.HtmlUrl.Replace("/tag/", "/download/"); - - var client = new WebClient { Proxy = Http.WebProxy }; + + var client = new WebClient + { + Proxy = Http.WebProxy + }; var downloader = new FileDownloader(client); var manager = new UpdateManager(latestUrl, urlDownloader: downloader); diff --git a/Flow.Launcher.Infrastructure/Constant.cs b/Flow.Launcher.Infrastructure/Constant.cs index a5b89c300..564e03638 100644 --- a/Flow.Launcher.Infrastructure/Constant.cs +++ b/Flow.Launcher.Infrastructure/Constant.cs @@ -33,7 +33,7 @@ namespace Flow.Launcher.Infrastructure public static readonly string QueryTextBoxIconImagePath = $"{ProgramDirectory}\\Images\\mainsearch.svg"; - public const string DefaultTheme = "Darker"; + public const string DefaultTheme = "Win11Light"; public const string Themes = "Themes"; diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj index ef76fd617..e01bc1efd 100644 --- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj +++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj @@ -50,10 +50,15 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/Flow.Launcher.Infrastructure/UserSettings/CustomExplorerViewModel.cs b/Flow.Launcher.Infrastructure/UserSettings/CustomExplorerViewModel.cs new file mode 100644 index 000000000..7806debe1 --- /dev/null +++ b/Flow.Launcher.Infrastructure/UserSettings/CustomExplorerViewModel.cs @@ -0,0 +1,30 @@ +using Flow.Launcher.Plugin; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Flow.Launcher.ViewModel +{ + public class CustomExplorerViewModel : BaseModel + { + public string Name { get; set; } + public string Path { get; set; } + public string FileArgument { get; set; } = "\"%d\""; + public string DirectoryArgument { get; set; } = "\"%d\""; + public bool Editable { get; init; } = true; + + public CustomExplorerViewModel Copy() + { + return new CustomExplorerViewModel + { + Name = Name, + Path = Path, + FileArgument = FileArgument, + DirectoryArgument = DirectoryArgument, + Editable = Editable + }; + } + } +} diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 907314ba8..34e86a3ed 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -1,22 +1,27 @@ using System; +using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; using System.Text.Json.Serialization; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; +using Flow.Launcher; +using Flow.Launcher.ViewModel; namespace Flow.Launcher.Infrastructure.UserSettings { public class Settings : BaseModel { private string language = "en"; - public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public bool ShowOpenResultHotkey { get; set; } = true; + public double WindowSize { get; set; } = 580; + public string Language { - get => language; set + get => language; + set { language = value; OnPropertyChanged(); @@ -34,6 +39,49 @@ namespace Flow.Launcher.Infrastructure.UserSettings public string ResultFontStretch { get; set; } public bool UseGlyphIcons { get; set; } = true; + public int CustomExplorerIndex { get; set; } = 0; + + [JsonIgnore] + public CustomExplorerViewModel CustomExplorer + { + get => CustomExplorerList[CustomExplorerIndex < CustomExplorerList.Count ? CustomExplorerIndex : 0]; + set => CustomExplorerList[CustomExplorerIndex] = value; + } + + public List CustomExplorerList { get; set; } = new() + { + new() + { + Name = "Explorer", + Path = "explorer", + DirectoryArgument = "\"%d\"", + FileArgument = "/select, \"%f\"", + Editable = false + }, + new() + { + Name = "Total Commander", + Path = @"C:\Program Files\totalcmd\TOTALCMD64.exe", + DirectoryArgument = "/O /A /S /T \"%d\"", + FileArgument = "/O /A /S /T \"%f\"" + }, + new() + { + Name = "Directory Opus", + Path = @"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe", + DirectoryArgument = "/cmd Go \"%d\" NEW", + FileArgument = "/cmd Go \"%f\" NEW" + + }, + new() + { + Name = "Files", + Path = "Files", + DirectoryArgument = "-select \"%d\"", + FileArgument = "-select \"%f\"" + } + }; + /// /// when false Alphabet static service will always return empty results @@ -52,7 +100,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings try { var precisionScore = (SearchPrecisionScore)Enum - .Parse(typeof(SearchPrecisionScore), value); + .Parse(typeof(SearchPrecisionScore), value); QuerySearchPrecision = precisionScore; StringMatcher.Instance.UserSettingSearchPrecision = precisionScore; @@ -99,8 +147,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool RememberLastLaunchLocation { get; set; } public bool IgnoreHotkeysOnFullscreen { get; set; } - public bool AutoHideScrollBar { get; set; } - public HttpProxy Proxy { get; set; } = new HttpProxy(); [JsonConverter(typeof(JsonStringEnumConverter))] diff --git a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj index 67c76d006..c808052b0 100644 --- a/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj +++ b/Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj @@ -60,8 +60,13 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index 7d4741630..a5602ac13 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -67,6 +67,11 @@ namespace Flow.Launcher.Plugin /// Optional message subtitle void ShowMsgError(string title, string subTitle = ""); + /// + /// Show the MainWindow when hiding + /// + void ShowMainWindow(); + /// /// Show message box /// @@ -193,5 +198,12 @@ namespace Flow.Launcher.Plugin /// Type for Serialization /// void SaveSettingJsonStorage() where T : new(); + + /// + /// Open directory in an explorer configured by user via Flow's Settings. The default is Windows Explorer + /// + /// Directory Path to open + /// Extra FileName Info + public void OpenDirectory(string DirectoryPath, string FileName = null); } } diff --git a/Flow.Launcher.Plugin/Query.cs b/Flow.Launcher.Plugin/Query.cs index 1eb5c9c14..3fcf3c1d7 100644 --- a/Flow.Launcher.Plugin/Query.cs +++ b/Flow.Launcher.Plugin/Query.cs @@ -1,4 +1,5 @@ -using System; +using JetBrains.Annotations; +using System; using System.Collections.Generic; using System.Linq; @@ -11,11 +12,12 @@ namespace Flow.Launcher.Plugin /// /// to allow unit tests for plug ins /// - public Query(string rawQuery, string search, string[] terms, string actionKeyword = "") + public Query(string rawQuery, string search, string[] terms, string[] searchTerms, string actionKeyword = "") { Search = search; RawQuery = rawQuery; Terms = terms; + SearchTerms = searchTerms; ActionKeyword = actionKeyword; } @@ -23,7 +25,7 @@ namespace Flow.Launcher.Plugin /// Raw query, this includes action keyword if it has /// We didn't recommend use this property directly. You should always use Search property. /// - public string RawQuery { get; internal set; } + public string RawQuery { get; internal init; } /// /// Search part of a query. @@ -31,45 +33,53 @@ namespace Flow.Launcher.Plugin /// Since we allow user to switch a exclusive plugin to generic plugin, /// so this property will always give you the "real" query part of the query /// - public string Search { get; internal set; } + public string Search { get; internal init; } /// - /// The raw query splited into a string array. + /// The search string split into a string array. /// - public string[] Terms { get; set; } + public string[] SearchTerms { get; init; } + + /// + /// The raw query split into a string array + /// + [Obsolete("It may or may not include action keyword, which can be confusing. Use SearchTerms instead")] + public string[] Terms { get; init; } /// /// Query can be splited into multiple terms by whitespace /// - public const string TermSeperater = " "; + public const string TermSeparator = " "; + + [Obsolete("Typo")] + public const string TermSeperater = TermSeparator; /// /// User can set multiple action keywords seperated by ';' /// - public const string ActionKeywordSeperater = ";"; + public const string ActionKeywordSeparator = ";"; + + [Obsolete("Typo")] + public const string ActionKeywordSeperater = ActionKeywordSeparator; + /// /// '*' is used for System Plugin /// public const string GlobalPluginWildcardSign = "*"; - public string ActionKeyword { get; set; } + public string ActionKeyword { get; init; } /// /// Return first search split by space if it has /// public string FirstSearch => SplitSearch(0); + private string _secondToEndSearch; + /// /// strings from second search (including) to last search /// - public string SecondToEndSearch - { - get - { - var index = string.IsNullOrEmpty(ActionKeyword) ? 1 : 2; - return string.Join(TermSeperater, Terms.Skip(index).ToArray()); - } - } + public string SecondToEndSearch => SearchTerms.Length > 1 ? (_secondToEndSearch ??= string.Join(' ', SearchTerms[1..])) : ""; /// /// Return second search split by space if it has @@ -83,16 +93,9 @@ namespace Flow.Launcher.Plugin private string SplitSearch(int index) { - try - { - return string.IsNullOrEmpty(ActionKeyword) ? Terms[index] : Terms[index + 1]; - } - catch (IndexOutOfRangeException) - { - return string.Empty; - } + return index < SearchTerms.Length ? SearchTerms[index] : string.Empty; } public override string ToString() => RawQuery; } -} +} \ No newline at end of file diff --git a/Flow.Launcher/ActionKeywords.xaml b/Flow.Launcher/ActionKeywords.xaml index 9d032efd9..32892768d 100644 --- a/Flow.Launcher/ActionKeywords.xaml +++ b/Flow.Launcher/ActionKeywords.xaml @@ -1,13 +1,54 @@ + Height="365" Width="450" Background="#F3F3F3" BorderBrush="#cecece"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs index 4a2368347..e116e6f4d 100644 --- a/Flow.Launcher/ActionKeywords.xaml.cs +++ b/Flow.Launcher/ActionKeywords.xaml.cs @@ -30,7 +30,7 @@ namespace Flow.Launcher private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e) { - tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, plugin.Metadata.ActionKeywords.ToArray()); + tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeparator, plugin.Metadata.ActionKeywords.ToArray()); tbAction.Focus(); } @@ -44,7 +44,7 @@ namespace Flow.Launcher var oldActionKeyword = plugin.Metadata.ActionKeywords[0]; var newActionKeyword = tbAction.Text.Trim(); newActionKeyword = newActionKeyword.Length > 0 ? newActionKeyword : "*"; - if (!pluginViewModel.IsActionKeywordRegistered(newActionKeyword)) + if (!PluginViewModel.IsActionKeywordRegistered(newActionKeyword)) { pluginViewModel.ChangeActionKeyword(newActionKeyword, oldActionKeyword); Close(); diff --git a/Flow.Launcher/App.xaml b/Flow.Launcher/App.xaml index 18addac73..c5214d7ab 100644 --- a/Flow.Launcher/App.xaml +++ b/Flow.Launcher/App.xaml @@ -9,7 +9,8 @@ - + + diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index c2a32100d..8c869e941 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -129,12 +129,12 @@ namespace Flow.Launcher var timer = new Timer(1000 * 60 * 60 * 5); timer.Elapsed += async (s, e) => { - await _updater.UpdateApp(API); + await _updater.UpdateAppAsync(API); }; timer.Start(); // check updates on startup - await _updater.UpdateApp(API); + await _updater.UpdateAppAsync(API); } }); } diff --git a/Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs b/Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs index 7de5af79a..e82fa959c 100644 --- a/Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs +++ b/Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs @@ -16,12 +16,10 @@ namespace Flow.Launcher.Converters public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var hotkeyNumber = int.MaxValue; - - if (value is ListBoxItem listBoxItem) - { - ListBox listBox = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox; + + if (value is ListBoxItem listBoxItem + && ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox) hotkeyNumber = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1; - } return hotkeyNumber <= MaxVisibleHotkeys ? Visibility.Visible : Visibility.Collapsed; } diff --git a/Flow.Launcher/Converters/OrdinalConverter.cs b/Flow.Launcher/Converters/OrdinalConverter.cs index 970ed183c..f9fa220e3 100644 --- a/Flow.Launcher/Converters/OrdinalConverter.cs +++ b/Flow.Launcher/Converters/OrdinalConverter.cs @@ -8,11 +8,9 @@ namespace Flow.Launcher.Converters { public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) { - if (value is ListBoxItem listBoxItem) - { - ListBox listBox = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox; + if (value is ListBoxItem listBoxItem + && ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox) return listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1; - } return 0; } diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml b/Flow.Launcher/CustomQueryHotkeySetting.xaml index a97f90733..23bd89906 100644 --- a/Flow.Launcher/CustomQueryHotkeySetting.xaml +++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml @@ -5,7 +5,8 @@ Icon="Images\app.png" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" - Title="{DynamicResource customeQueryHotkeyTitle}" Height="200" Width="674.766"> + MouseDown="window_MouseDown" + Title="{DynamicResource customeQueryHotkeyTitle}" Height="345" Width="500" Background="#F3F3F3" BorderBrush="#cecece"> @@ -15,29 +16,42 @@ - - + - - - - - - + + + + + + + + + - - - - diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs index b18bbcfad..0109474e1 100644 --- a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs +++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs @@ -7,6 +7,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Windows; using System.Windows.Input; +using System.Windows.Controls; namespace Flow.Launcher { @@ -99,5 +100,15 @@ namespace Flow.Launcher { Close(); } + + private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */ + { + TextBox textBox = Keyboard.FocusedElement as TextBox; + if (textBox != null) + { + TraversalRequest tRequest = new TraversalRequest(FocusNavigationDirection.Next); + textBox.MoveFocus(tRequest); + } + } } } diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index edf41e193..fd2f5f1d9 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -83,6 +83,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index 4d871b345..fe25ecf18 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -6,6 +6,8 @@ using NHotkey.Wpf; using Flow.Launcher.Core.Resource; using System.Windows; using Flow.Launcher.ViewModel; +using System.Threading.Tasks; +using System.Threading; namespace Flow.Launcher.Helper { @@ -19,10 +21,15 @@ namespace Flow.Launcher.Helper mainViewModel = mainVM; settings = mainViewModel._settings; - SetHotkey(settings.Hotkey, OnHotkey); + SetHotkey(settings.Hotkey, OnToggleHotkey); LoadCustomPluginHotkey(); } + internal static void OnToggleHotkey(object sender, HotkeyEventArgs args) + { + mainViewModel.ToggleFlowLauncher(); + } + private static void SetHotkey(string hotkeyStr, EventHandler action) { var hotkey = new HotkeyModel(hotkeyStr); @@ -53,44 +60,6 @@ namespace Flow.Launcher.Helper } } - internal static void OnHotkey(object sender, HotkeyEventArgs e) - { - if (!ShouldIgnoreHotkeys()) - { - UpdateLastQUeryMode(); - - mainViewModel.ToggleFlowLauncher(); - e.Handled = true; - } - } - - /// - /// Checks if Flow Launcher should ignore any hotkeys - /// - private static bool ShouldIgnoreHotkeys() - { - return settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen(); - } - - private static void UpdateLastQUeryMode() - { - switch(settings.LastQueryMode) - { - case LastQueryMode.Empty: - mainViewModel.ChangeQueryText(string.Empty); - break; - case LastQueryMode.Preserved: - mainViewModel.LastQuerySelected = true; - break; - case LastQueryMode.Selected: - mainViewModel.LastQuerySelected = false; - break; - default: - throw new ArgumentException($"wrong LastQueryMode: <{settings.LastQueryMode}>"); - - } - } - internal static void LoadCustomPluginHotkey() { if (settings.CustomPluginHotkeys == null) @@ -106,7 +75,7 @@ namespace Flow.Launcher.Helper { SetHotkey(hotkey.Hotkey, (s, e) => { - if (ShouldIgnoreHotkeys()) + if (mainViewModel.ShouldIgnoreHotkeys()) return; mainViewModel.MainWindowVisibility = Visibility.Visible; diff --git a/Flow.Launcher/HotkeyControl.xaml b/Flow.Launcher/HotkeyControl.xaml index ab786fd56..285a282ef 100644 --- a/Flow.Launcher/HotkeyControl.xaml +++ b/Flow.Launcher/HotkeyControl.xaml @@ -9,11 +9,18 @@ d:DesignHeight="300" d:DesignWidth="300"> - - + - - + + + + press key + + + + + + \ No newline at end of file diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 4a9b92700..5ca6bdbfd 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -1,7 +1,8 @@ - - + + Failed to register hotkey: {0} Could not start {0} Invalid Flow Launcher plugin file format @@ -13,53 +14,66 @@ Settings About Exit + Close - + Flow Launcher Settings General Portable Mode + Store all settings and user data in one folder (Useful when used with removable drives or cloud services). Start Flow Launcher on system startup Hide Flow Launcher when focus is lost Do not show new version notifications Remember last launch location Language Last Query Style + Show/Hide previous results when Flow Launcher is reactivated. Preserve Last Query Select last Query Empty last Query Maximum results shown Ignore hotkeys in fullscreen mode + Disable Flow Launcher activation when a full screen application is active (Recommended for games). + Default File Manager + Select the file manager to use when opening the folder. Python Directory Auto Update - Auto Hide Scroll Bar - Automatically hides the Settings window scroll bar and show when hover the mouse over it Select Hide Flow Launcher on startup Hide tray icon Query Search Precision + Changes minimum match score required for results. Should Use Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese Shadow effect is not allowed while current theme has blur effect enabled - - Plugin + + Plugins Find more plugins - Enable - Disable - Action keyword: + On + Off + Action keyword Setting + Action keyword Current action keyword: New action keyword: Current Priority: New Priority: - Priority: + Priority Plugin Directory - Author + Author: Init time: Query time: - + + + Plugin Store + Refresh + Install + + Theme - Browse for more themes + Theme Gallery + How to create a theme Hi There Query Box Font Result Item Font @@ -67,12 +81,17 @@ Opacity Theme {0} not exists, fallback to default theme Fail to load theme {0}, fallback to default theme + Theme Folder + Open Theme Folder - + Hotkey Flow Launcher Hotkey - Open Result Modifiers + Enter shortcut to show/hide Flow Launcher. + Open Result Modifier Key + Select a modifier key to open selected result via keyboard. Show Hotkey + Show result selection hotkey with results. Custom Query Hotkey Query Delete @@ -82,10 +101,11 @@ Are you sure you want to delete {0} plugin hotkey? Query window shadow effect Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited. + Window Width Size Use Segoe Fluent Icons Use Segoe Fluent Icons for query results where supported - + HTTP Proxy Enable HTTP Proxy HTTP Server @@ -101,7 +121,7 @@ Proxy configured correctly Proxy connection failed - + About Website Version @@ -110,17 +130,28 @@ New version {0} is available, would you like to restart Flow Launcher to use the update? Check updates failed, please check your connection and proxy settings to api.github.com. - Download updates failed, please check your connection and proxy settings to github-cloud.s3.amazonaws.com, + Download updates failed, please check your connection and proxy settings to github-cloud.s3.amazonaws.com, or go to https://github.com/Flow-Launcher/Flow.Launcher/releases to download updates manually. Release Notes Usage Tips: - + + Select File Manager + Please specify the file location of the file manager you using and add arguments if necessary. The default arguments is "%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 + + + 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! - + Old Action Keyword New Action Keyword Cancel @@ -130,19 +161,20 @@ This new Action Keyword is already assigned to another plugin, please choose a different one Success Completed successfully - Use * if you don't want to specify an action keyword + Enter the action keyword you need to start the plug-in. Use * if you don't want to specify an action keyword. In the case, The plug-in works without keywords. - - Custom Plugin Hotkey + + Custom Query Hotkey + Press the custom hotkey to automatically insert the specified query. Preview Hotkey is unavailable, please select a new hotkey Invalid plugin hotkey Update - + Hotkey Unavailable - + Version Time Please tell us how application crashed so we can fix it @@ -158,16 +190,18 @@ Failed to send report Flow Launcher got an error - + Please wait... - + Checking for new update You already have the latest Flow Launcher version Update found Updating... - 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 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} + New Update New Flow Launcher release {0} is now available An error occurred while trying to install software updates @@ -180,4 +214,4 @@ Update files Update description - \ No newline at end of file + diff --git a/Flow.Launcher/Languages/ko.xaml b/Flow.Launcher/Languages/ko.xaml index 6c755dbae..649895cea 100644 --- a/Flow.Launcher/Languages/ko.xaml +++ b/Flow.Launcher/Languages/ko.xaml @@ -13,55 +13,90 @@ 설정 정보 종료 + 닫기 Flow Launcher 설정 일반 + 포터블 모드 + 모든 설정이 폴더안에 들어갑니다. USB 드라이브나 클라우드로 사용 가능합니다. 시스템 시작 시 Flow Launcher 실행 포커스 잃으면 Flow Launcher 숨김 새 버전 알림 끄기 마지막 실행 위치 기억 언어 마지막 쿼리 스타일 + 쿼리박스를 열었을 때 쿼리 처리 방식 직전 쿼리에 계속 입력 직전 쿼리 내용 선택 직전 쿼리 지우기 표시할 결과 수 전체화면 모드에서는 핫키 무시 + 게이머라면 켜는 것을 추천합니다. Python 디렉토리 자동 업데이트 선택 시작 시 Flow Launcher 숨김 + 트레이 아이콘 숨기기 + 쿼리 검색 정확도 + 검색 결과가 좀 더 정확해집니다. + 항상 Pinyin 사용 + Pinyin을 사용하여 검색할 수 있습니다. Pinyin(병음)은 로마자 중국어 입력 방식입니다. + 반투명 흐림 효과를 사용하는 경우, 그림자 효과를 쓸 수 없습니다. 플러그인 플러그인 더 찾아보기 - 비활성화 + On + Off 액션 키워드 + 현재 중요도: + 새 중요도: + 중요도 플러그인 디렉토리 저자 초기화 시간: 쿼리 시간: + + + + 플러그인 스토어 + 새로고침 + 설치 + 테마 테마 더 찾아보기 + Hi There 쿼리 상자 글꼴 결과 항목 글꼴 윈도우 모드 투명도 + {0} 테마가 존재하지 않습니다. 기본 테마로 변경합니다. + {0} 테마 로드에 실패했습니다. 기본 테마로 변경합니다. + 테마 폴더 + 테마 폴더 열기 핫키 Flow Launcher 핫키 - 결과 수정 자 열기 - 사용자지정 쿼리 핫키 + Flow Launcher를 열 때 사용할 단축키를 입력합니다. + 결과 선택 단축키 + 결과 목록을 선택하는 단축키입니다. 단축키 표시 + 결과창에서 결과 선택 단축키를 표시합니다. + 사용자지정 쿼리 핫키 + Query 삭제 편집 추가 항목을 선택하세요. {0} 플러그인 핫키를 삭제하시겠습니까? + 그림자 효과 + 그림자 효과는 GPU를 사용합니다. 컴퓨터 퍼포먼스가 제한적인 경우 사용을 추천하지 않습니다. + 플루언트 아이콘 사용 + 결과 및 일부 메뉴에서 플루언트 아이콘을 사용합니다. HTTP 프록시 @@ -86,8 +121,18 @@ Flow Launcher를 {0}번 실행했습니다. 업데이트 확인 새 버전({0})이 있습니다. Flow Launcher를 재시작하세요. + 업데이트 확인을 실패했습니다. api.github.com로의 연결 또는 프록시 설정을 확인해주세요. + + 업데이트 다운로드에 실패했습니다. github-cloud.s3.amazonaws.com의 연결 또는 프록시 설정을 확인해주세요. + 수동 다운로드를 하려면 https://github.com/Flow-Launcher/Flow.Launcher/releases 으로 방문하세요. + 릴리즈 노트: + 사용 팁: + + 중요도 변경 + 높은 수를 넣을수록 상위 결과에 표시됩니다. 5를 시도해보세요. 다른 플러그인 보다 결과를 낮추고 싶다면, 그보다 낮은 수를 입력하세요. + 중요도에 올바른 정수를 입력하세요. 예전 액션 키워드 새 액션 키워드 @@ -97,9 +142,11 @@ 새 액션 키워드를 입력하세요. 새 액션 키워드가 할당된 플러그인이 이미 있습니다. 다른 액션 키워드를 입력하세요. 성공 + 성공적으로 완료했습니다. 액션 키워드를 지정하지 않으려면 *를 사용하세요. + 커스텀 플러그인 핫키 미리보기 핫키를 사용할 수 없습니다. 다른 핫키를 입력하세요. 플러그인 핫키가 유효하지 않습니다. @@ -123,12 +170,23 @@ 보고서를 정상적으로 보냈습니다. 보고서를 보내지 못했습니다. Flow Launcher에 문제가 발생했습니다. - + + + 잠시 기다려주세요... + 새 업데이트 확인 중 새 Flow Launcher 버전({0})을 사용할 수 있습니다. + 이미 가장 최신 버전의 Flow Launcher를 사용중입니다. + 업데이트 발견 + 업데이트 중... + Flow Launcher가 유저 정보 데이터를 새버전으로 옮길 수 없습니다. + 프로필 데이터 폴더를 수동으로 {0} 에서 {1}로 옮겨주세요. + 새 업데이트 소프트웨어 업데이트를 설치하는 중에 오류가 발생했습니다. 업데이트 취소 + 업데이트 실패 + Check your connection and try updating proxy settings to github-cloud.s3.amazonaws.com. 업데이트를 위해 Flow Launcher를 재시작합니다. 아래 파일들이 업데이트됩니다. 업데이트 파일 diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index 5e63020a8..8c0a96f98 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -1,7 +1,8 @@ - - + Nepodarilo sa registrovať klávesovú skratku {0} Nepodarilo sa spustiť {0} Neplatný formát súboru pre plugin Flow Launchera @@ -13,53 +14,66 @@ Nastavenia O aplikácii Ukončiť + Zavrieť - + Nastavenia Flow Launchera Všeobecné Prenosný režim + Uloží všetky nastavenia a používateľské údaje do jedného priečinka (Užitočné pri vyberateľných diskoch a cloudových službách). Spustiť Flow Launcher po štarte systému Schovať Flow Launcher po strate fokusu Nezobrazovať upozornenia na novú verziu Zapamätať si posledné umiestnenie Jazyk Posledné vyhľadávanie + Zobrazí/skryje predchádzajúce výsledky pri opätovnej aktivácii Flow Launchera. Ponechať Označiť Vymazať Max. výsledkov Ignorovať klávesové skratky v režime na celú obrazovku + Zakázať aktiváciu Flow Launchera, keď je aktívna aplikácia na celú obrazovku (odporúčané pre hry). + Predvolený správca súborov + Vyberte správcu súborov, ktorý sa má použiť pri otváraní priečinka. Priečinok s Pythonom Automatická aktualizácia - Automaticky skryť posuvník - Automaticky skrývať posuvník v okne nastavení a zobraziť ho, keď naň prejdete myšou Vybrať Schovať Flow Launcher po spustení Schovať ikonu z oblasti oznámení Presnosť vyhľadávania + Mení minimálne skóre zhody potrebné na zobrazenie výsledkov. Použiť Pinyin Umožňuje vyhľadávanie pomocou Pinyin. Pinyin je štandardný systém romanizovaného pravopisu pre transliteráciu čínštiny Efekt tieňa nie je povolený, kým má aktuálny motív povolený efekt rozostrenia - - - Plugin + + + Pluginy Nájsť ďalšie pluginy - Povolené - Zakázané + Zap. + Vyp. + Nastavenie kľúčového slova akcie Skratka akcie Aktuálna akcia skratky: Nová akcia skratky: Aktuálna priorita: Nová priorita: - Priorita: + Priorita Priečinok s pluginmi - Autor + Autor: Príprava: Čas dopytu: + - + + Repozitár pluginov + Obnoviť + Inštalovať + + Motív - Prehliadať viac motívov + Galéria motívov + Ako vytvoriť motív Ahojte Písmo vyhľadávacieho poľa Písmo výsledkov @@ -67,12 +81,17 @@ Nepriehľadnosť Motív {0} neexistuje, návrat na predvolený motív Nepodarilo sa nečítať motív {0}, návrat na predvolený motív + Priečinok s motívmi + Otvoriť priečinok s motívmi - + Klávesové skratky Klávesová skratka pre Flow Launcher - Modifikáčné klávesy na otvorenie výsledkov + Zadajte skratku na zobrazenie/skrytie Flow Launchera. + 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 + Zobrazí klávesovú skratku spolu s výsledkami. Vlastná klávesová skratka na vyhľadávanie Dopyt Odstrániť @@ -82,13 +101,16 @@ Ste si istý, že chcete odstrániť klávesovú skratku {0} pre plugin? Tieňový efekt v poli vyhľadávania Tieňový efekt významne využíva GPU. Neodporúča sa, ak je výkon počítača obmedzený. + Veľkosť šírky okna + Použiť ikony Segoe Fluent + Použiť ikony Segoe Fluent, ak sú podporované - + HTTP Proxy Povoliť HTTP Proxy HTTP Server Port - Použív. meno + Používateľské meno Heslo Test Proxy Uložiť @@ -99,7 +121,7 @@ Nastavenie proxy je v poriadku Pripojenie proxy zlyhalo - + O aplikácii Webstránka Verzia @@ -108,17 +130,28 @@ Je dostupná nová verzia {0}, chcete reštartovať Flow Launcher, aby sa mohol aktualizovať? Kontrola aktualizácií zlyhala, prosím, skontrolujte pripojenie na internet a nastavenie proxy k api.github.com. - Sťahovanie aktualizácií zlyhalo, skontrolujte pripojenie na internet a nastavenie proxy k github-cloud.s3.amazonaws.com, + Sťahovanie aktualizácií zlyhalo, skontrolujte pripojenie na internet a nastavenie proxy k github-cloud.s3.amazonaws.com, alebo prejdite na https://github.com/Flow-Launcher/Flow.Launcher/releases pre manuálne stiahnutie aktualizácie. Poznámky k vydaniu Tipy na používanie: - + + Vyberte správcu súborov + Zadajte umiestnenie súboru správcu súborov, ktorého používate, a v prípade potreby pridajte argumenty. Predvolené argumenty sú "%d" a cesta sa zadáva na tomto mieste. Napríklad, ak sa vyžaduje príkaz, ako napríklad "totalcmd.exe /A c:\windows", argument je /A "%d". + "%f" je argument, ktorý predstavuje cestu k súboru. Používa sa na zvýraznenie názvu súboru/priečinka pri otváraní konkrétneho umiestnenia súboru v správcovi súborov tretej strany. Tento argument je k dispozícii len v položke "Arg pre súbor". Ak správca súborov nemá túto funkciu, môžete použiť "%d". + Správca súborov + Názov profilu + Cesta k správcovi súborov + Arg. pre priečinok + Arg. pre súbor + + + Zmena priority Vyššie číslo znamená, že výsledok bude vyššie. Skúste nastaviť napr. 5. Ak chcete, aby boli výsledky nižšie ako ktorékoľvek iné doplnky, zadajte záporné číslo Prosím, zadajte platné číslo pre prioritu! - + Stará skratka akcie Nová skratka akcie Zrušiť @@ -128,19 +161,20 @@ Nová skratka pre akciu bola priradená pre iný plugin, prosím, zvoľte inú skratku Úspešné Úspešne dokončené - Použite * ak nechcete určiť skratku pre akciu + Zadajte skratku akcie, ktorá je potrebná na spustenie pluginu. Ak nechcete zadať skratku akcie, použite *. V tom prípade plugin funguje bez kľúčových slov. - - Vlastná klávesová skratka pre plugin + + Klávesová skratka pre vlastné vyhľadávanie + Stlačením klávesovej skratky sa automaticky vloží zadaný výraz. Náhľad Klávesová skratka je nedostupná, prosím, zadajte novú Neplatná klávesová skratka pluginu Aktualizovať - + Klávesová skratka nedostupná - + Verzia Čas Prosím, napíšte nám, ako došlo k pádu aplikácie, aby sme to mohli opraviť @@ -156,16 +190,18 @@ Odoslanie hlásenia zlyhalo Flow Launcher zaznamenal chybu - + Čakajte, prosím… - - Kontrolujú sa akutalizácie - Už máte najnovšiu verizu Flow Launchera + + Kontrolujú sa aktualizácie + Už máte najnovšiu verziu Flow Launchera Bola nájdená aktualizácia Aktualizuje sa… - Flow Launcher nedokázal presunúť používateľské údaje do aktualizovanej verzie. - Prosím, presuňte profilový priečinok data z {0} do {1} + + Flow Launcher nedokázal presunúť používateľské údaje do aktualizovanej verzie. + Prosím, presuňte profilový priečinok data z {0} do {1} + Nová aktualizácia Je dostupná nová verzia Flow Launchera {0} Počas inštalácie aktualizácií došlo k chybe @@ -178,4 +214,4 @@ Aktualizovať súbory Aktualizovať popis - \ No newline at end of file + diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 73b13be8c..daea406db 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -26,6 +26,8 @@ LocationChanged="OnLocationChanged" Deactivated="OnDeactivated" PreviewKeyDown="OnKeyDown" + MinWidth="{Binding MainWindowWidth, Mode=OneWay}" + MaxWidth="{Binding MainWindowWidth, Mode=OneWay}" Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" d:DataContext="{d:DesignInstance vm:MainViewModel}"> @@ -92,7 +94,7 @@ - + @@ -102,7 +104,25 @@ - + + + + + + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index e84a3148e..16e4be8a0 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -11,6 +11,7 @@ using Flow.Launcher.Core.Resource; using Flow.Launcher.Helper; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.ViewModel; +using Microsoft.AspNetCore.Authorization; using Application = System.Windows.Application; using Screen = System.Windows.Forms.Screen; using ContextMenuStrip = System.Windows.Forms.ContextMenuStrip; @@ -19,6 +20,7 @@ using DragEventArgs = System.Windows.DragEventArgs; using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MessageBox = System.Windows.MessageBox; using NotifyIcon = System.Windows.Forms.NotifyIcon; +using System.Windows.Interop; namespace Flow.Launcher { @@ -30,6 +32,7 @@ namespace Flow.Launcher private bool isProgressBarStoryboardPaused; private Settings _settings; private NotifyIcon _notifyIcon; + private ContextMenu contextMenu; private MainViewModel _viewModel; #endregion @@ -53,7 +56,7 @@ namespace Flow.Launcher _viewModel.Save(); e.Cancel = true; await PluginManager.DisposePluginsAsync(); - Application.Current.Shutdown(); + Environment.Exit(0); } private void OnInitialized(object sender, EventArgs e) @@ -159,14 +162,10 @@ namespace Flow.Launcher private void UpdateNotifyIconText() { - var menu = _notifyIcon.ContextMenuStrip; - var open = menu.Items[0]; - var setting = menu.Items[1]; - var exit = menu.Items[2]; - - open.Text = InternationalizationManager.Instance.GetTranslation("iconTrayOpen"); - setting.Text = InternationalizationManager.Instance.GetTranslation("iconTraySettings"); - exit.Text = InternationalizationManager.Instance.GetTranslation("iconTrayExit"); + var menu = contextMenu; + ((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen"); + ((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings"); + ((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit"); } private void InitializeNotifyIcon() @@ -177,30 +176,46 @@ namespace Flow.Launcher Icon = Properties.Resources.app, Visible = !_settings.HideNotifyIcon }; - var menu = new ContextMenuStrip(); - var items = menu.Items; + contextMenu = new ContextMenu(); + + var header = new MenuItem + { + Header = "Flow Launcher", + IsEnabled = false + }; + var open = new MenuItem + { + Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + }; + var settings = new MenuItem + { + Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings") + }; + var exit = new MenuItem + { + Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit") + }; - var open = items.Add(InternationalizationManager.Instance.GetTranslation("iconTrayOpen")); open.Click += (o, e) => Visibility = Visibility.Visible; - var setting = items.Add(InternationalizationManager.Instance.GetTranslation("iconTraySettings")); - setting.Click += (o, e) => App.API.OpenSettingDialog(); - var exit = items.Add(InternationalizationManager.Instance.GetTranslation("iconTrayExit")); + settings.Click += (o, e) => App.API.OpenSettingDialog(); exit.Click += (o, e) => Close(); + contextMenu.Items.Add(header); + contextMenu.Items.Add(open); + contextMenu.Items.Add(settings); + contextMenu.Items.Add(exit); - _notifyIcon.ContextMenuStrip = menu; + _notifyIcon.ContextMenuStrip = new ContextMenuStrip(); // it need for close the context menu. if not, context menu can't close. _notifyIcon.MouseClick += (o, e) => { - if (e.Button == MouseButtons.Left) + switch (e.Button) { - if (menu.Visible) - { - menu.Close(); - } - else - { - var p = System.Windows.Forms.Cursor.Position; - menu.Show(p); - } + case MouseButtons.Left: + _viewModel.ToggleFlowLauncher(); + break; + + case MouseButtons.Right: + contextMenu.IsOpen = true; + break; } }; } @@ -262,7 +277,7 @@ namespace Flow.Launcher { if (_settings.HideWhenDeactive) { - Hide(); + _viewModel.Hide(); } } diff --git a/Flow.Launcher/Notification.cs b/Flow.Launcher/Notification.cs new file mode 100644 index 000000000..d8f9fd45e --- /dev/null +++ b/Flow.Launcher/Notification.cs @@ -0,0 +1,42 @@ +using Flow.Launcher.Infrastructure; +using System; +using System.IO; +using Windows.Data.Xml.Dom; +using Windows.UI.Notifications; + +namespace Flow.Launcher +{ + internal static class Notification + { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "")] + public static void Show(string title, string subTitle, string iconPath) + { + var legacy = Environment.OSVersion.Version.Build < 19041; + // Handle notification for win7/8/early win10 + if (legacy) + { + LegacyShow(title, subTitle, iconPath); + return; + } + + // Using Windows Notification System + var Icon = !File.Exists(iconPath) + ? Path.Combine(Constant.ProgramDirectory, "Images\\app.png") + : iconPath; + + var xml = $"\"meziantou\"/{title}" + + $"{subTitle}"; + var toastXml = new XmlDocument(); + toastXml.LoadXml(xml); + var toast = new ToastNotification(toastXml); + ToastNotificationManager.CreateToastNotifier("Flow Launcher").Show(toast); + + } + + private static void LegacyShow(string title, string subTitle, string iconPath) + { + var msg = new Msg(); + msg.Show(title, subTitle, iconPath); + } + } +} \ No newline at end of file diff --git a/Flow.Launcher/PriorityChangeWindow.xaml b/Flow.Launcher/PriorityChangeWindow.xaml index 68b5a49b7..bbe601010 100644 --- a/Flow.Launcher/PriorityChangeWindow.xaml +++ b/Flow.Launcher/PriorityChangeWindow.xaml @@ -1,43 +1,88 @@ - - + + - - - + - - - - - - + + + + + + + + + - - - - - - - - - diff --git a/Flow.Launcher/PriorityChangeWindow.xaml.cs b/Flow.Launcher/PriorityChangeWindow.xaml.cs index 0adb1f080..fe846e78b 100644 --- a/Flow.Launcher/PriorityChangeWindow.xaml.cs +++ b/Flow.Launcher/PriorityChangeWindow.xaml.cs @@ -26,7 +26,6 @@ namespace Flow.Launcher private Settings settings; private readonly Internationalization translater = InternationalizationManager.Instance; private readonly PluginViewModel pluginViewModel; - public PriorityChangeWindow(string pluginId, Settings settings, PluginViewModel pluginViewModel) { InitializeComponent(); @@ -62,8 +61,17 @@ namespace Flow.Launcher private void PriorityChangeWindow_Loaded(object sender, RoutedEventArgs e) { - OldPriority.Text = pluginViewModel.Priority.ToString(); + tbAction.Text = pluginViewModel.Priority.ToString(); tbAction.Focus(); } + private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */ + { + TextBox textBox = Keyboard.FocusedElement as TextBox; + if (textBox != null) + { + TraversalRequest tRequest = new TraversalRequest(FocusNavigationDirection.Next); + textBox.MoveFocus(tRequest); + } + } } } \ No newline at end of file diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 6ca14c215..1d0136c6f 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -23,6 +23,8 @@ using System.Runtime.CompilerServices; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.Storage; using System.Collections.Concurrent; +using Flow.Launcher.Plugin.SharedCommands; +using System.Diagnostics; namespace Flow.Launcher { @@ -69,6 +71,8 @@ namespace Flow.Launcher public void RestarApp() => RestartApp(); + public void ShowMainWindow() => _mainVM.MainWindowVisibility = Visibility.Visible; + public void CheckForNewUpdate() => _settingsVM.UpdateApp(); public void SaveAppAllSettings() @@ -91,8 +95,7 @@ namespace Flow.Launcher { Application.Current.Dispatcher.Invoke(() => { - var msg = useMainWindowAsOwner ? new Msg {Owner = Application.Current.MainWindow} : new Msg(); - msg.Show(title, subTitle, iconPath); + Notification.Show(title, subTitle, iconPath); }); } @@ -163,7 +166,7 @@ namespace Flow.Launcher if (!_pluginJsonStorages.ContainsKey(type)) _pluginJsonStorages[type] = new PluginJsonStorage(); - return ((PluginJsonStorage) _pluginJsonStorages[type]).Load(); + return ((PluginJsonStorage)_pluginJsonStorages[type]).Load(); } public void SaveSettingJsonStorage() where T : new() @@ -172,7 +175,7 @@ namespace Flow.Launcher if (!_pluginJsonStorages.ContainsKey(type)) _pluginJsonStorages[type] = new PluginJsonStorage(); - ((PluginJsonStorage) _pluginJsonStorages[type]).Save(); + ((PluginJsonStorage)_pluginJsonStorages[type]).Save(); } public void SaveJsonStorage(T settings) where T : new() @@ -180,7 +183,22 @@ namespace Flow.Launcher var type = typeof(T); _pluginJsonStorages[type] = new PluginJsonStorage(settings); - ((PluginJsonStorage) _pluginJsonStorages[type]).Save(); + ((PluginJsonStorage)_pluginJsonStorages[type]).Save(); + } + + public void OpenDirectory(string DirectoryPath, string FileName = null) + { + using Process explorer = new Process(); + var explorerInfo = _settingsVM.Settings.CustomExplorer; + explorer.StartInfo = new ProcessStartInfo + { + FileName = explorerInfo.Path, + Arguments = FileName is null ? + explorerInfo.DirectoryArgument.Replace("%d", DirectoryPath) : + explorerInfo.FileArgument.Replace("%d", DirectoryPath).Replace("%f", + Path.IsPathRooted(FileName) ? FileName : Path.Combine(DirectoryPath, FileName)) + }; + explorer.Start(); } public event FlowLauncherGlobalKeyboardEventHandler GlobalKeyboardEvent; @@ -193,7 +211,7 @@ namespace Flow.Launcher { if (GlobalKeyboardEvent != null) { - return GlobalKeyboardEvent((int) keyevent, vkcode, state); + return GlobalKeyboardEvent((int)keyevent, vkcode, state); } return true; diff --git a/Flow.Launcher/Resources/CustomControlTemplate.xaml b/Flow.Launcher/Resources/CustomControlTemplate.xaml new file mode 100644 index 000000000..877a97645 --- /dev/null +++ b/Flow.Launcher/Resources/CustomControlTemplate.xaml @@ -0,0 +1,2569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Flow.Launcher/SelectFileManagerWindow.xaml.cs b/Flow.Launcher/SelectFileManagerWindow.xaml.cs new file mode 100644 index 000000000..4f6fb3439 --- /dev/null +++ b/Flow.Launcher/SelectFileManagerWindow.xaml.cs @@ -0,0 +1,88 @@ +using Flow.Launcher.Infrastructure.UserSettings; +using Flow.Launcher.ViewModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace Flow.Launcher +{ + public partial class SelectFileManagerWindow : Window, INotifyPropertyChanged + { + private int selectedCustomExplorerIndex; + + public event PropertyChangedEventHandler PropertyChanged; + + public Settings Settings { get; } + + public int SelectedCustomExplorerIndex + { + get => selectedCustomExplorerIndex; set + { + selectedCustomExplorerIndex = value; + PropertyChanged?.Invoke(this, new(nameof(CustomExplorer))); + } + } + public ObservableCollection CustomExplorers { get; set; } + + public CustomExplorerViewModel CustomExplorer => CustomExplorers[SelectedCustomExplorerIndex]; + public SelectFileManagerWindow(Settings settings) + { + Settings = settings; + CustomExplorers = new ObservableCollection(Settings.CustomExplorerList.Select(x => x.Copy())); + SelectedCustomExplorerIndex = Settings.CustomExplorerIndex; + InitializeComponent(); + } + + private void btnCancel_Click(object sender, RoutedEventArgs e) + { + Close(); + } + + private void btnDone_Click(object sender, RoutedEventArgs e) + { + Settings.CustomExplorerList = CustomExplorers.ToList(); + Settings.CustomExplorerIndex = SelectedCustomExplorerIndex; + Close(); + } + + private void btnAdd_Click(object sender, RoutedEventArgs e) + { + CustomExplorers.Add(new() + { + Name = "New Profile" + }); + SelectedCustomExplorerIndex = CustomExplorers.Count - 1; + } + + private void btnDelete_Click(object sender, RoutedEventArgs e) + { + CustomExplorers.RemoveAt(SelectedCustomExplorerIndex--); + } + + private void btnBrowseFile_Click(object sender, RoutedEventArgs e) + { + Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); + Nullable result = dlg.ShowDialog(); + + if (result == true) + { + TextBox path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox"); + path.Text = dlg.FileName; + path.Focus(); + ((Button)sender).Focus(); + } + } + } +} diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 7dc8829be..fe1704ffe 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1,59 +1,65 @@ - + - + - + - - + + - + + @@ -62,44 +68,53 @@ - - + + + + - + - - - + + + + + + + + - + + - + - - - + + + - - - + + + - + + - - + + - - + +  + + - - - - + + + + - + - - - + + @@ -245,23 +477,26 @@ - + - - - + + - + - + - - + @@ -269,57 +504,77 @@ - + - - + - + - - + - + + - - - + + - + - - + + - - - + + - + - + - - + + @@ -328,57 +583,155 @@ - + + - - + + - + - + - - + + + + + - - + + - - + + + + + - - + + - - - -  + + + +  - + - + + - - - + + + + + + + + + + + + + + +  + + + + + - -  +