mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
- Add clock in query bar (sublime theme only)
This commit is contained in:
parent
1149ff5cb5
commit
c74a2dbc70
5 changed files with 95 additions and 3 deletions
|
|
@ -96,6 +96,10 @@
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</TextBox.ContextMenu>
|
</TextBox.ContextMenu>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
<StackPanel x:Name="ClockPanel" Style="{DynamicResource ClockPanel}">
|
||||||
|
<TextBlock x:Name="ClockBox" Style="{DynamicResource ClockBox}"></TextBlock>
|
||||||
|
<TextBlock x:Name="DateBox" Style="{DynamicResource DateBox}"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
<Canvas Style="{DynamicResource SearchIconPosition}">
|
<Canvas Style="{DynamicResource SearchIconPosition}">
|
||||||
<Path Data="{DynamicResource SearchIconImg}" Style="{DynamicResource SearchIconStyle}" Margin="0" Stretch="Fill"/>
|
<Path Data="{DynamicResource SearchIconImg}" Style="{DynamicResource SearchIconStyle}" Margin="0" Stretch="Fill"/>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ using Flow.Launcher.Core.Resource;
|
||||||
using Flow.Launcher.Helper;
|
using Flow.Launcher.Helper;
|
||||||
using Flow.Launcher.Infrastructure.UserSettings;
|
using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
using Flow.Launcher.ViewModel;
|
using Flow.Launcher.ViewModel;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using System.Globalization;
|
||||||
using Application = System.Windows.Application;
|
using Application = System.Windows.Application;
|
||||||
using Screen = System.Windows.Forms.Screen;
|
using Screen = System.Windows.Forms.Screen;
|
||||||
using ContextMenuStrip = System.Windows.Forms.ContextMenuStrip;
|
using ContextMenuStrip = System.Windows.Forms.ContextMenuStrip;
|
||||||
|
|
@ -31,7 +33,6 @@ namespace Flow.Launcher
|
||||||
private Settings _settings;
|
private Settings _settings;
|
||||||
private NotifyIcon _notifyIcon;
|
private NotifyIcon _notifyIcon;
|
||||||
private MainViewModel _viewModel;
|
private MainViewModel _viewModel;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public MainWindow(Settings settings, MainViewModel mainVM)
|
public MainWindow(Settings settings, MainViewModel mainVM)
|
||||||
|
|
@ -39,14 +40,30 @@ namespace Flow.Launcher
|
||||||
DataContext = mainVM;
|
DataContext = mainVM;
|
||||||
_viewModel = mainVM;
|
_viewModel = mainVM;
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
|
|
||||||
|
DispatcherTimer timer = new DispatcherTimer();
|
||||||
|
timer.Interval = new TimeSpan(0, 0, 1);
|
||||||
|
timer.Tick += Timer_Tick;
|
||||||
|
timer.Start();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Timer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm");
|
||||||
|
DateBox.Text = System.DateTime.Now.ToString("ddd MM/dd", CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private async void OnClosing(object sender, CancelEventArgs e)
|
private async void OnClosing(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
_notifyIcon.Visible = false;
|
_notifyIcon.Visible = false;
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,10 @@
|
||||||
<Canvas Style="{DynamicResource SearchIconPosition}">
|
<Canvas Style="{DynamicResource SearchIconPosition}">
|
||||||
<Path Data="{DynamicResource SearchIconImg}" Style="{DynamicResource SearchIconStyle}" Margin="0" Stretch="Fill"/>
|
<Path Data="{DynamicResource SearchIconImg}" Style="{DynamicResource SearchIconStyle}" Margin="0" Stretch="Fill"/>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
<StackPanel x:Name="ClockPanel" Style="{DynamicResource ClockPanel}">
|
||||||
|
<TextBlock x:Name="ClockBox" Style="{DynamicResource ClockBox}"></TextBlock>
|
||||||
|
<TextBlock x:Name="DateBox" Style="{DynamicResource DateBox}"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
<Border Margin="0 0 0 0" Grid.Row="1">
|
<Border Margin="0 0 0 0" Grid.Row="1">
|
||||||
<Rectangle Width="Auto" HorizontalAlignment="Stretch" Style="{DynamicResource SeparatorStyle}" Visibility="visible"/>
|
<Rectangle Width="Auto" HorizontalAlignment="Stretch" Style="{DynamicResource SeparatorStyle}" Visibility="visible"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,28 @@
|
||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="BaseClockPanel" TargetType="{x:Type StackPanel}">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Height" Value="Auto" />
|
||||||
|
<Setter Property="Margin" Value="0 0 14 0" />
|
||||||
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="BaseClockBox" TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="FontSize" Value="20" />
|
||||||
|
<Setter Property="Foreground" Value="#8f8f8f" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Bottom" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
|
<Setter Property="Margin" Value="0 0 0 -5" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="BaseDateBox" TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="FontSize" Value="14" />
|
||||||
|
<Setter Property="Foreground" Value="#8f8f8f" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Top" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
|
<Setter Property="Margin" Value="0 0 0 0" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<!--for classic themes-->
|
<!--for classic themes-->
|
||||||
<Style x:Key="SearchIconStyle" TargetType="{x:Type Path}">
|
<Style x:Key="SearchIconStyle" TargetType="{x:Type Path}">
|
||||||
<Setter Property="Fill" Value="#555555" />
|
<Setter Property="Fill" Value="#555555" />
|
||||||
|
|
@ -293,5 +315,12 @@
|
||||||
<Setter Property="Foreground" Value="#8f8f8f" />
|
<Setter Property="Foreground" Value="#8f8f8f" />
|
||||||
<Setter Property="Opacity" Value="0.5" />
|
<Setter Property="Opacity" Value="0.5" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="ClockBox" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BaseClockBox}">
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="DateBox" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BaseDateBox}">
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ClockPanel" TargetType="{x:Type StackPanel}" BasedOn="{StaticResource BaseClockPanel}">
|
||||||
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
<Setter Property="Cursor" Value="Arrow" />
|
<Setter Property="Cursor" Value="Arrow" />
|
||||||
<Setter Property="Foreground" Value="#cc8ec8" />
|
<Setter Property="Foreground" Value="#cc8ec8" />
|
||||||
</Style>
|
</Style>
|
||||||
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#3c454e</SolidColorBrush>
|
<SolidColorBrush x:Key="ItemSelectedBackgroundColor">#3C454E</SolidColorBrush>
|
||||||
<Style x:Key="ItemImageSelectedStyle" BasedOn="{StaticResource BaseItemImageSelectedStyle}" TargetType="{x:Type Image}" >
|
<Style x:Key="ItemImageSelectedStyle" BasedOn="{StaticResource BaseItemImageSelectedStyle}" TargetType="{x:Type Image}" >
|
||||||
<Setter Property="Cursor" Value="Arrow" />
|
<Setter Property="Cursor" Value="Arrow" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
@ -100,5 +100,44 @@
|
||||||
<Setter Property="Fill" Value="#3c454e" />
|
<Setter Property="Fill" Value="#3c454e" />
|
||||||
<Setter Property="Width" Value="32" />
|
<Setter Property="Width" Value="32" />
|
||||||
<Setter Property="Height" Value="32" />
|
<Setter Property="Height" Value="32" />
|
||||||
|
<Setter Property="Visibility" Value="Collapsed" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="ClockBox" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BaseClockBox}">
|
||||||
|
<Setter Property="Foreground" Value="#cc8ec8" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="DateBox" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource BaseDateBox}">
|
||||||
|
<Setter Property="Foreground" Value="#cc8ec8" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ClockPanel" TargetType="{x:Type StackPanel}" BasedOn="{StaticResource BaseClockPanel}">
|
||||||
|
<Setter Property="Visibility" Value="Visible" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ElementName=QueryTextBox, UpdateSourceTrigger=PropertyChanged, Path=Text.Length}" Value="0">
|
||||||
|
|
||||||
|
<DataTrigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
From="0.0" To="1.0" Duration="0:0:0.2"
|
||||||
|
/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</DataTrigger.EnterActions>
|
||||||
|
<DataTrigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
From="1.0" To="0.0" Duration="0:0:0.2"
|
||||||
|
/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</DataTrigger.ExitActions>
|
||||||
|
|
||||||
|
</DataTrigger>
|
||||||
|
|
||||||
|
</Style.Triggers>
|
||||||
|
|
||||||
</Style>
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue