mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge e2d0cf4056 into e8353f7648
This commit is contained in:
commit
a1fb82f889
9 changed files with 88 additions and 28 deletions
|
|
@ -165,6 +165,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
|
||||
public bool UseClock { get; set; } = true;
|
||||
public bool UseDate { get; set; } = false;
|
||||
public bool UseBattery { 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;
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@
|
|||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
|
||||
<PackageReference Include="PowerStatus" Version="1.0.3" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@
|
|||
<system:String x:Key="AnimationSpeedCustom">Custom</system:String>
|
||||
<system:String x:Key="Clock">Clock</system:String>
|
||||
<system:String x:Key="Date">Date</system:String>
|
||||
<system:String x:Key="Battery">Battery</system:String>
|
||||
<system:String x:Key="BackdropType">Backdrop Type</system:String>
|
||||
<system:String x:Key="BackdropInfo">The backdrop effect is not applied in the preview.</system:String>
|
||||
<system:String x:Key="BackdropTypeDisabledToolTip">Backdrop supported starting from Windows 11 build 22000 and above</system:String>
|
||||
|
|
|
|||
|
|
@ -299,18 +299,29 @@
|
|||
x:Name="ClockPanel"
|
||||
IsHitTestVisible="False"
|
||||
Opacity="{Binding ClockPanelOpacity}"
|
||||
Orientation="Horizontal"
|
||||
Style="{DynamicResource ClockPanel}"
|
||||
Visibility="{Binding ClockPanelVisibility}">
|
||||
<TextBlock
|
||||
x:Name="ClockBox"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="{Binding ClockText}"
|
||||
Visibility="{Binding Settings.UseClock, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<TextBlock
|
||||
x:Name="DateBox"
|
||||
Style="{DynamicResource DateBox}"
|
||||
Text="{Binding DateText}"
|
||||
Visibility="{Binding Settings.UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
x:Name="ClockBox"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="{Binding ClockText}"
|
||||
Visibility="{Binding Settings.UseClock, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<TextBlock
|
||||
x:Name="DateBox"
|
||||
Style="{DynamicResource DateBox}"
|
||||
Text="{Binding DateText}"
|
||||
Visibility="{Binding Settings.UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
x:Name="BatteryBox"
|
||||
Margin="8 0 0 0"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="{Binding BatteryText}"
|
||||
Visibility="{Binding Settings.UseBattery, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Border>
|
||||
<Grid WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
|
|
|
|||
|
|
@ -296,6 +296,14 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
set => Settings.UseDate = value;
|
||||
}
|
||||
|
||||
public bool UseBattery
|
||||
{
|
||||
get => Settings.UseBattery;
|
||||
set => Settings.UseBattery = value;
|
||||
}
|
||||
|
||||
public string BatteryText => "75%";
|
||||
|
||||
public FontFamily ClockPanelFont { get; }
|
||||
|
||||
public Brush PreviewBackground
|
||||
|
|
|
|||
|
|
@ -333,21 +333,33 @@
|
|||
<StackPanel
|
||||
x:Name="ClockPanel"
|
||||
IsHitTestVisible="False"
|
||||
Orientation="Horizontal"
|
||||
Style="{DynamicResource ClockPanel}"
|
||||
Visibility="Visible">
|
||||
<!-- Because these two textblock follow SettingWindowFont, we need to revert their font family explictly -->
|
||||
<TextBlock
|
||||
x:Name="ClockBox"
|
||||
FontFamily="{Binding ClockPanelFont, Mode=OneTime}"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="{Binding ClockText}"
|
||||
Visibility="{Binding UseClock, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<TextBlock
|
||||
x:Name="DateBox"
|
||||
FontFamily="{Binding ClockPanelFont, Mode=OneTime}"
|
||||
Style="{DynamicResource DateBox}"
|
||||
Text="{Binding DateText}"
|
||||
Visibility="{Binding UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
x:Name="ClockBox"
|
||||
FontFamily="{Binding ClockPanelFont, Mode=OneTime}"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="{Binding ClockText}"
|
||||
Visibility="{Binding UseClock, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<TextBlock
|
||||
x:Name="DateBox"
|
||||
FontFamily="{Binding ClockPanelFont, Mode=OneTime}"
|
||||
Style="{DynamicResource DateBox}"
|
||||
Text="{Binding DateText}"
|
||||
Visibility="{Binding UseDate, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
x:Name="BatteryBox"
|
||||
Margin="8 0 0 0"
|
||||
FontFamily="{Binding ClockPanelFont, Mode=OneTime}"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="{Binding BatteryText}"
|
||||
Visibility="{Binding UseBattery, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Canvas Style="{DynamicResource SearchIconPosition}">
|
||||
<Path
|
||||
|
|
@ -612,6 +624,17 @@
|
|||
</StackPanel>
|
||||
</ui:SettingsCard>
|
||||
|
||||
<ui:SettingsCard Margin="0 4 0 0" Header="{DynamicResource Battery}">
|
||||
<ui:SettingsCard.HeaderIcon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</ui:SettingsCard.HeaderIcon>
|
||||
|
||||
<ui:ToggleSwitch
|
||||
IsOn="{Binding UseBattery}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}" />
|
||||
</ui:SettingsCard>
|
||||
|
||||
<!-- Placeholder text -->
|
||||
<ui:SettingsExpander
|
||||
Margin="0 4 0 0"
|
||||
|
|
|
|||
|
|
@ -131,11 +131,10 @@
|
|||
<Setter Property="Foreground" Value="#8f8f8f" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="0 0 0 3" />
|
||||
<Setter Property="Margin" Value="0 1.5 0 1.5" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=DateBox, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Margin" Value="0 0 0 0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
|
@ -144,11 +143,10 @@
|
|||
<Setter Property="Foreground" Value="#8f8f8f" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="0 0 0 0" />
|
||||
<Setter Property="Margin" Value="0 1.5 0 1.5" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ClockBox, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Margin" Value="0 0 0 3" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ using Flow.Launcher.Plugin.SharedCommands;
|
|||
using Flow.Launcher.Storage;
|
||||
using iNKORE.UI.WPF.Modern;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
using PowerStatus;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -67,6 +68,8 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
private bool _taskbarShownByFlow = false;
|
||||
|
||||
private readonly PowerStatusProvider _powerStatusProvider = new();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
|
@ -336,6 +339,13 @@ namespace Flow.Launcher.ViewModel
|
|||
ClockText = DateTime.Now.ToString(Settings.TimeFormat, CultureInfo.CurrentCulture);
|
||||
if (Settings.UseDate)
|
||||
DateText = DateTime.Now.ToString(Settings.DateFormat, CultureInfo.CurrentCulture);
|
||||
if (Settings.UseBattery)
|
||||
{
|
||||
var status = _powerStatusProvider.GetStatus();
|
||||
BatteryText = status.BatteryLifeProportion.HasValue
|
||||
? $"{(int)(status.BatteryLifeProportion.Value * 100)}%"
|
||||
: string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -692,6 +702,7 @@ namespace Flow.Launcher.ViewModel
|
|||
public Settings Settings { get; }
|
||||
public string ClockText { get; private set; }
|
||||
public string DateText { get; private set; }
|
||||
public string BatteryText { get; private set; }
|
||||
|
||||
public ResultsViewModel Results { get; private set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,12 @@
|
|||
"System.ValueTuple": "4.5.0"
|
||||
}
|
||||
},
|
||||
"PowerStatus": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.3, )",
|
||||
"resolved": "1.0.3",
|
||||
"contentHash": "kDqm6puX7icNM9wX6OdmruBXZAM9bX2XwNNBB9KmQf9/D8wqyixYYVnZF6U3WGs+qtyNIpPIflRaQ4wwzoRfJQ=="
|
||||
},
|
||||
"PropertyChanged.Fody": {
|
||||
"type": "Direct",
|
||||
"requested": "[4.1.0, )",
|
||||
|
|
@ -1619,7 +1625,7 @@
|
|||
"FSharp.Core": "[9.0.303, )",
|
||||
"Flow.Launcher.Infrastructure": "[1.0.0, )",
|
||||
"Flow.Launcher.Localization": "[0.0.6, )",
|
||||
"Flow.Launcher.Plugin": "[5.0.0, )",
|
||||
"Flow.Launcher.Plugin": "[5.2.0, )",
|
||||
"Meziantou.Framework.Win32.Jobs": "[3.4.5, )",
|
||||
"Microsoft.IO.RecyclableMemoryStream": "[3.0.1, )",
|
||||
"SemanticVersioning": "[3.0.0, )",
|
||||
|
|
@ -1634,7 +1640,7 @@
|
|||
"BitFaster.Caching": "[2.5.4, )",
|
||||
"CommunityToolkit.Mvvm": "[8.4.0, )",
|
||||
"Flow.Launcher.Localization": "[0.0.6, )",
|
||||
"Flow.Launcher.Plugin": "[5.0.0, )",
|
||||
"Flow.Launcher.Plugin": "[5.2.0, )",
|
||||
"InputSimulator": "[1.0.4, )",
|
||||
"MemoryPack": "[1.21.4, )",
|
||||
"Microsoft.VisualStudio.Threading": "[17.14.15, )",
|
||||
|
|
|
|||
Loading…
Reference in a new issue