Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public string SettingWindowFont

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;
Expand Down
1 change: 1 addition & 0 deletions Flow.Launcher/Flow.Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<system:String x:Key="setAutoStartFailed">Error setting launch on startup</system:String>
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
<system:String x:Key="showTaskbarWhenOpened">Show taskbar when Flow Launcher is opened</system:String>
<system:String x:Key="showTaskbarWhenOpenedToolTip">Temporarily show the taskbar when Flow Launcher is opened, useful for auto-hidden taskbars.</system:String>

Check warning on line 85 in Flow.Launcher/Languages/en.xaml

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
<system:String x:Key="SearchWindowPosition">Search Window Location</system:String>
<system:String x:Key="SearchWindowScreenRememberLastLaunchLocation">Remember Last Position</system:String>
Expand Down Expand Up @@ -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>
Expand Down
31 changes: 21 additions & 10 deletions Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ public bool UseDate
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
Expand Down
47 changes: 35 additions & 12 deletions Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -612,6 +624,17 @@
</StackPanel>
</ui:SettingsCard>

<ui:SettingsCard Margin="0 4 0 0" Header="{DynamicResource Battery}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Glyph="&#xEBA7;" />
</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"
Expand Down
6 changes: 2 additions & 4 deletions Flow.Launcher/Themes/Base.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
11 changes: 11 additions & 0 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Storage;
using iNKORE.UI.WPF.Modern;

Check warning on line 28 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
using Microsoft.VisualStudio.Threading;
using PowerStatus;

namespace Flow.Launcher.ViewModel
{
Expand Down Expand Up @@ -65,8 +66,10 @@
Priority = 0 // Priority is for calculating scores in UpdateResultView
};

private bool _taskbarShownByFlow = false;

Check warning on line 69 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)

private readonly PowerStatusProvider _powerStatusProvider = new();

#endregion

#region Constructor
Expand Down Expand Up @@ -336,6 +339,13 @@
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;
}
}
}

Expand Down Expand Up @@ -692,6 +702,7 @@
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; }

Expand Down Expand Up @@ -2149,8 +2160,8 @@
Win32Helper.SwitchToEnglishKeyboardLayout(true);
}

// Show the taskbar if the setting is enabled

Check warning on line 2163 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)
if (Settings.ShowTaskbarWhenInvoked && !_taskbarShownByFlow)

Check warning on line 2164 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`taskbar` is not a recognized word. (unrecognized-spelling)
{
Win32Helper.ShowTaskbar();
_taskbarShownByFlow = true;
Expand Down
10 changes: 8 additions & 2 deletions Flow.Launcher/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"resolved": "6.9.3",
"contentHash": "1CUGgFdyECDKgi5HaUBhdv6k+VG9Iy4OCforGfHyar3xQXAJypZkzymgKtWj/4SPd6nSG0Qi7NH71qHrDSZLaA=="
},
"iNKORE.UI.WPF.Modern": {

Check warning on line 29 in Flow.Launcher/packages.lock.json

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
"type": "Direct",
"requested": "[0.10.1, )",
"resolved": "0.10.1",
"contentHash": "nRYmBosiL+42eUpLbHeqP7qJqtp5EpzuIMZTpvq4mFV33VB/JjkFg1y82gk50pjkXlAQWDvRyrfSAmPR5AM+3g==",
"dependencies": {
"iNKORE.UI.WPF": "1.2.8"

Check warning on line 35 in Flow.Launcher/packages.lock.json

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
}
},
"MdXaml": {
Expand Down Expand Up @@ -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, )",
Expand Down Expand Up @@ -218,7 +224,7 @@
"resolved": "2.5.2",
"contentHash": "hp3gKmC/14+6eKLgv7Jd1Z7OV86lO+tNfOXr/stQbwmRhdQuXVSvrRAuAe7G5+lwhkov0XkqZ8/bn1PYWMx6eg=="
},
"iNKORE.UI.WPF": {

Check warning on line 227 in Flow.Launcher/packages.lock.json

View workflow job for this annotation

GitHub Actions / Check Spelling

`NKORE` is not a recognized word. (unrecognized-spelling)
"type": "Transitive",
"resolved": "1.2.8",
"contentHash": "7b+z25JFdhGAfyJqlVIF0vLbmgsRvqDZMvhGPTz20gzQigDPMqVUOoCCKB5824GtYsjFCYNilmaowb+4yWATkQ=="
Expand Down Expand Up @@ -390,7 +396,7 @@
"Microsoft.Extensions.Primitives": "9.0.9"
}
},
"Microsoft.Extensions.FileSystemGlobbing": {

Check warning on line 399 in Flow.Launcher/packages.lock.json

View workflow job for this annotation

GitHub Actions / Check Spelling

`Globbing` is not a recognized word. (unrecognized-spelling)
"type": "Transitive",
"resolved": "9.0.9",
"contentHash": "iQAgORaVIlkhcpxFnVEfjqNWfQCwBEEH7x2IanTwGafA6Tb4xiBoDWySTxUo3MV2NUV/PmwS/8OhT/elPnJCnw=="
Expand Down Expand Up @@ -660,7 +666,7 @@
"resolved": "3.0.0",
"contentHash": "IEghs0QqWsQYH0uUmvIl0Ye6RaebWRh38eB6ToOkDnQucTYRGFOgtig0gSxlwCszTilYFz3n1ZuY762x+kDR3A=="
},
"NHotkey.Wpf": {

Check warning on line 669 in Flow.Launcher/packages.lock.json

View workflow job for this annotation

GitHub Actions / Check Spelling

`NHotkey` is not a recognized word. (unrecognized-spelling)
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "BIUKlhTG5KtFf9OQzWvkmVmktt5/FFj6AOEgag8Uf0R2YdZt5ajUzs3sVskcJcT2TztWlEHKQr1jFj3KQ0D9Nw==",
Expand Down Expand Up @@ -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, )",
Expand All @@ -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, )",
Expand Down
Loading