From 0c999588daecd44070025c10d5f6587754f9e19e Mon Sep 17 00:00:00 2001
From: "Radioactive.exe" <84581607+radioactive-exe@users.noreply.github.com>
Date: Fri, 17 Apr 2026 19:10:11 +0200
Subject: [PATCH] Very simple tidbit- * Add toggle to show/hide Artist Info *
Option added to the Taskbar Widget options * Added to the UI updating flow *
`en-US` localisation updated
---
.../Controls/TaskbarWidgetControl.xaml.cs | 73 +++++++++++++------
FluentFlyoutWPF/Pages/TaskbarWidgetPage.xaml | 14 +++-
.../Localization/Dictionary-en-US.xaml | 2 +
FluentFlyoutWPF/ViewModels/UserSettings.cs | 19 ++++-
4 files changed, 80 insertions(+), 28 deletions(-)
diff --git a/FluentFlyoutWPF/Controls/TaskbarWidgetControl.xaml.cs b/FluentFlyoutWPF/Controls/TaskbarWidgetControl.xaml.cs
index bc9bcaf1..76f4e958 100644
--- a/FluentFlyoutWPF/Controls/TaskbarWidgetControl.xaml.cs
+++ b/FluentFlyoutWPF/Controls/TaskbarWidgetControl.xaml.cs
@@ -61,7 +61,7 @@ public TaskbarWidgetControl()
}
Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0)); ;
-
+
// Initialize control order
ReorderControls();
}
@@ -179,27 +179,34 @@ private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
public (double logicalWidth, double logicalHeight) CalculateSize(double dpiScale)
{
- // calculate widget width - use cached values if text hasn't changed
- string currentTitle = SongTitle.Text;
- string currentArtist = SongArtist.Text;
- if (!string.Equals(currentTitle, _cachedTitleText, StringComparison.Ordinal))
- {
- _cachedTitleWidth = StringWidth.GetStringWidth(currentTitle, 400);
- _cachedTitleText = currentTitle;
- }
- if (!string.Equals(currentArtist, _cachedArtistText, StringComparison.Ordinal))
+ double logicalWidth = 45;
+
+ if (SettingsManager.Current.TaskbarSongInfoEnabled && SongInfoStackPanel.Visibility == Visibility.Visible)
{
- _cachedArtistWidth = StringWidth.GetStringWidth(currentArtist, 400);
- _cachedArtistText = currentArtist;
- }
- double logicalWidth = Math.Max(_cachedTitleWidth, _cachedArtistWidth) + 55; // add margin for cover image
- // maximum width limit, same as Windows native widget
- logicalWidth = Math.Min(logicalWidth, _nativeWidgetsPadding / _scale);
+ // calculate widget width - use cached values if text hasn't changed
+ string currentTitle = SongTitle.Text;
+ string currentArtist = SongArtist.Text;
+
+ if (!string.Equals(currentTitle, _cachedTitleText, StringComparison.Ordinal))
+ {
+ _cachedTitleWidth = StringWidth.GetStringWidth(currentTitle, 400);
+ _cachedTitleText = currentTitle;
+ }
+ if (!string.Equals(currentArtist, _cachedArtistText, StringComparison.Ordinal))
+ {
+ _cachedArtistWidth = StringWidth.GetStringWidth(currentArtist, 400);
+ _cachedArtistText = currentArtist;
+ }
+
+ logicalWidth = Math.Max(_cachedTitleWidth, _cachedArtistWidth) + 55; // add margin for cover image
+ // maximum width limit, same as Windows native widget
+ logicalWidth = Math.Min(logicalWidth, _nativeWidgetsPadding / _scale);
- SongTitle.Width = Math.Max(logicalWidth - 58, 0);
- SongArtist.Width = Math.Max(logicalWidth - 58, 0);
+ SongTitle.Width = Math.Max(logicalWidth - 58, 0);
+ SongArtist.Width = Math.Max(logicalWidth - 58, 0);
+ }
// add space for playback controls if enabled and visible
if (SettingsManager.Current.TaskbarWidgetControlsEnabled && ControlsStackPanel.Visibility == Visibility.Visible)
@@ -252,6 +259,19 @@ public void UpdateUi(string title, string artist, BitmapImage? icon, GlobalSyste
_isPaused = true;
}
+ // adjust UI based on available controls
+ Dispatcher.Invoke(() =>
+ {
+ if (!SettingsManager.Current.TaskbarSongInfoEnabled)
+ {
+ SongInfoStackPanel.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ SongInfoStackPanel.Visibility = Visibility.Visible;
+ }
+ });
+
// adjust UI based on available controls
Dispatcher.Invoke(() =>
{
@@ -341,6 +361,9 @@ public void UpdateUi(string title, string artist, BitmapImage? icon, GlobalSyste
ControlsStackPanel.Visibility = SettingsManager.Current.TaskbarWidgetControlsEnabled
? Visibility.Visible
: Visibility.Collapsed;
+ SongInfoStackPanel.Visibility = SettingsManager.Current.TaskbarSongInfoEnabled
+ ? Visibility.Visible
+ : Visibility.Collapsed;
Visibility = Visibility.Visible;
});
@@ -369,11 +392,15 @@ private async void AnimateEntrance()
EasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseOut }
};
- // Apply animations
- SongInfoStackPanel.BeginAnimation(OpacityProperty, opacityAnimation);
- TranslateTransform translateTransform = new();
- SongInfoStackPanel.RenderTransform = translateTransform;
- translateTransform.BeginAnimation(TranslateTransform.XProperty, translateAnimation);
+ // don't play SongInfoStackPanel animation if it's not enabled
+ if (SettingsManager.Current.TaskbarSongInfoEnabled)
+ {
+ // Apply animations
+ SongInfoStackPanel.BeginAnimation(OpacityProperty, opacityAnimation);
+ TranslateTransform translateTransform = new();
+ SongInfoStackPanel.RenderTransform = translateTransform;
+ translateTransform.BeginAnimation(TranslateTransform.XProperty, translateAnimation);
+ }
// don't play ControlsStackPanel animation if it's not enabled
if (!SettingsManager.Current.TaskbarWidgetControlsEnabled)
diff --git a/FluentFlyoutWPF/Pages/TaskbarWidgetPage.xaml b/FluentFlyoutWPF/Pages/TaskbarWidgetPage.xaml
index e2fda5fc..42b89493 100644
--- a/FluentFlyoutWPF/Pages/TaskbarWidgetPage.xaml
+++ b/FluentFlyoutWPF/Pages/TaskbarWidgetPage.xaml
@@ -32,6 +32,7 @@
+
@@ -225,7 +226,7 @@
-
+
@@ -237,7 +238,16 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/FluentFlyoutWPF/Resources/Localization/Dictionary-en-US.xaml b/FluentFlyoutWPF/Resources/Localization/Dictionary-en-US.xaml
index ea471f7f..04fb4aa7 100644
--- a/FluentFlyoutWPF/Resources/Localization/Dictionary-en-US.xaml
+++ b/FluentFlyoutWPF/Resources/Localization/Dictionary-en-US.xaml
@@ -66,6 +66,8 @@ hides repeat, shuffle and player info
Hides the widget automatically when media is paused
Widget Media Controls
Show media control buttons on the widget
+ Widget Media Song Info
+ Show song info on the widget, as opposed to just the icon
Media Controls Position
Choose where to display the media control buttons
Left
diff --git a/FluentFlyoutWPF/ViewModels/UserSettings.cs b/FluentFlyoutWPF/ViewModels/UserSettings.cs
index 21d1d108..12f363a2 100644
--- a/FluentFlyoutWPF/ViewModels/UserSettings.cs
+++ b/FluentFlyoutWPF/ViewModels/UserSettings.cs
@@ -249,7 +249,7 @@ public string LockKeysDurationText
/// 0 = Default behavior, 1 = Monitor containing the focused window, 2 = Monitor containing the cursor.
[ObservableProperty]
public partial int LockKeysMonitorPreference { get; set; }
-
+
///
/// Determines if the user has updated to a new version
///
@@ -339,7 +339,7 @@ public string LockKeysDurationText
///
[ObservableProperty]
public partial int TaskbarWidgetSelectedMonitor { get; set; }
-
+
///
/// Autohide Widget after a few milliseconds after pause
///
@@ -414,6 +414,12 @@ public string TaskbarWidgetManualPaddingText
[ObservableProperty]
public partial int TaskbarWidgetControlsPosition { get; set; }
+ ///
+ /// Whether or not to show the song info in the taskbar widget
+ ///
+ [ObservableProperty]
+ public partial bool TaskbarSongInfoEnabled { get; set; }
+
///
/// Gets or sets a value indicating whether the taskbar widget should play animations.
///
@@ -577,6 +583,7 @@ public UserSettings()
TaskbarWidgetHideCompletely = false;
TaskbarWidgetControlsEnabled = false;
TaskbarWidgetControlsPosition = 1;
+ TaskbarSongInfoEnabled = true;
TaskbarWidgetAnimated = true;
TaskbarVisualizerEnabled = false;
TaskbarVisualizerPosition = 1;
@@ -684,11 +691,17 @@ partial void OnTaskbarWidgetControlsEnabledChanged(bool oldValue, bool newValue)
partial void OnTaskbarWidgetControlsPositionChanged(int oldValue, int newValue)
{
if (oldValue == newValue || _initializing) return;
-
+
MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;
mainWindow.taskbarWindow?.Widget?.ReorderControls();
}
+ partial void OnTaskbarSongInfoEnabledChanged(bool oldValue, bool newValue)
+ {
+ if (oldValue == newValue || _initializing) return;
+ UpdateTaskbar();
+ }
+
partial void OnTaskbarVisualizerPositionChanged(int oldValue, int newValue)
{
if (oldValue == newValue || _initializing) return;