diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index d42fd425f..27afff5b6 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -41,6 +41,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool UseGlyphIcons { get; set; } = true; public bool UseAnimation { get; set; } = true; public bool UseSound { get; set; } = true; + public bool UseClock { get; set; } = true; + public bool UseDate { get; set; } = false; + public string TimeFormat { get; set; } = "hh:mm tt"; + public string DateFormat { get; set; } = "MM'/'dd ddd"; public bool FirstLaunch { get; set; } = true; public double SettingWindowWidth { get; set; } = 1000; diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index a3ad20f77..b9ac6afb3 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -17,7 +17,7 @@ namespace Flow.Launcher.Helper internal static void Initialize(MainViewModel mainVM) { mainViewModel = mainVM; - settings = mainViewModel._settings; + settings = mainViewModel.Settings; SetHotkey(settings.Hotkey, OnToggleHotkey); LoadCustomPluginHotkey(); diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 092065688..0eff97f4a 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -132,6 +132,8 @@ Play a small sound when the search window opens Animation Use Animation in UI + Clock + Date Hotkey diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 9f7d16ab1..6f3915076 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -1,5 +1,4 @@ - + - - - - - + + + + - - - - - - - - - + + + - - - - + - - - - - - - - - - - - + - - - - + + + - - + - - - - + + + - - + + + + + + + + - - - - - - - + + + - @@ -292,14 +306,16 @@ - - - + + + - @@ -307,14 +323,16 @@ - - - + + + - @@ -322,4 +340,4 @@ - + \ No newline at end of file diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index fe6c119e1..630daf42e 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -20,8 +20,8 @@ using Flow.Launcher.Infrastructure; using System.Windows.Media; using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Plugin.SharedCommands; +using System.Windows.Threading; using System.Windows.Data; -using System.Diagnostics; namespace Flow.Launcher { @@ -45,6 +45,7 @@ namespace Flow.Launcher DataContext = mainVM; _viewModel = mainVM; _settings = settings; + InitializeComponent(); InitializePosition(); animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); @@ -54,6 +55,7 @@ namespace Flow.Launcher { InitializeComponent(); } + private void OnCopy(object sender, ExecutedRoutedEventArgs e) { if (QueryTextBox.SelectionLength == 0) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 7246c23a2..808531765 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -7,7 +7,6 @@ xmlns:flowlauncher="clr-namespace:Flow.Launcher" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase" - xmlns:svgc="http://sharpvectors.codeplex.com/svgc/" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:ui="http://schemas.modernwpf.com/2019" xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure" @@ -1810,8 +1809,11 @@ IsReadOnly="True" Style="{DynamicResource QueryBoxStyle}" Text="{DynamicResource hiThere}" /> - + + + + + + + + + + + + + + + +  + + + + + + + + + + + + + + +  + + + + + + + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index fc6be5d04..a7f2114ed 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -1,31 +1,23 @@ -using Droplex; -using Flow.Launcher.Core.ExternalPlugins; -using Flow.Launcher.Core.Plugin; +using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Resource; using Flow.Launcher.Helper; using Flow.Launcher.Infrastructure; using Flow.Launcher.Infrastructure.Hotkey; -using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.ViewModel; -using Microsoft.Win32; using ModernWpf; using System; using System.IO; -using System.Linq; using System.Windows; -using System.Windows.Controls; using System.Windows.Data; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Interop; -using System.Windows.Media; using System.Windows.Navigation; using Button = System.Windows.Controls.Button; using Control = System.Windows.Controls.Control; -using ListViewItem = System.Windows.Controls.ListViewItem; using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MessageBox = System.Windows.MessageBox; using TextBox = System.Windows.Controls.TextBox; @@ -71,6 +63,7 @@ namespace Flow.Launcher pluginStoreView.Filter = PluginStoreFilter; InitializePosition(); + ClockDisplay(); } private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e) @@ -466,6 +459,33 @@ namespace Flow.Launcher } } + private void PreviewClockAndDate(object sender, RoutedEventArgs e) + { + ClockDisplay(); + } + public void ClockDisplay() + { + if (settings.UseClock) + { + ClockBox.Visibility = Visibility.Visible; + ClockBox.Text = DateTime.Now.ToString(settings.TimeFormat); + } + else + { + ClockBox.Visibility = Visibility.Collapsed; + } + + if (settings.UseDate) + { + DateBox.Visibility = Visibility.Visible; + DateBox.Text = DateTime.Now.ToString(settings.DateFormat); + } + else + { + DateBox.Visibility = Visibility.Collapsed; + } + } + public void InitializePosition() { if (settings.SettingWindowTop >= 0 && settings.SettingWindowLeft >= 0) diff --git a/Flow.Launcher/Themes/Atom.xaml b/Flow.Launcher/Themes/Atom.xaml index 10daf817f..f532c97d5 100644 --- a/Flow.Launcher/Themes/Atom.xaml +++ b/Flow.Launcher/Themes/Atom.xaml @@ -1,64 +1,100 @@ - + - - - - - - + - - - - #2c313c - - - - - - - + + diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 5459a9464..77b0fd1c5 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -79,6 +79,83 @@ + + + + + + + @@ -36,6 +37,7 @@ x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}"> + @@ -140,4 +142,18 @@ + + diff --git a/Flow.Launcher/Themes/BlurWhite.xaml b/Flow.Launcher/Themes/BlurWhite.xaml index 1b939f736..6308f9e47 100644 --- a/Flow.Launcher/Themes/BlurWhite.xaml +++ b/Flow.Launcher/Themes/BlurWhite.xaml @@ -50,7 +50,7 @@ TargetType="{x:Type Window}"> - + @@ -143,4 +143,18 @@ + + diff --git a/Flow.Launcher/Themes/Darker Glass.xaml b/Flow.Launcher/Themes/Darker Glass.xaml index de37dd192..13c9e2bc5 100644 --- a/Flow.Launcher/Themes/Darker Glass.xaml +++ b/Flow.Launcher/Themes/Darker Glass.xaml @@ -1,84 +1,131 @@ - + - - - - - - + - - - #545454 - - - - - - + + diff --git a/Flow.Launcher/Themes/Darker.xaml b/Flow.Launcher/Themes/Darker.xaml index 675092bf8..b255c4d9e 100644 --- a/Flow.Launcher/Themes/Darker.xaml +++ b/Flow.Launcher/Themes/Darker.xaml @@ -1,51 +1,97 @@ - + - - - - + + + - - - #4d4d4d - - - + + + diff --git a/Flow.Launcher/Themes/Discord Dark.xaml b/Flow.Launcher/Themes/Discord Dark.xaml index 636fe7b6d..92b8d8da7 100644 --- a/Flow.Launcher/Themes/Discord Dark.xaml +++ b/Flow.Launcher/Themes/Discord Dark.xaml @@ -1,64 +1,101 @@ - + - - - - - - - - - - - - #49443c - - - - - - + + diff --git a/Flow.Launcher/Themes/Dracula.xaml b/Flow.Launcher/Themes/Dracula.xaml index c661d33e3..146038ba9 100644 --- a/Flow.Launcher/Themes/Dracula.xaml +++ b/Flow.Launcher/Themes/Dracula.xaml @@ -1,64 +1,100 @@ - + - - - - - - + - - - - #44475a - - - - - - - + + diff --git a/Flow.Launcher/Themes/Gray.xaml b/Flow.Launcher/Themes/Gray.xaml index c3cec7bd8..1cacc8ec2 100644 --- a/Flow.Launcher/Themes/Gray.xaml +++ b/Flow.Launcher/Themes/Gray.xaml @@ -1,61 +1,107 @@ - + - - - - - - - - - - #787878 - - - + + + diff --git a/Flow.Launcher/Themes/League.xaml b/Flow.Launcher/Themes/League.xaml index ac774c07b..771d38c39 100644 --- a/Flow.Launcher/Themes/League.xaml +++ b/Flow.Launcher/Themes/League.xaml @@ -118,5 +118,16 @@ - + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Metro Server.xaml b/Flow.Launcher/Themes/Metro Server.xaml index 016e6af9d..cbd70dbaf 100644 --- a/Flow.Launcher/Themes/Metro Server.xaml +++ b/Flow.Launcher/Themes/Metro Server.xaml @@ -1,48 +1,83 @@ - + - - - - - - - - - - + + #04152E - - - + + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Nord Darker.xaml b/Flow.Launcher/Themes/Nord Darker.xaml index 413effa51..7c29eda22 100644 --- a/Flow.Launcher/Themes/Nord Darker.xaml +++ b/Flow.Launcher/Themes/Nord Darker.xaml @@ -1,64 +1,110 @@ - + - - - - - - - - - - - #4e586b - - - + + diff --git a/Flow.Launcher/Themes/Nord.xaml b/Flow.Launcher/Themes/Nord.xaml index 2fcc11ef2..735041656 100644 --- a/Flow.Launcher/Themes/Nord.xaml +++ b/Flow.Launcher/Themes/Nord.xaml @@ -1,63 +1,109 @@ - + - - - - - - - - - - - #596479 - - - + + diff --git a/Flow.Launcher/Themes/Pink.xaml b/Flow.Launcher/Themes/Pink.xaml index cb5f56a8e..7e1ae911a 100644 --- a/Flow.Launcher/Themes/Pink.xaml +++ b/Flow.Launcher/Themes/Pink.xaml @@ -1,63 +1,102 @@ - + - + - - - - - - - - - - + + #cc1081 - - + @@ -74,4 +113,16 @@ + + \ No newline at end of file diff --git a/Flow.Launcher/Themes/Sublime.xaml b/Flow.Launcher/Themes/Sublime.xaml index 82fff06ff..1b6f25e83 100644 --- a/Flow.Launcher/Themes/Sublime.xaml +++ b/Flow.Launcher/Themes/Sublime.xaml @@ -1,64 +1,101 @@ - + - - - - - - - - - - - - #3c454e - - - - - - + + diff --git a/Flow.Launcher/Themes/Win10Light.xaml b/Flow.Launcher/Themes/Win10Light.xaml index 6f487a895..ad16f390e 100644 --- a/Flow.Launcher/Themes/Win10Light.xaml +++ b/Flow.Launcher/Themes/Win10Light.xaml @@ -1,67 +1,104 @@ - + - - - - - - - - - - - - #ccd0d4 - - - - - - + + diff --git a/Flow.Launcher/Themes/Win11Dark.xaml b/Flow.Launcher/Themes/Win11Dark.xaml index 31f6fb956..aa510acaf 100644 --- a/Flow.Launcher/Themes/Win11Dark.xaml +++ b/Flow.Launcher/Themes/Win11Dark.xaml @@ -156,4 +156,16 @@ + + diff --git a/Flow.Launcher/Themes/Win11Light.xaml b/Flow.Launcher/Themes/Win11Light.xaml index 48f6820c4..df6d20bb4 100644 --- a/Flow.Launcher/Themes/Win11Light.xaml +++ b/Flow.Launcher/Themes/Win11Light.xaml @@ -164,4 +164,16 @@ + + diff --git a/Flow.Launcher/Themes/Win11System.xaml b/Flow.Launcher/Themes/Win11System.xaml index bcc83be9f..3cf7fd123 100644 --- a/Flow.Launcher/Themes/Win11System.xaml +++ b/Flow.Launcher/Themes/Win11System.xaml @@ -156,4 +156,16 @@ + + diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 57c791f5e..fc23fecd0 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -38,7 +38,6 @@ namespace Flow.Launcher.ViewModel private readonly FlowLauncherJsonStorage _historyItemsStorage; private readonly FlowLauncherJsonStorage _userSelectedRecordStorage; private readonly FlowLauncherJsonStorage _topMostRecordStorage; - internal readonly Settings _settings; private readonly History _history; private readonly UserSelectedRecord _userSelectedRecord; private readonly TopMostRecord _topMostRecord; @@ -61,8 +60,8 @@ namespace Flow.Launcher.ViewModel _queryText = ""; _lastQuery = new Query(); - _settings = settings; - _settings.PropertyChanged += (_, args) => + Settings = settings; + Settings.PropertyChanged += (_, args) => { if (args.PropertyName == nameof(Settings.WindowSize)) { @@ -77,15 +76,16 @@ namespace Flow.Launcher.ViewModel _userSelectedRecord = _userSelectedRecordStorage.Load(); _topMostRecord = _topMostRecordStorage.Load(); - ContextMenu = new ResultsViewModel(_settings); - Results = new ResultsViewModel(_settings); - History = new ResultsViewModel(_settings); + ContextMenu = new ResultsViewModel(Settings); + Results = new ResultsViewModel(Settings); + History = new ResultsViewModel(Settings); _selectedResults = Results; InitializeKeyCommands(); RegisterViewUpdate(); RegisterResultsUpdatedEvent(); + RegisterClockAndDateUpdateAsync(); SetOpenResultModifiers(); } @@ -321,6 +321,22 @@ namespace Flow.Launcher.ViewModel #region ViewModel Properties + public Settings Settings { get; } + public object ClockText { get; private set; } + public string DateText { get; private set; } + + private async Task RegisterClockAndDateUpdateAsync() + { + var timer = new PeriodicTimer(TimeSpan.FromSeconds(1)); + // ReSharper disable once MethodSupportsCancellation + while (await timer.WaitForNextTickAsync().ConfigureAwait(false)) + { + if (Settings.UseClock) + ClockText = DateTime.Now.ToString(Settings.TimeFormat); + if (Settings.UseDate) + DateText = DateTime.Now.ToString(Settings.DateFormat); + } + } public ResultsViewModel Results { get; private set; } public ResultsViewModel ContextMenu { get; private set; } @@ -344,14 +360,14 @@ namespace Flow.Launcher.ViewModel [RelayCommand] private void IncreaseWidth() { - if (MainWindowWidth + 100 > 1920 || _settings.WindowSize == 1920) + if (MainWindowWidth + 100 > 1920 || Settings.WindowSize == 1920) { - _settings.WindowSize = 1920; + Settings.WindowSize = 1920; } else - { - _settings.WindowSize += 100; - _settings.WindowLeft -= 50; + { + Settings.WindowSize += 100; + Settings.WindowLeft -= 50; } OnPropertyChanged(); } @@ -359,14 +375,14 @@ namespace Flow.Launcher.ViewModel [RelayCommand] private void DecreaseWidth() { - if (MainWindowWidth - 100 < 400 || _settings.WindowSize == 400) + if (MainWindowWidth - 100 < 400 || Settings.WindowSize == 400) { - _settings.WindowSize = 400; + Settings.WindowSize = 400; } else - { - _settings.WindowLeft += 50; - _settings.WindowSize -= 100; + { + Settings.WindowLeft += 50; + Settings.WindowSize -= 100; } OnPropertyChanged(); } @@ -374,19 +390,19 @@ namespace Flow.Launcher.ViewModel [RelayCommand] private void IncreaseMaxResult() { - if (_settings.MaxResultsToShow == 17) + if (Settings.MaxResultsToShow == 17) return; - _settings.MaxResultsToShow += 1; + Settings.MaxResultsToShow += 1; } [RelayCommand] private void DecreaseMaxResult() { - if (_settings.MaxResultsToShow == 2) + if (Settings.MaxResultsToShow == 2) return; - _settings.MaxResultsToShow -= 1; + Settings.MaxResultsToShow -= 1; } /// @@ -466,8 +482,8 @@ namespace Flow.Launcher.ViewModel public double MainWindowWidth { - get => _settings.WindowSize; - set => _settings.WindowSize = value; + get => Settings.WindowSize; + set => Settings.WindowSize = value; } public string PluginIconPath { get; set; } = null; @@ -816,7 +832,7 @@ namespace Flow.Launcher.ViewModel private void SetOpenResultModifiers() { - OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers; + OpenResultCommandModifiers = Settings.OpenResultModifiers ?? DefaultOpenResultModifiers; } public void ToggleFlowLauncher() @@ -845,24 +861,24 @@ namespace Flow.Launcher.ViewModel // Trick for no delay MainWindowOpacity = 0; - switch (_settings.LastQueryMode) + switch (Settings.LastQueryMode) { case LastQueryMode.Empty: ChangeQueryText(string.Empty); await Task.Delay(100); //Time for change to opacity break; case LastQueryMode.Preserved: - if (_settings.UseAnimation) + if (Settings.UseAnimation) await Task.Delay(100); LastQuerySelected = true; break; case LastQueryMode.Selected: - if (_settings.UseAnimation) + if (Settings.UseAnimation) await Task.Delay(100); LastQuerySelected = false; break; default: - throw new ArgumentException($"wrong LastQueryMode: <{_settings.LastQueryMode}>"); + throw new ArgumentException($"wrong LastQueryMode: <{Settings.LastQueryMode}>"); } MainWindowVisibilityStatus = false; @@ -877,7 +893,7 @@ namespace Flow.Launcher.ViewModel /// public bool ShouldIgnoreHotkeys() { - return _settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen(); + return Settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen(); } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 192fee0f6..e382c207d 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -429,7 +429,24 @@ namespace Flow.Launcher.ViewModel } } + public List TimeFormatList { get; set; } = new List() + { + "hh:mm", + "HH:mm", + "tt hh:mm", + "hh:mm tt" + }; + public List DateFormatList { get; set; } = new List() + { + "MM'/'dd dddd", + "MM'/'dd ddd", + "MM'/'dd", + "dd'/'MM", + "ddd MM'/'dd", + "dddd MM'/'dd", + "dddd" + }; public double WindowWidthSize { @@ -455,6 +472,18 @@ namespace Flow.Launcher.ViewModel set => Settings.UseSound = value; } + public bool UseClock + { + get => Settings.UseClock; + set => Settings.UseClock = value; + } + + public bool UseDate + { + get => Settings.UseDate; + set => Settings.UseDate = value; + } + public double SettingWindowWidth { get => Settings.SettingWindowWidth; diff --git a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml index f0375d126..fbe538b7f 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml @@ -151,10 +151,6 @@ TextWrapping="Wrap" /> - -