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/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.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 614fc1de8..5f9082fe9 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -102,8 +102,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 d9cdf5581..974eafa96 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -59,6 +59,11 @@ namespace Flow.Launcher.Plugin /// Optional message subtitle void ShowMsgError(string title, string subTitle = ""); + /// + /// Show the MainWindow when hiding + /// + void ShowMainWindow(); + /// /// Show message box /// diff --git a/Flow.Launcher/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 281be6e52..e116e6f4d 100644 --- a/Flow.Launcher/ActionKeywords.xaml.cs +++ b/Flow.Launcher/ActionKeywords.xaml.cs @@ -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..13d88e1c6 100644 --- a/Flow.Launcher/App.xaml +++ b/Flow.Launcher/App.xaml @@ -6,6 +6,227 @@ Startup="OnStartupAsync"> + + + + + + + + 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/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 bbb56b9ec..1cb203515 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -13,53 +13,64 @@ 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). 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 +78,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 @@ -118,6 +134,7 @@ Usage Tips: + 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! @@ -131,10 +148,11 @@ 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 @@ -181,4 +199,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 b766ccfa2..4014d215f 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -13,53 +13,64 @@ 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 centrálneho 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). 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 +78,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. + Otvoriť výsledok modifikačným klávesom + Vyberte modifikačný kláves na otvorenie 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ť @@ -90,7 +106,7 @@ Povoliť HTTP Proxy HTTP Server Port - Použív. meno + Používateľské meno Heslo Test Proxy Uložiť @@ -117,6 +133,7 @@ Tipy na používanie: + 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! @@ -130,10 +147,11 @@ 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 @@ -162,8 +180,8 @@ Č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. diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 8e161ce75..daea406db 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -94,7 +94,7 @@ - + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 3130780ac..5fc3f2fc9 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; @@ -31,6 +32,7 @@ namespace Flow.Launcher private bool isProgressBarStoryboardPaused; private Settings _settings; private NotifyIcon _notifyIcon; + private ContextMenu contextMenu; private MainViewModel _viewModel; #endregion @@ -160,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() @@ -178,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; } }; } diff --git a/Flow.Launcher/Notification.cs b/Flow.Launcher/Notification.cs new file mode 100644 index 000000000..2c82e1451 --- /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.Major < 10; + // Handle notification for win7/8 + 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..fbf4394f7 100644 --- a/Flow.Launcher/PriorityChangeWindow.xaml +++ b/Flow.Launcher/PriorityChangeWindow.xaml @@ -6,38 +6,45 @@ xmlns:local="clr-namespace:Flow.Launcher" Loaded="PriorityChangeWindow_Loaded" mc:Ignorable="d" + ResizeMode="NoResize" WindowStartupLocation="CenterScreen" - Title="PriorityChangeWindow" Height="250" Width="300"> + Title="{DynamicResource changePriorityWindow}" Height="365" Width="350" Background="#F3F3F3" BorderBrush="#cecece"> - - - + - - - - - - + + + + + + + + + + + + + + - - - - - - - - - diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 6f995671d..71f6f1be4 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -68,6 +68,8 @@ namespace Flow.Launcher public void RestarApp() => RestartApp(); + public void ShowMainWindow() => _mainVM.MainWindowVisibility = Visibility.Visible; + public void CheckForNewUpdate() => _settingsVM.UpdateApp(); public void SaveAppAllSettings() @@ -90,8 +92,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); }); } diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index c0763882c..ad77dee55 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -17,43 +17,41 @@ ResizeMode="CanResizeWithGrip" WindowStartupLocation="CenterScreen" Height="700" Width="1000" - MinWidth="850" + MinWidth="900" MinHeight="600" - Loaded="OnLoaded" + MouseDown="window_MouseDown" + Loaded="OnLoaded" Closed="OnClosed" d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}"> - + - + - + - + + @@ -64,13 +62,15 @@ + + + + + + + + + + + - - - + + + - - - + + + - + + - - + + - - + +  + + - + - + - + - - - + + @@ -245,11 +427,13 @@ - + - - - + + @@ -258,10 +442,11 @@ - + - - + @@ -269,31 +454,37 @@ - + - - + - + - - + - + + - - - + + @@ -302,12 +493,16 @@ - - + + - - - + + @@ -316,10 +511,13 @@ - + - - + + @@ -328,10 +526,15 @@ - + + - - + + @@ -341,29 +544,44 @@ - + + + + + ItemsSource="{Binding QuerySearchPrecisionStrings}" + SelectedItem="{Binding Settings.QuerySearchPrecisionString}" + Grid.Column="2" /> - + - + + + + + ItemsSource="{Binding LastQueryModes}" + SelectedValue="{Binding Settings.LastQueryMode}" + DisplayMemberPath="Display" SelectedValuePath="Value" Grid.Column="2" /> - + - - - -  + + + +  @@ -373,12 +591,15 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + - + - - + + - + - + @@ -565,33 +1060,39 @@ - - - + + + - + + Text="{DynamicResource hiThere}" IsReadOnly="True" + Style="{DynamicResource QueryBoxStyle}" /> - + - + - + @@ -630,25 +1131,29 @@ - - +