diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 6c06bb484c4..606e6712dc8 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -8,6 +8,7 @@ using System.Windows.Interop; using System.Windows.Markup; using System.Windows.Media; +using System.Windows.Media.Effects; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; @@ -34,6 +35,9 @@ public Theme() var dicts = Application.Current.Resources.MergedDictionaries; _oldResource = dicts.First(d => { + if (d.Source == null) + return false; + var p = d.Source.AbsolutePath; var dir = Path.GetDirectoryName(p).NonNull(); var info = new DirectoryInfo(dir); @@ -65,7 +69,7 @@ private void MakesureThemeDirectoriesExist() public bool ChangeTheme(string theme) { - const string defaultTheme = "Dark"; + const string defaultTheme = Constant.DefaultTheme; string path = GetThemePath(theme); try @@ -75,16 +79,15 @@ public bool ChangeTheme(string theme) Settings.Theme = theme; - var dicts = Application.Current.Resources.MergedDictionaries; //always allow re-loading default theme, in case of failure of switching to a new theme from default theme if (_oldTheme != theme || theme == defaultTheme) { - dicts.Remove(_oldResource); - var newResource = GetResourceDictionary(); - dicts.Add(newResource); - _oldResource = newResource; + UpdateResourceDictionary(GetResourceDictionary()); _oldTheme = Path.GetFileNameWithoutExtension(_oldResource.Source.AbsolutePath); } + + if (Settings.UseDropShadowEffect) + AddDropShadowEffectToCurrentTheme(); } catch (DirectoryNotFoundException e) { @@ -109,7 +112,16 @@ public bool ChangeTheme(string theme) return true; } - public ResourceDictionary GetResourceDictionary() + private void UpdateResourceDictionary(ResourceDictionary dictionaryToUpdate) + { + var dicts = Application.Current.Resources.MergedDictionaries; + + dicts.Remove(_oldResource); + dicts.Add(dictionaryToUpdate); + _oldResource = dictionaryToUpdate; + } + + private ResourceDictionary CurrentThemeResourceDictionary() { var uri = GetThemePath(Settings.Theme); var dict = new ResourceDictionary @@ -117,6 +129,13 @@ public ResourceDictionary GetResourceDictionary() Source = new Uri(uri, UriKind.Absolute) }; + return dict; + } + + public ResourceDictionary GetResourceDictionary() + { + var dict = CurrentThemeResourceDictionary(); + Style queryBoxStyle = dict["QueryBoxStyle"] as Style; if (queryBoxStyle != null) { @@ -146,6 +165,7 @@ public ResourceDictionary GetResourceDictionary() Setter[] setters = { fontFamily, fontStyle, fontWeight, fontStretch }; Array.ForEach(new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); } + return dict; } @@ -176,6 +196,36 @@ private string GetThemePath(string themeName) return string.Empty; } + public void AddDropShadowEffectToCurrentTheme() + { + var dict = CurrentThemeResourceDictionary(); + + var windowBorderStyle = dict["WindowBorderStyle"] as Style; + + var effectSetter = new Setter(); + effectSetter.Property = Border.EffectProperty; + effectSetter.Value = new DropShadowEffect + { + Opacity = 0.9, + ShadowDepth = 2, + BlurRadius = 15 + }; + + windowBorderStyle.Setters.Add(effectSetter); + + UpdateResourceDictionary(dict); + } + + public void RemoveDropShadowEffectToCurrentTheme() + { + var dict = CurrentThemeResourceDictionary(); + var windowBorderStyle = dict["WindowBorderStyle"] as Style; + + dict.Remove(Border.EffectProperty); + + UpdateResourceDictionary(dict); + } + #region Blur Handling /* Found on https://github.com/riverar/sample-win10-aeroglass diff --git a/Flow.Launcher.Infrastructure/Constant.cs b/Flow.Launcher.Infrastructure/Constant.cs index 1503aaf412b..0936ce8c44b 100644 --- a/Flow.Launcher.Infrastructure/Constant.cs +++ b/Flow.Launcher.Infrastructure/Constant.cs @@ -27,5 +27,9 @@ public static class Constant public static string PythonPath; public static string EverythingSDKPath; + + public static readonly string QueryTextBoxIconImagePath = $"{ProgramDirectory}\\Images\\mainsearch.png"; + + public const string DefaultTheme = "Darker"; } } diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 84b0a79908a..4e1a8d7d86f 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -13,7 +13,8 @@ public class Settings : BaseModel public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public bool ShowOpenResultHotkey { get; set; } = true; public string Language { get; set; } = "en"; - public string Theme { get; set; } = "Dark"; + public string Theme { get; set; } = Constant.DefaultTheme; + public bool UseDropShadowEffect { get; set; } = false; public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name; public string QueryBoxFontStyle { get; set; } public string QueryBoxFontWeight { get; set; } @@ -61,7 +62,7 @@ public string QuerySearchPrecisionString public double WindowLeft { get; set; } public double WindowTop { get; set; } - public int MaxResultsToShow { get; set; } = 6; + public int MaxResultsToShow { get; set; } = 5; public int ActivateTimes { get; set; } // Order defaults to 0 or -1, so 1 will let this property appear last diff --git a/Flow.Launcher/App.xaml b/Flow.Launcher/App.xaml index 0b67b87dd8c..f3347d7fbf6 100644 --- a/Flow.Launcher/App.xaml +++ b/Flow.Launcher/App.xaml @@ -1,12 +1,15 @@  - + + + diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs index 2fb802d8a6f..c70796a6d4e 100644 --- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs +++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs @@ -19,7 +19,7 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur var queryText = (string)values[0]; if (string.IsNullOrEmpty(queryText)) - return "Type here to search"; + return string.Empty; // second prop is the current selected item result var val = values[1]; diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 7049d9c4d10..5a32c7527b1 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -58,6 +58,7 @@ + @@ -142,6 +143,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/Flow.Launcher/Images/mainsearch.png b/Flow.Launcher/Images/mainsearch.png new file mode 100644 index 00000000000..ac5492fa62d Binary files /dev/null and b/Flow.Launcher/Images/mainsearch.png differ diff --git a/Flow.Launcher/Languages/da.xaml b/Flow.Launcher/Languages/da.xaml index e8ec05ef962..296f6aa8bca 100644 --- a/Flow.Launcher/Languages/da.xaml +++ b/Flow.Launcher/Languages/da.xaml @@ -42,7 +42,6 @@ Tema Søg efter flere temaer - Hej Flow Launcher Søgefelt skrifttype Resultat skrifttype Vindue mode diff --git a/Flow.Launcher/Languages/de.xaml b/Flow.Launcher/Languages/de.xaml index c2e77cc4776..91b7c79829f 100644 --- a/Flow.Launcher/Languages/de.xaml +++ b/Flow.Launcher/Languages/de.xaml @@ -42,7 +42,6 @@ Theme Suche nach weiteren Themes - Hallo Flow Launcher Abfragebox Schriftart Ergebnis Schriftart Fenstermodus diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index c33093cab3d..1b69c1b90f2 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -49,7 +49,7 @@ Theme Browse for more themes - Hello Flow Launcher + Hi There Query Box Font Result Item Font Window Mode @@ -68,6 +68,9 @@ Add Please select an item 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 you computer performance is limited. HTTP Proxy @@ -97,7 +100,7 @@ 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: + Release Notes Old Action Keyword diff --git a/Flow.Launcher/Languages/fr.xaml b/Flow.Launcher/Languages/fr.xaml index 753ccfdfac3..f43cbb49894 100644 --- a/Flow.Launcher/Languages/fr.xaml +++ b/Flow.Launcher/Languages/fr.xaml @@ -46,7 +46,6 @@ Thèmes Trouver plus de thèmes - Hello Flow Launcher Police (barre de recherche) Police (liste des résultats) Mode fenêtré diff --git a/Flow.Launcher/Languages/it.xaml b/Flow.Launcher/Languages/it.xaml index f01b96bcc34..aa29a889179 100644 --- a/Flow.Launcher/Languages/it.xaml +++ b/Flow.Launcher/Languages/it.xaml @@ -46,7 +46,6 @@ Tema Sfoglia per altri temi - Hello Flow Launcher Font campo di ricerca Font campo risultati Modalità finestra diff --git a/Flow.Launcher/Languages/ja.xaml b/Flow.Launcher/Languages/ja.xaml index c6cabdce9b4..34c38edf45d 100644 --- a/Flow.Launcher/Languages/ja.xaml +++ b/Flow.Launcher/Languages/ja.xaml @@ -47,7 +47,6 @@ テーマ テーマを探す - こんにちは Flow Launcher 検索ボックスのフォント 検索結果一覧のフォント ウィンドウモード diff --git a/Flow.Launcher/Languages/ko.xaml b/Flow.Launcher/Languages/ko.xaml index c52e1cb23f6..21f1f027372 100644 --- a/Flow.Launcher/Languages/ko.xaml +++ b/Flow.Launcher/Languages/ko.xaml @@ -46,7 +46,6 @@ 테마 테마 더 찾아보기 - Hello Flow Launcher 쿼리 상자 글꼴 결과 항목 글꼴 윈도우 모드 diff --git a/Flow.Launcher/Languages/nb-NO.xaml b/Flow.Launcher/Languages/nb-NO.xaml index 453203b4dff..1dbfcf5d41b 100644 --- a/Flow.Launcher/Languages/nb-NO.xaml +++ b/Flow.Launcher/Languages/nb-NO.xaml @@ -46,7 +46,6 @@ Tema Finn flere temaer - Hallo Flow Launcher Font for spørringsboks Font for resultat Vindusmodus diff --git a/Flow.Launcher/Languages/nl.xaml b/Flow.Launcher/Languages/nl.xaml index 492ea5a8c5a..7d24d90679b 100644 --- a/Flow.Launcher/Languages/nl.xaml +++ b/Flow.Launcher/Languages/nl.xaml @@ -42,7 +42,6 @@ Thema Zoek meer thema´s - Hallo Flow Launcher Query Box lettertype Resultaat Item lettertype Window Mode diff --git a/Flow.Launcher/Languages/pl.xaml b/Flow.Launcher/Languages/pl.xaml index 95fa57bd202..4f26cfaaf04 100644 --- a/Flow.Launcher/Languages/pl.xaml +++ b/Flow.Launcher/Languages/pl.xaml @@ -42,7 +42,6 @@ Skórka Znajdź więcej skórek - Witaj Flow Launcher Czcionka okna zapytania Czcionka okna wyników Tryb w oknie diff --git a/Flow.Launcher/Languages/pt-br.xaml b/Flow.Launcher/Languages/pt-br.xaml index d5d2bf76d3b..11d8b839e89 100644 --- a/Flow.Launcher/Languages/pt-br.xaml +++ b/Flow.Launcher/Languages/pt-br.xaml @@ -46,7 +46,6 @@ Tema Ver mais temas - Olá Flow Launcher Fonte da caixa de Consulta Fonte do Resultado Modo Janela diff --git a/Flow.Launcher/Languages/ru.xaml b/Flow.Launcher/Languages/ru.xaml index 1855a210c2c..b86fcf377a1 100644 --- a/Flow.Launcher/Languages/ru.xaml +++ b/Flow.Launcher/Languages/ru.xaml @@ -42,7 +42,6 @@ Темы Найти больше тем - Привет Flow Launcher Шрифт запросов Шрифт результатов Оконный режим diff --git a/Flow.Launcher/Languages/sk.xaml b/Flow.Launcher/Languages/sk.xaml index deb79cde4f4..4ddbd839d25 100644 --- a/Flow.Launcher/Languages/sk.xaml +++ b/Flow.Launcher/Languages/sk.xaml @@ -47,7 +47,6 @@ Motív Prehliadať viac motívov - Ahoj Flow Launcher Písmo poľa pre dopyt Písmo výsledkov Režim okno diff --git a/Flow.Launcher/Languages/sr.xaml b/Flow.Launcher/Languages/sr.xaml index 1afff3fcf2a..41f112af6f5 100644 --- a/Flow.Launcher/Languages/sr.xaml +++ b/Flow.Launcher/Languages/sr.xaml @@ -46,7 +46,6 @@ Tema Pretražite još tema - Zdravo Flow Launcher Font upita Font rezultata Režim prozora diff --git a/Flow.Launcher/Languages/tr.xaml b/Flow.Launcher/Languages/tr.xaml index 04256d6b058..9e2624cc2f3 100644 --- a/Flow.Launcher/Languages/tr.xaml +++ b/Flow.Launcher/Languages/tr.xaml @@ -48,7 +48,6 @@ Temalar Daha fazla tema bul - Merhaba Flow Launcher Pencere Yazı Tipi Sonuç Yazı Tipi Pencere Modu diff --git a/Flow.Launcher/Languages/uk-UA.xaml b/Flow.Launcher/Languages/uk-UA.xaml index af65e0e6319..0343f9d0f6b 100644 --- a/Flow.Launcher/Languages/uk-UA.xaml +++ b/Flow.Launcher/Languages/uk-UA.xaml @@ -42,7 +42,6 @@ Теми Знайти більше тем - Привіт Flow Launcher Шрифт запитів Шрифт результатів Віконний режим diff --git a/Flow.Launcher/Languages/zh-cn.xaml b/Flow.Launcher/Languages/zh-cn.xaml index 7367de366b7..c8bdc68909e 100644 --- a/Flow.Launcher/Languages/zh-cn.xaml +++ b/Flow.Launcher/Languages/zh-cn.xaml @@ -47,7 +47,6 @@ 主题 浏览更多主题 - 你好,Flow Launcher 查询框字体 结果项字体 窗口模式 diff --git a/Flow.Launcher/Languages/zh-tw.xaml b/Flow.Launcher/Languages/zh-tw.xaml index 8cd3bbe8c3b..322eaf32f83 100644 --- a/Flow.Launcher/Languages/zh-tw.xaml +++ b/Flow.Launcher/Languages/zh-tw.xaml @@ -42,7 +42,6 @@ 主題 瀏覽更多主題 - 你好,Flow Launcher 查詢框字體 結果項字體 視窗模式 diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 485f58b479b..23ca5b677d7 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -18,6 +18,7 @@ Style="{DynamicResource WindowStyle}" Icon="Images/app.png" AllowsTransparency="True" + Background="Transparent" Loaded="OnLoaded" Initialized="OnInitialized" Closing="OnClosing" @@ -58,52 +59,57 @@ - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index d21c014d6a7..a8560c26347 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -41,7 +41,7 @@ - @@ -72,7 +72,7 @@ + Grid.Row="1" x:Name="SubTitle" Text="{Binding Result.SubTitle}" MinWidth="750"> @@ -91,6 +91,7 @@ Value="True"> + diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index c8463f59aff..1708a517214 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1,4 +1,4 @@ - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + - - - - + + + - - - - + + + - - - - -