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